giotto-tda icon indicating copy to clipboard operation
giotto-tda copied to clipboard

[BUG] Cannot run Scaler()

Open albienaculan14 opened this issue 1 year ago • 4 comments

I re-ran the Lorenz attractor notebook from giotto-tda examples. In the part using scaler,

diagramScaler = Scaler()

X_scaled = diagramScaler.fit_transform(X_diagrams)

diagramScaler.plot(X_scaled, sample=window_number)

I get the following error:

TypeError: Parameter function is of type <class 'numpy._ArrayFunctionDispatcher'> while it should be of type (<class 'function'>, <class 'NoneType'>).

I also ran this using the data that I have and the Scaler method also produced the same error.

albienaculan14 avatar Oct 20 '23 11:10 albienaculan14

I have the same question

taoshen1 avatar Nov 12 '23 13:11 taoshen1

The same TypeError also happens in Lab.fit_transform_resample(X, X) in time_series_forecasting.ipynb.

Lunamos avatar Nov 13 '23 13:11 Lunamos

What is your numpy version? There is no update for a while, probably new versions of libraries break backward compatibility. It works here with

Python implementation: CPython
Python version       : 3.10.9
IPython version      : 8.13.1

sklearn: 1.2.2

plotly: 5.13.1
openml: 0.13.0
numpy : 1.23.5

Almost all examples are broken with scikit-learn 1.3.x. I hope there is an update as this is a very interesting software,

beew avatar Nov 30 '23 20:11 beew

It is easily to be solved using the lambda x: np.max(x), be like:

Scaler(metric='persistence_image', function=lambda x: np.max(x), n_jobs=-1).fit_transform(persistence_diagrams)

hawkinglai avatar May 20 '24 10:05 hawkinglai