module timeseries.base
#
Short summary#
module mlinsights.timeseries.base
Base class for timeseries.
Classes#
class |
truncated documentation |
---|---|
Base for all timeseries preprocessing automatically applied within a predictor. |
|
Base class to build a predictor on timeseries. The class computes one or several predictions at each time, between … |
|
Addition to sklearn.base.RegressorMixin. |
Properties#
property |
truncated documentation |
---|---|
|
HTML representation of estimator. This is redundant with the logic of _repr_mimebundle_. The latter should … |
|
HTML representation of estimator. This is redundant with the logic of _repr_mimebundle_. The latter should … |
Methods#
method |
truncated documentation |
---|---|
Applies the preprocessing to the series. |
|
Applies the preprocessing to the series. |
|
Trains the preprocessing and returns the modified X, y, sample_weight. |
|
Applies the preprocessing. X, y, sample_weight. |
|
Stores the first values. |
|
Returns the reverse tranform. |
|
Tells if there is one preprocessing. |
|
Scores the prediction using |
|
Transforms both X and y. Returns X and y, returns sample_weight as well if not None. The … |
Documentation#
Base class for timeseries.
- class mlinsights.timeseries.base.BaseReciprocalTimeSeriesTransformer(context_length=0)#
Bases:
BaseReciprocalTransformer
Base for all timeseries preprocessing automatically applied within a predictor.
- Parameters:
context_length – number of previous observations to build or rebuild the observations
- __init__(context_length=0)#
- Parameters:
context_length – number of previous observations to build or rebuild the observations
- fit(X, y, sample_weight=None)#
Stores the first values.
- get_fct_inv()#
Returns the reverse tranform.
- transform(X, y, sample_weight=None, context=None)#
Transforms both X and y. Returns X and y, returns sample_weight as well if not None. The context is used when the y series stored in the predictor is not related to the y series given to the transform method.
- class mlinsights.timeseries.base.BaseTimeSeries(past=1, delay1=1, delay2=2, use_all_past=False, preprocessing=None)#
Bases:
BaseEstimator
Base class to build a predictor on timeseries. The class computes one or several predictions at each time, between delay1 and delay2. It computes:
with d in [delay1, delay2[ and
.
- Parameters:
past – values to use to predict
delay1 – the model computes the first prediction for time=t + delay1
delay2 – the model computes the last prediction for time=t + delay2 excluded
use_all_past – use all past features, not only the timeseries
preprocessing – preprocessing to apply before predicting, only the timeseries itselves, it can be a difference, it must be of type
BaseReciprocalTimeSeriesTransformer
- __init__(past=1, delay1=1, delay2=2, use_all_past=False, preprocessing=None)#
- Parameters:
past – values to use to predict
delay1 – the model computes the first prediction for time=t + delay1
delay2 – the model computes the last prediction for time=t + delay2 excluded
use_all_past – use all past features, not only the timeseries
preprocessing – preprocessing to apply before predicting, only the timeseries itselves, it can be a difference, it must be of type
BaseReciprocalTimeSeriesTransformer
- _applies_preprocessing(X, y, sample_weight)#
Applies the preprocessing to the series.
- _applies_preprocessing_inv(X, y, sample_weight)#
Applies the preprocessing to the series.
- _base_fit_predict(X, y, sample_weight=None)#
Trains the preprocessing and returns the modified X, y, sample_weight.
- Parameters:
X – output of X may be empty (None)
y – timeseries (one single vector), array [n_obs]
sample_weight – weights None or array [n_obs]
- Returns:
X, y, sample_weight
The y series is moved by self.delay1 in the past.
- _fit_preprocessing(X, y, sample_weight=None)#
Applies the preprocessing. X, y, sample_weight.
- Parameters:
X – output of X may be empty (None)
y – timeseries (one single vector), array [n_obs]
sample_weight – weights None or array [n_obs]
- Returns:
X, y, sample_weight
- has_preprocessing()#
Tells if there is one preprocessing.
- class mlinsights.timeseries.base.TimeSeriesRegressorMixin#
Bases:
RegressorMixin
Addition to sklearn.base.RegressorMixin.