Import error rand_score

cwentz
Level 3
Import error rand_score

Using the following code: 

from sklearn.metrics import rand_score (which is what is required per scikit-learn.org

Screen Shot 2022-10-27 at 1.00.17 PM.png

 

I get error 

 

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-187-d43b243c5958> in <module>
----> 1 from sklearn.metrics import rand_score

ImportError: cannot import name 'rand_score'

 

 I have spoken to others who are now telling me that I am using an old version of sklearn. The last version that is stable is 1.1.3 and when I tried to add that to my env it would let me go past .22

I am using python 3.6


Operating system used: macOS

0 Kudos
4 Replies
HarizoR
Developer Advocate

Hi,

If you are defining a custom metric from the visual ML interface of Dataiku then you are indeed using an older version of scikit-learn. 

That being said, you should still be able to compute your metric by using sklearn.metrics.adjusted_rand_score (doc).

Hope this helps.

Best,

Harizo

 

 

 

0 Kudos
cwentz
Level 3
Author

Yes, I can use adjusted but they are two different measurements.

I have a code environment that I set up for running python in Dataiku. This is a list of the packages installed. When I try to install any new packages that are stable I get error telling me they are not available. I have not been able to install any newer packages. 

0 Kudos
HarizoR
Developer Advocate

Hi,

What is the  exact error message that you get when trying to install the code env packages?

0 Kudos
cwentz
Level 3
Author
ImportError                               Traceback (most recent call last)
<ipython-input-187-d43b243c5958> in <module>
----> 1 from sklearn.metrics import rand_score

ImportError: cannot import name 'rand_score'
0 Kudos