Code Monkey home page Code Monkey logo

Comments (5)

luispedro avatar luispedro commented on June 10, 2024

Thanks for the message. I can imagine this happening if fit_model is called with unexpected arguments, but should work if called correctly. For example, it is used in seeds_threshold.py and it works on my side.

Can you please post a full example that triggers the error for you?

from buildingmachinelearningsystemswithpython.

prasunsrivastava avatar prasunsrivastava commented on June 10, 2024

Thanks for pointing in the right direction. What I had failed to notice earlier was that after calling the function, the arrays, pred and labels were having different lengths which was yielding a single boolean value. In fact, this is the case that is happening in the code snippet contained in chapter.py at the below location:

image

Here, pred is a boolean array of length 100 whereas is_virginica is a boolean array of length 150 which is generating a single bool value. In my opinion, we should add one more line after building is_virginica as below to select non-setosa labels only as we are using only non-setosa features:

is_virginica = is_virginica[~is_setosa]

from buildingmachinelearningsystemswithpython.

luispedro avatar luispedro commented on June 10, 2024

Is this line 69 in the current (second edition) version of chapter.py? If so, it runs correctly on my side.

Note that is_virginica is defined as is_virginica = (labels == 'virginica') after labels = labels[~is_setosa].

If you are using the first edition, I do remember that there were a few of these manipulations which were (unfortunately) not in the book.

from buildingmachinelearningsystemswithpython.

prasunsrivastava avatar prasunsrivastava commented on June 10, 2024

Unfotunately, I am using the first edition of the book. However, I am now able to execute the code without any errors. Thanks for all your support.

from buildingmachinelearningsystemswithpython.

luispedro avatar luispedro commented on June 10, 2024

Great that you solved your problem.

The code related updates to the book are all in this repository, so if you run into any issues, check here or get in touch (we're always happy to help).

from buildingmachinelearningsystemswithpython.

Related Issues (13)

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.