SelfExplainML / PiML-Toolbox

PiML (Python Interpretable Machine Learning) toolbox for model development & diagnostics
https://selfexplainml.github.io/PiML-Toolbox
Apache License 2.0
912 stars 109 forks source link

Error in data_prepare #46

Open rfox12-edu opened 9 months ago

rfox12-edu commented 9 months ago

exp.data_prepare(target='target', task_type='Classification', test_ratio=0.2, random_state=0)

gave me this error:

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

[<ipython-input-119-03d607a1b01e>](https://localhost:8080/#) in <cell line: 1>()
----> 1 exp.data_prepare(target='target', task_type='Classification', test_ratio=0.2, random_state=0)

10 frames

/usr/local/lib/python3.10/dist-packages/piml/api.cpython-310-x86_64-linux-gnu.so in piml.api.Experiment.data_prepare()

/usr/local/lib/python3.10/dist-packages/piml/api.cpython-310-x86_64-linux-gnu.so in piml.api.Experiment._data_prepare_api()

/usr/local/lib/python3.10/dist-packages/piml/workflow/data_api.cpython-310-x86_64-linux-gnu.so in piml.workflow.data_api.DataAPI.prepare_data()

/usr/local/lib/python3.10/dist-packages/piml/data/base.cpython-310-x86_64-linux-gnu.so in piml.data.base.DataSet.data_prepare()

/usr/local/lib/python3.10/dist-packages/piml/data/base.cpython-310-x86_64-linux-gnu.so in piml.data.base.DataSet.fit_preprocessor()

/usr/local/lib/python3.10/dist-packages/piml/data/data_preprocessor.cpython-310-x86_64-linux-gnu.so in piml.data.data_preprocessor.DataPreprocessor.fit()

[/usr/local/lib/python3.10/dist-packages/sklearn/utils/_set_output.py](https://localhost:8080/#) in wrapped(self, X, *args, **kwargs)
    138     @wraps(f)
    139     def wrapped(self, X, *args, **kwargs):
--> 140         data_to_wrap = f(self, X, *args, **kwargs)
    141         if isinstance(data_to_wrap, tuple):
    142             # only wrap the first output for cross decomposition

/usr/local/lib/python3.10/dist-packages/piml/data/data_preprocessor.cpython-310-x86_64-linux-gnu.so in piml.data.data_preprocessor.DataPreprocessor.fit_transform()

/usr/local/lib/python3.10/dist-packages/numpy/core/overrides.py in unique(*args, **kwargs)

[/usr/local/lib/python3.10/dist-packages/numpy/lib/arraysetops.py](https://localhost:8080/#) in unique(ar, return_index, return_inverse, return_counts, axis, equal_nan)
    272     ar = np.asanyarray(ar)
    273     if axis is None:
--> 274         ret = _unique1d(ar, return_index, return_inverse, return_counts, 
    275                         equal_nan=equal_nan)
    276         return _unpack_tuple(ret)

[/usr/local/lib/python3.10/dist-packages/numpy/lib/arraysetops.py](https://localhost:8080/#) in _unique1d(ar, return_index, return_inverse, return_counts, equal_nan)
    334         aux = ar[perm]
    335     else:
--> 336         ar.sort()
    337         aux = ar
    338     mask = np.empty(aux.shape, dtype=np.bool_)

TypeError: '<' not supported between instances of 'str' and 'float'
ZebinYang commented 9 months ago

Hi @rfox12-edu, can you share a reproducible script here?