Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Mastering Machine Learning with scikit-learn
Mastering Machine Learning with scikit-learn

Mastering Machine Learning with scikit-learn: Apply effective learning algorithms to real-world problems using scikit-learn , Second Edition

eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Mastering Machine Learning with scikit-learn

Simple Linear Regression

In this chapter, we will introduce our first model, simple linear regression. Simple linear regression models the relationship between one response variable and one feature of an explanatory variable. We will discuss how to fit our model, and we will work through a toy problem. While simple linear regression is rarely applicable to real-world problems, understanding it is essential to understanding many other models. In subsequent chapters, we will learn about generalizations of simple linear regression and apply them to real-world datasets.

Simple linear regression

In the previous chapter, we learned that training data is used to estimate the parameters of a model in supervised learning problems. Observations of explanatory variables and their corresponding response variables comprise training data. The model can be used to predict the value of the response variable for values of the explanatory variable that have not been previously observed. Recall that the goal in regression problems is to predict the value of a continuous response variable. In this chapter, we will examine simple linear regression, which can be used to model a linear relationship between one response variable and one feature representing an explanatory variable.

Suppose you wish to know the price of a pizza. You might simply look at a menu. This, however, is a machine learning book, so instead we will use simple linear regression to predict the...

Evaluating the model

We have used a learning algorithm to estimate a model's parameters from training data. How can we assess whether our model is a good representation of the real relationship? Let's assume that you have found another page in your pizza journal. We will use this page's entries as a test set to measure the performance of our model. We have added a fourth column; it contains the prices predicted by our model.

Test instance

Diameter in inches

Observed price in dollars

Predicted price in dollars

1

8

11

9.7759

2

9

8.5

10.7522

3

11

15

12.7048

4

16

18

17.5863

5

12

11

13.6811

 

Several measures can be used to assess our model's predictive capability. We will evaluate our pizza price predictor using a measure called R-squared. Also known as the coefficient of determination, R-squared...

Summary

In this chapter, we introduced simple linear regression, which models the relationship between a single explanatory variable and a continuous response variable. We worked through a toy problem to predict the price of a pizza from its diameter. We used the residual sum of squares cost function to assess the fitness of our model, and analytically solved the values of our model's parameter that minimized the cost function. We measured the performance of our model on a test set. Finally, we introduced scikit-learn's estimator API. In the next chapter, we will compare and contrast simple linear regression with another simple, ubiquitous model, k-Nearest Neighbors (KNN).

Left arrow icon Right arrow icon

Key benefits

  • Master popular machine learning models including k-nearest neighbors, random forests, logistic regression, k-means, naive Bayes, and artificial neural networks
  • Learn how to build and evaluate performance of efficient models using scikit-learn
  • Practical guide to master your basics and learn from real life applications of machine learning

Description

Machine learning is the buzzword bringing computer science and statistics together to build smart and efficient models. Using powerful algorithms and techniques offered by machine learning you can automate any analytical model. This book examines a variety of machine learning models including popular machine learning algorithms such as k-nearest neighbors, logistic regression, naive Bayes, k-means, decision trees, and artificial neural networks. It discusses data preprocessing, hyperparameter optimization, and ensemble methods. You will build systems that classify documents, recognize images, detect ads, and more. You will learn to use scikit-learn’s API to extract features from categorical variables, text and images; evaluate model performance, and develop an intuition for how to improve your model’s performance. By the end of this book, you will master all required concepts of scikit-learn to build efficient models at work to carry out advanced tasks with the practical approach.

Who is this book for?

This book is intended for software engineers who want to understand how common machine learning algorithms work and develop an intuition for how to use them, and for data scientists who want to learn about the scikit-learn API. Familiarity with machine learning fundamentals and Python are helpful, but not required.

What you will learn

  • • Review fundamental concepts such as bias and variance
  • • Extract features from categorical variables, text, and images
  • • Predict the values of continuous variables using linear regression and K Nearest Neighbors
  • • Classify documents and images using logistic regression and support vector machines
  • • Create ensembles of estimators using bagging and boosting techniques
  • • Discover hidden structures in data using K-Means clustering
  • • Evaluate the performance of machine learning systems in common tasks

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 24, 2017
Length: 254 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788298490
Vendor :
Google
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jul 24, 2017
Length: 254 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788298490
Vendor :
Google
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 144.97
scikit-learn : Machine Learning Simplified
€74.99
Mastering Machine Learning with scikit-learn
€36.99
scikit-learn Cookbook , Second Edition
€32.99
Total 144.97 Stars icon
Banner background image

Table of Contents

14 Chapters
The Fundamentals of Machine Learning Chevron down icon Chevron up icon
Simple Linear Regression Chevron down icon Chevron up icon
Classification and Regression with k-Nearest Neighbors Chevron down icon Chevron up icon
Feature Extraction Chevron down icon Chevron up icon
From Simple Linear Regression to Multiple Linear Regression Chevron down icon Chevron up icon
From Linear Regression to Logistic Regression Chevron down icon Chevron up icon
Naive Bayes Chevron down icon Chevron up icon
Nonlinear Classification and Regression with Decision Trees Chevron down icon Chevron up icon
From Decision Trees to Random Forests and Other Ensemble Methods Chevron down icon Chevron up icon
The Perceptron Chevron down icon Chevron up icon
From the Perceptron to Support Vector Machines Chevron down icon Chevron up icon
From the Perceptron to Artificial Neural Networks Chevron down icon Chevron up icon
K-means Chevron down icon Chevron up icon
Dimensionality Reduction with Principal Component Analysis Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(2 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Spencer C. Sep 15, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book introduces algorithms with their pros and cons as well as using them on datasets to show how they are invoked from scikit-learn. I really enjoy having a resource near me to quickly get implementation or algorithm details.
Amazon Verified review Amazon
Kindle Customer Mar 23, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very usefulExcellent book for classification , step by step code is given to do practical implementation... nicely explained....good book
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.