Bases: pycast.methods.basemethod.BaseMethod
Implements the simple moving average.
The SMA algorithm will calculate the average value at time t based on the datapoints between [t - floor(windowsize / 2), t + floor(windowsize / 2)].
Initializes the SimpleMovingAverage.
Parameters: | windowsize (integer) – Size of the SimpleMovingAverages window. |
---|---|
Raise: | Raises a ValueError if windowsize is an even or not larger than zero. |
Returns the intervals for the methods parameter.
Only parameters with defined intervals can be used for optimization!
Returns: | Returns a dictionary containing the parameter intervals, using the parameter
name as key, while the value hast the following format:
[minValue, maxValue, minIntervalClosed, maxIntervalClosed]
|
---|---|
Return type: | dictionary |
Creates a new TimeSeries containing the SMA values for the predefined windowsize.
Parameters: | timeSeries (TimeSeries) – The TimeSeries used to calculate the simple moving average values. |
---|---|
Returns: | TimeSeries object containing the smooth moving average. |
Return type: | TimeSeries |
Raise: | Raises a ValueError wif the defined windowsize is larger than the number of elements in timeSeries |
Note: | This implementation aims to support independent for loop execution. |