Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alephpt opened this issue Jun 15, 2023 · 0 comments
Open

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

alephpt opened this issue Jun 15, 2023 · 0 comments

Comments

@alephpt
Copy link

alephpt commented Jun 15, 2023

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant