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
Machine Learning with R
Machine Learning with R

Machine Learning with R: Expert techniques for predictive modeling , Third Edition

Arrow left icon
Profile Icon Brett Lantz
Arrow right icon
NZ$14.99 NZ$70.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (46 Ratings)
eBook Apr 2019 458 pages 3rd Edition
eBook
NZ$14.99 NZ$70.99
Paperback
NZ$87.99
Subscription
Free Trial
Arrow left icon
Profile Icon Brett Lantz
Arrow right icon
NZ$14.99 NZ$70.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (46 Ratings)
eBook Apr 2019 458 pages 3rd Edition
eBook
NZ$14.99 NZ$70.99
Paperback
NZ$87.99
Subscription
Free Trial
eBook
NZ$14.99 NZ$70.99
Paperback
NZ$87.99
Subscription
Free Trial

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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

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

Machine Learning with R

Chapter 2. Managing and Understanding Data

A key early component of any machine learning project involves managing and understanding data. Although this may not be as gratifying as building and deploying models—the stages in which you begin to see the fruits of your labor—it is unwise to ignore this important preparatory work.

Any learning algorithm is only as good as its input data, and in many cases, the input data is complex, messy, and spread across multiple sources and formats. Due to this complexity, often the largest portion of effort invested in machine learning projects is spent on data preparation and exploration.

This chapter approaches data preparation in three ways. The first section discusses the basic data structures R uses to store data. You will become very familiar with these structures as you create and manipulate datasets. The second section is practical, as it covers several functions that are used for getting data in and...

R data structures

There are numerous types of data structures across programming languages, each with strengths and weaknesses suited to specific tasks. Since R is a programming language used widely for statistical data analysis, the data structures it utilizes were designed with this type of work in mind.

The R data structures used most frequently in machine learning are vectors, factors, lists, arrays, matrices, and data frames. Each is tailored to a specific data management task, which makes it important to understand how they will interact in your R project. In the sections that follow, we will review their similarities and differences.

Vectors

The fundamental R data structure is the vector, which stores an ordered set of values called elements. A vector can contain any number of elements. However, all of its elements must be of the same type; for instance, a vector cannot contain both numbers and text. To determine the type of vector v, use the typeof(v) command.

Several...

Managing data with R

One of the challenges faced while working with massive datasets involves gathering, preparing, and otherwise managing data from a variety of sources. Although we will cover data preparation, data cleaning, and data management in depth by working on real-world machine learning tasks in later chapters, this section highlights the basic functionality for getting data in and out of R.

Saving, loading, and removing R data structures

When you have spent a lot of time getting a data frame into the desired form, you shouldn't need to recreate your work each time you restart your R session. To save a data structure to a file that can be reloaded later or transferred to another system, use the save() function. The save() function writes one or more R data structures to the location specified by the file parameter. R data files have an .RData extension.

Suppose you had three objects named x, y, and z that you would like to save to a permanent file. Regardless of whether...

Exploring and understanding data

After collecting data and loading it into R data structures, the next step in the machine learning process involves examining the data in detail. It is during this step that you will begin to explore the data's features and examples, and realize the peculiarities that make your data unique. The better you understand your data, the better you will be able to match a machine learning model to your learning problem.

The best way to learn the process of data exploration is by example. In this section, we will explore the usedcars.csv dataset, which contains actual data about used cars advertised for sale on a popular US website in the year 2012.

Tip

The usedcars.csv dataset is available for download on the Packt Publishing support page for this book. If you are following along with the examples, be sure that this file has been downloaded and saved to your R working directory.

Since the dataset is stored in CSV form, we can use the read.csv...

Summary

In this chapter, we learned about the basics of managing data in R. We started by taking an in-depth look at the structures used for storing various types of data. The foundational R data structure is the vector, which is extended and combined into more complex data types, such as lists and data frames. The data frame is an R data structure that corresponds to the notion of a dataset having both features and examples. R provides functions for reading and writing data frames to spreadsheet-like tabular data files.

