Skip to content

BOSSVS not working with a single feature #146

Open
@roman-4erkasov

Description

Description

Class pyts.classification.BOSSVS doesn't accept timeseries of one feature.
Advices from the error message doesn't help, but leads to another error.

Steps/Code to Reproduce

I tried all the three possible versions to use timeseries of one feature:

  1. The first version is just 1D-array:
import numpy as np
from pyts.classification import BOSSVS
x_train = np.random.uniform(low=0.0, high=10.0, size=(300,))
y_train = np.random.randint(low=0, high=2, size=(300,))
est = BOSSVS().fit(x_train, y_train)

This example gives:

ValueError: Expected 2D array, got 1D array instead:
array=[1.84916215 7.16606073 5.69089018 ... ].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
  1. After that I tried the following code
import numpy as np
from pyts.classification import BOSSVS
x_train = np.random.uniform(low=0.0, high=10.0, size=(300,))
y_train = np.random.randint(low=0, high=2, size=(300,))
est = BOSSVS().fit(x_train.reshape(-1, 1), y_train)

It gives the following error:
ValueError: If 'window_size' is an integer, it must be greater than or equal to 1 and lower than or equal to n_timestamps if 'drop_sum=False'.

  1. Finally I tried the following code:
import numpy as np
from pyts.classification import BOSSVS
x_train = np.random.uniform(low=0.0, high=10.0, size=(300,))
y_train = np.random.randint(low=0, high=2, size=(300,))
est = BOSSVS().fit(x_train.reshape(1, -1), y_train)

It gives the following error:
ValueError: Found input variables with inconsistent numbers of samples: [1, 300]

Versions

NumPy 1.23.4
SciPy 1.9.3
Scikit-Learn 1.2.0
Numba 0.56.4
Pyts 0.12.0

Thank You!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions