Skip to contents

Processor for irregular time series data with missing values. Supports uniform resampling and two imputation strategies: forward-fill and zero-fill.

Super classes

RHealth::Processor -> RHealth::FeatureProcessor -> TimeseriesProcessor

Public fields

sampling_rate

A lubridate duration indicating the sampling step size.

impute_strategy

A character string: 'forward_fill' or 'zero'.

.size

Number of features (set on first call to process()).

Methods

Inherited methods


Method new()

Initialize the processor with a sampling rate and imputation strategy.

Usage

TimeseriesProcessor$new(
  sampling_rate = lubridate::dhours(1),
  impute_strategy = "forward_fill"
)

Arguments

sampling_rate

A lubridate duration (e.g., lubridate::dhours(1)).

impute_strategy

Either 'forward_fill' or 'zero'.


Method process()

Process irregular time series into uniformly sampled tensor. Step 1: uniformly sample time points and place values at correct positions. Step 2: impute missing entries using selected strategy.

Usage

TimeseriesProcessor$process(value)

Arguments

value

A list: list(timestamps = POSIXct vector, values = matrix).

Returns

A torch tensor of shape [T, F].


Method size()

Return the number of features.

Usage

TimeseriesProcessor$size()

Returns

Integer


Method print()

Print summary

Usage

TimeseriesProcessor$print(...)

Arguments

...

Ignored.


Method clone()

The objects of this class are cloneable with this method.

Usage

TimeseriesProcessor$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.