We then explored a real-world dataset containing prices of used cars. We examined numeric variables using common summary statistics of center and spread, and visualized relationships between prices and odometer readings with a scatterplot. Next, we examined nominal variables using tables. In examining the used car data, we followed an exploratory process that can be used to understand any dataset. These skills will be required for the other projects throughout...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Third edition of the bestselling, widely acclaimed R machine learning book, updated and improved for R 3.6 and beyond
  • Harness the power of R to build flexible, effective, and transparent machine learning models
  • Learn quickly with a clear, hands-on guide by experienced machine learning teacher and practitioner, Brett Lantz

Description

Machine learning, at its core, is concerned with transforming data into actionable knowledge. R offers a powerful set of machine learning methods to quickly and easily gain insight from your data. Machine Learning with R, Third Edition provides a hands-on, readable guide to applying machine learning to real-world problems. Whether you are an experienced R user or new to the language, Brett Lantz teaches you everything you need to uncover key insights, make new predictions, and visualize your findings. This new 3rd edition updates the classic R data science book to R 3.6 with newer and better libraries, advice on ethical and bias issues in machine learning, and an introduction to deep learning. Find powerful new insights in your data; discover machine learning with R.

Who is this book for?

Data scientists, students, and other practitioners who want a clear, accessible guide to machine learning with R.

What you will learn

  • Discover the origins of machine learning and how exactly a computer learns by example
  • Prepare your data for machine learning work with the R programming language
  • Classify important outcomes using nearest neighbor and Bayesian methods
  • Predict future events using decision trees, rules, and support vector machines
  • Forecast numeric data and estimate financial values using regression methods
  • Model complex processes with artificial neural networks — the basis of deep learning
  • Avoid bias in machine learning models
  • Evaluate your models and improve their performance
  • Connect R to SQL databases and emerging big data technologies such as Spark, H2O, and TensorFlow

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 15, 2019
Length: 458 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788291552
Category :
Languages :
Tools :

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
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Apr 15, 2019
Length: 458 pages
Edition : 3rd
Language : English
ISBN-13 : 9781788291552
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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 NZ$7 each
Feature tick icon Exclusive print discounts
$279.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 NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 233.97
Mastering Machine Learning with R
NZ$64.99
Python Machine Learning
NZ$80.99
Machine Learning with R
NZ$87.99
Total NZ$ 233.97 Stars icon
Banner background image

Table of Contents

15 Chapters
1. Introducing Machine Learning Chevron down icon Chevron up icon
2. Managing and Understanding Data Chevron down icon Chevron up icon
3. Lazy Learning – Classification Using Nearest Neighbors Chevron down icon Chevron up icon
4. Probabilistic Learning – Classification Using Naive Bayes Chevron down icon Chevron up icon
5. Divide and Conquer – Classification Using Decision Trees and Rules Chevron down icon Chevron up icon
6. Forecasting Numeric Data – Regression Methods Chevron down icon Chevron up icon
7. Black Box Methods – Neural Networks and Support Vector Machines Chevron down icon Chevron up icon
8. Finding Patterns – Market Basket Analysis Using Association Rules Chevron down icon Chevron up icon
9. Finding Groups of Data – Clustering with k-means Chevron down icon Chevron up icon
10. Evaluating Model Performance Chevron down icon Chevron up icon
11. Improving Model Performance Chevron down icon Chevron up icon
12. Specialized Machine Learning Topics Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Leave a review - let other readers know what you think Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(46 Ratings)
5 star 67.4%
4 star 10.9%
3 star 6.5%
2 star 6.5%
1 star 8.7%
Filter icon Filter
Top Reviews

Filter reviews by




