Persistent Model

This module contains the implementation of the persistent model for online learning. The persistent model is designed to return the last observed value as the prediction for the next time step. This simple approach can be effective in certain scenarios where the data exhibits temporal dependencies.

Persistent Model Class

class source.model.naive.Persistent

Bases: object

Predictor that always predicts the last observed value.

Parameters:

num_variables (int) – Number of variables including the constant.

Initialize the predictor.

__init__()

Initialize the predictor.

fit(observations)

Fit the model to a set of observations and labels.

Parameters:

observations (list of numpy arrays) – List of observation vectors.

predict()

Predict the next value based on the last observation.

Returns:

Predicted value for the next observation.

Return type:

float

update(observation)

Update the model with a new observation and label.

Parameters:

observation (numpy array) – Observation vector.