H
- the predicted variable which is supposedly correlated to its previous values.public abstract class TimeSeries<H>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
key
A unique key for this time series
|
protected int |
lag
the window to use for predictions
|
protected int |
season
the seasonality of the data (is there seasonality after 7 days?)
|
Constructor and Description |
---|
TimeSeries() |
Modifier and Type | Method and Description |
---|---|
void |
addObservation(Observation<H> observation) |
protected Observation<H> |
findLastAvailableObservation() |
protected abstract void |
fit(LimitedQueue<Observation<H>> currentObservations)
Subclasses need to fit their corresponding time series model to the currently available data.
|
Observation<H> |
getLastObservation() |
Observation<H> |
getObservationOfLastSeason(long index) |
protected abstract Prediction<H> |
getPrediction(int h,
java.lang.Object... payload)
Subclasses need to provide an implementation for the prediction of h-steps into the future given the current position
|
protected abstract boolean |
isAvailable(H observation) |
Prediction<H> |
predict(int h,
java.lang.Object... payload)
Performs a forecast based on the current observations h steps ahead.
|
void |
resetTo(java.util.List<Observation<H>> observations)
resets the current observations to the passed observations
(useful for initialization)
|
void |
setKey(java.lang.String key) |
protected int lag
protected int season
protected java.lang.String key
public void resetTo(java.util.List<Observation<H>> observations)
observations
- List of Observation
spublic Prediction<H> predict(int h, java.lang.Object... payload)
h
- the forecast horizonPrediction
a predictionpublic void addObservation(Observation<H> observation)
public Observation<H> getLastObservation()
protected Observation<H> findLastAvailableObservation()
public Observation<H> getObservationOfLastSeason(long index)
protected abstract boolean isAvailable(H observation)
public void setKey(java.lang.String key)
protected abstract void fit(LimitedQueue<Observation<H>> currentObservations)
protected abstract Prediction<H> getPrediction(int h, java.lang.Object... payload)
h
- the prediction/forecast horizonpayload
- additional information which is available at time of prediction (if there are other additional explanatory variables)