MLBazaar / MLPrimitives

Primitives for machine learning and data science.
https://mlbazaar.github.io/MLPrimitives
MIT License
70 stars 38 forks source link

Add offset to rolling_window_sequence primitive #251

Closed skyeeiskowitz closed 3 years ago

skyeeiskowitz commented 3 years ago

Description

Add new offset argument to mlprimitives/primitives/mlprimitives.custom.timeseries_preprocessing.rolling_window_sequences.json

The offset indicates the number of steps that will be created between the input and the target sequence.

What I Did

Added argument offset=0 to the rolling_window_sequences function in mlprimitives/custom/timeseries_preprocessing.py Added docstring describing offset Changed max_start:

max_start = len(X) - window_size - target_size - offset + 1

Changed out_y and y_index:

        out_y.append(target[end + offset:end + offset + target_size])
        y_index.append(index[end + offset])

Added fixed hyperparameter to the primitive json mlprimitives/primitives/mlprimitives.custom.timeseries_preprocessing.rolling_window_sequences.json

            "offset": {
                "type": "int",
                "default": 0
            }
csala commented 3 years ago

Sounds good @skyeeiskowitz ! Please go ahead and do a PR!