Import error rand_score

cwentz
cwentz Dataiku DSS Core Concepts, Registered Posts: 33 ✭✭✭✭
edited July 16 in Using Dataiku

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

Tagged:

Answers

  • HarizoR
    HarizoR Dataiker, Alpha Tester, Registered Posts: 138 Dataiker

    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

  • cwentz
    cwentz Dataiku DSS Core Concepts, Registered Posts: 33 ✭✭✭✭

    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.

  • HarizoR
    HarizoR Dataiker, Alpha Tester, Registered Posts: 138 Dataiker

    Hi,

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

  • cwentz
    cwentz Dataiku DSS Core Concepts, Registered Posts: 33 ✭✭✭✭
    edited July 17
    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'
Setup Info
    Tags
      Help me…