Giter Site home page Giter Site logo

Comments (7)

nicodv avatar nicodv commented on July 25, 2024 2

There now is a random_state argument available.

Old answer:
Yes there is. Set the random seed for numpy: np.random.seed(42)

from kmodes.

Nishanth14 avatar Nishanth14 commented on July 25, 2024

Thanks! it worked.

from kmodes.

supreetkt avatar supreetkt commented on July 25, 2024

Hi, I have a similar issue. I'm able to set a random_state parameter, but it isn't working as a seed. The results change with each run anyway.

from kmodes.

nicodv avatar nicodv commented on July 25, 2024

@supreetkt , could you present a minimal reproducible example?

from kmodes.

supreetkt avatar supreetkt commented on July 25, 2024

Okay, I think I was wrong. I'm not able to set the seed at all. Currently, my predictions for kmodes are changing with each run.
Can you tell me how to set a seed for k_modes here? I tried:

kmodes_seed = 123
km = KModes(n_clusters=k, init='Huang', n_init=5, random_state=kmodes_seed)
model = km.fit(np_array)
predictions_lst = km.labels_.tolist()

and it isn't allowing me.

from kmodes.

supreetkt avatar supreetkt commented on July 25, 2024

Okay, I figured it out. I had installed kmodes with pip install and somehow it still contained the previous version where random_state was not available as a parameter. I updated the file and it is working now.

from kmodes.

nicodv avatar nicodv commented on July 25, 2024

OK, great. Yes, that feature will be in the next release.

from kmodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.