Skip to content

'MinMaxScaler' object has no attribute 'clip' #285

@alephpt

Description

@alephpt

I have noticed a bug/deprecation between versions of scikit when trying to run the matcher. This does not appear to be a problem with hmni, but rather version control issues between python, hmni and scikit specifically..

When using Python 11, with various versions of scikit-learn installed, the self.baseModel.predict_proba(x.reshape(1, -1))[0, 1] line in matcher.py triggers the sklearn pipeline.py which has a dependency to trigger an if self.clip: check in sklearn\preprocessing_data.py via the predict_proba

  File "C:\Users\alephpt\Documents\repos\personal\python\random\string_comp.py", line 6, in hmni_compare
    return matcher.similarity(s1, s2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alephpt\AppData\Local\Programs\Python\Python311\Lib\site-packages\hmni\matcher.py", line 266, in similarity
    sim = self.meta_inf(pair, features)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alephpt\AppData\Local\Programs\Python\Python311\Lib\site-packages\hmni\matcher.py", line 418, in meta_inf
    meta_features[0] = self.base_model_inf(base_features)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alephpt\AppData\Local\Programs\Python\Python311\Lib\site-packages\hmni\matcher.py", line 413, in base_model_inf
    y_pred = self.baseModel.predict_proba(x.reshape(1, -1))[0, 1]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alephpt\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\pipeline.py", line 546, in predict_proba
    Xt = transform.transform(Xt)
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alephpt\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\utils\_set_output.py", line 140, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\alephpt\AppData\Local\Programs\Python\Python311\Lib\site-packages\sklearn\preprocessing\_data.py", line 518, in transform
    if self.clip:
       ^^^^^^^^^

I believe one solution would be to set self.clip to none for transform instance, but I'm not sure how to do this from my code without trying to change the matcher.py instance in hmni 🤔

Metadata

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