Andrew Horn Jan 14, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is an outstanding book and by far the best machine learning book of the several I have read. I highly recommend.1) The author writes this in a way that you can perform machine learning tasks in R without any prior experience using R or ML. He gets you up to speed quickly on how to download R Studio and explains everything you need to know about R in order to perform the ML tasks that are described later in the book. He doesn't explain all of the things you can do in R as in many other books, because you don't necessarily need to know everything about R to perform ML tasks and this book is about ML. So this is obviously not a book that is exhaustive of everything possible in R.2) The structure of this book is outstanding and very logical. Within each of the chapters on Machine Learning models, he describes the model and how it works, includes a section covering the model's syntax in R, the strengths and weaknesses of each model, compares the model to the prior models discussed, and then uses that foundation to walk you through an example of applying each model to real data. Within the examples, he uses the 5 steps of a modeling process: 1) collecting data, 2) exploring and prepping the data, 3) training the model, 4) evaluating model performance, and 5) Improving model performance. I love this structure!3) His explanations of everything are outstanding. I've read several ML books and he by far is the best at explaining things in a way that people can clearly understand. If the model involves statistical concepts, he explains what you need to know very well.4) The book covers many ML models: K-Nearest Neighbors, Naive Bayes, Decision Trees, Classification Rules, Regression, Regression Trees, Model Trees, Neural Networks, Support Vector Machines, Association Rules, K-Means Clustering, and Random Forests. For an advanced Data Scientist, this may not seem like an exhaustive list. However, I feel that for a beginning data scientist or someone that is just interested in getting a good overview of data modeling, I feel this is a great choice of model coverage.Bottom line- if you're at all interested in machine learning in R, this is the book to get. If you're already an advanced data scientist with years of experience, this may not be the best text for you, though.
Amazon Verified review Amazon
Andreas Dorta Jan 11, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Most other books I know on this topic are far too theoretical for me.Brett provides a very practical approach.
Amazon Verified review Amazon
Ariful Islam Mondal Apr 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book. I have come across one of the best books so far on Machine Learning using R. The author has made sure that the book is readable for both for a new users of R programming as well as who are new to machine learning with multiple case studies. This is also a great book for people who want to refresh their memories in key techniques of machine learning. I am an experience data science professional and I would recommend this book to readers looking to understand how to build machine learning models using R. Thanks to author for writing this book.
Amazon Verified review Amazon
floren25 Jun 28, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Puede resultar chocante, como poco, ver que alguien califica de «entretenido» un libro más bien técnico como éste, pero resulta que el calificativo es bastante apropiado. Lo es porque Brett lantz ha escrito una obra muy bien estructurada y pedagógicamente escrita sobre un tema que a muchos puede resultar intimidatorio, pero que él se las ingenia para volver atractivo.El libro es una introducción amable y facilitada a catorce algoritmos de «Machine Learning» (expresión que suele traducirse al castellano como «aprendizaje automático»), una muestra representativa, aunque desde luego no exhaustiva, de los métodos de Machine Learning en circulación. Los catorce algoritmos cubren desde k-nearest neighbors hasta Random Forests, pasando por Decision trees y Association rules. Los distintos algoritmos (de aprendizaje supervisado, no supervisado y de meta-aprendizaje) cubren cuatro tipos de tareas: clasificar, predecir, detectar patrones y agrupar.Aunque ya tenía noticia de ello, me parece digno de ser resaltado que los algoritmos más potentes, como Artificial Neural Networks o Support Vector Machines, son lo que Lantz llama «algoritmos de caja negra»: sabemos que funcionan bien pero no sabemos por qué funcionan bien.Uno de los problemas frecuentes con este tipo de libros es que hay complementos que tienes que bajar de Internet y que no siempre se comportan como deberían. En este caso, ¡loado sea el cielo!, no es así: las bases de datos y el código escrito en el lenguaje R funcionan sin problemas. Sólo en los tres últimos capítulos me he llevado algún tropezón. Especialmente en el último, que es con diferencia el de contenido más avanzado: computación en la nube, big data y demás.Pero, a pesar de lo que acabo de decir, se aprende mucho con este texto, dado el esmero que pone el autor en explicar todos los detalles (como las líneas de código que pudieran resultar más intrigantes) y en no dejar a nadie atrás.En suma, una excelente iniciación a Machine Learning usando el software R, el más empleado por los estadísticos, aunque no el más común en aprendizaje automático.
Amazon Verified review Amazon
Ashish Tambadkar May 13, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I am a complete beginner to R as well as Machine learning, this book has clearly stated every concept and made me understand machine learning even better. I highly recommend this 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.