Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Machine Learning By Example

You're reading from   Python Machine Learning By Example Implement machine learning algorithms and techniques to build intelligent systems

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781789616729
Length 382 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Yuxi (Hayden) Liu Yuxi (Hayden) Liu
Author Profile Icon Yuxi (Hayden) Liu
Yuxi (Hayden) Liu
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Section 1: Fundamentals of Machine Learning FREE CHAPTER
2. Getting Started with Machine Learning and Python 3. Section 2: Practical Python Machine Learning By Example
4. Exploring the 20 Newsgroups Dataset with Text Analysis Techniques 5. Mining the 20 Newsgroups Dataset with Clustering and Topic Modeling Algorithms 6. Detecting Spam Email with Naive Bayes 7. Classifying Newsgroup Topics with Support Vector Machines 8. Predicting Online Ad Click-Through with Tree-Based Algorithms 9. Predicting Online Ad Click-Through with Logistic Regression 10. Scaling Up Prediction to Terabyte Click Logs 11. Stock Price Prediction with Regression Algorithms 12. Section 3: Python Machine Learning Best Practices
13. Machine Learning Best Practices 14. Other Books You May Enjoy

Model tuning and cross-validation

Having learned what metrics to use to measure a classification model, we'll now study how to measure it properly. We simply can avoid adopting the classification results from one fixed testing set, which we did in experiments previously. Instead, we usually apply the k-fold cross-validation technique to assess how a model will generally perform in practice.

In the k-fold cross-validation setting, the original data is first randomly divided into the k equal-sized subsets, in which class proportion is often preserved. Each of these k subsets is then successively retained as the testing set for evaluating the model. During each trial, the rest k -1 subsets (excluding the one-fold holdout) form the training set for driving the model. Finally, the average performance across all k trials is calculated to generate an overall result:

Statistically...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime