rolling_regressor
RollingRegressor(module, loss_fn='mse', optimizer_fn='sgd', lr=0.001, is_feature_incremental=False, window_size=10, append_predict=False, device='cpu', seed=42, **kwargs)
¶
Bases: RollingDeepEstimator
, Regressor
Wrapper that feeds a sliding window of the most recent examples to the wrapped PyTorch regression model.
PARAMETER | DESCRIPTION |
---|---|
module
|
Torch Module that builds the autoencoder to be wrapped.
The Module should accept parameter
TYPE:
|
loss_fn
|
Loss function to be used for training the wrapped model. Can be a
loss function provided by
TYPE:
|
optimizer_fn
|
Optimizer to be used for training the wrapped model. Can be an
optimizer class provided by
TYPE:
|
lr
|
Learning rate of the optimizer.
TYPE:
|
is_feature_incremental
|
Whether the model should adapt to the appearance of previously features by adding units to the input layer of the network.
TYPE:
|
device
|
Device to run the wrapped model on. Can be "cpu" or "cuda".
TYPE:
|
seed
|
Random seed to be used for training the wrapped model.
TYPE:
|
window_size
|
Number of recent examples to be fed to the wrapped model at each step.
TYPE:
|
append_predict
|
Whether to append inputs passed for prediction to the rolling window.
TYPE:
|
**kwargs
|
Parameters to be passed to the
DEFAULT:
|
learn_one(x, y, **kwargs)
¶
Performs one step of training with the sliding window of the most recent examples.
PARAMETER | DESCRIPTION |
---|---|
x
|
Input example.
TYPE:
|
y
|
Target value.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RollingRegressor
|
The regressor itself. |
predict_one(x)
¶
Predicts the target value for the current sliding window of most recent examples.
PARAMETER | DESCRIPTION |
---|---|
x
|
Input example.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RegTarget
|
Predicted target value. |