rolling_window_sequences primitive does not support target_size=0

Open
#205 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python

Research direction

Start by locating the Python implementation of the rolling_window_sequences primitive and inspect the loop around X[start:end], X_index.append(index[start]), and y_index.append(index[end]). Verify the target_size=0 behavior against the issue’s expected empty target values and target index, then run the primitive’s relevant tests if available.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
70
Forks
37
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MLBazaar/MLPrimitives

All issues in MLBazaar/MLPrimitives

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.