Skip to content

rolling_window_sequences primitive does not support target_size=0 #205

@AlexanderGeiger

Description

@AlexanderGeiger

The rolling_window_sequences primitive is not allowing a target_size of 0, in which case an out-of-bounds error will be raised for the line y_index.append(index[end]).
The reason is the way we iterate over the arrays, where in the last iteration end is equal to len(index).

However, it would be quite useful to specify target_size=0 in cases where we do not have targets/predictions, but rather only want to create rolling input windows. (Examples would be the CycleGAN primitive or any other reconstruction based models like Autoencoder).

One potential solution would be to check if target_size>0.

...
out_X.append(X[start:end])
X_index.append(index[start])
if target_size>0:
    out_y.append(target[end:end + target_size])
    y_index.append(index[end])
...

This way we would return an empty arrays for the target values and target index if target_size=0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions