Git Product home page Git Product logo

Comments (4)

ageron avatar ageron commented on May 3, 2024 2

Hi Thiago,

Thanks for your kind words and for your feedback. I just checked, I get the same error as you. It seems that identifier used to be a string and somehow it is now an int. Weird, probably a change I made, sorry about that. Anyway, the fix is simple (I just pushed it): replace hash(identifier) by hash(str(identifier).encode("ascii")). Basically MD5 only works on a byte array (on another object that implements the buffer API). So I first convert the int to a string, then encode the string to a byte array. No pretty, but it works.

from handson-ml.

ageron avatar ageron commented on May 3, 2024

Apparently what happened is that in a previous version of Pandas, integers were returned as numpy.int64, which happen to implement the buffer API. Now they are returned as plain ints, hence the bug. This led me to a cleaner solution: simply convert the identifier to a numpy.int64, and the bug is fixed. It beats converting it to a unicode string then encoding it to ascii.

Side note: I wrote this chapter using scikit-learn 0.17.1, and you will get a bunch of deprecation warnings right now if you run it using the latest scikit-learn version 0.18. I'm going through the code now to get rid of these warnings. It's hard to write a book on a moving target!

from handson-ml.

thiagoavadore avatar thiagoavadore commented on May 3, 2024

Thanks very much for the Help! =)

from handson-ml.

ageron avatar ageron commented on May 3, 2024

My pleasure. FYI, I upgraded all notebooks to sklearn 0.18, so the deprecated warnings are gone. Don't hesitate to mention all problems you run into, I can still fix the book in the next couple of weeks. Thanks!

from handson-ml.

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.