Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Test Driven Machine Learning

You're reading from  Test Driven Machine Learning

Product type Book
Published in Nov 2015
Publisher
ISBN-13 9781784399085
Pages 190 pages
Edition 1st Edition
Languages

Table of Contents (16) Chapters

Test-Driven Machine Learning
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introducing Test-Driven Machine Learning 2. Perceptively Testing a Perceptron 3. Exploring the Unknown with Multi-armed Bandits 4. Predicting Values with Regression 5. Making Decisions Black and White with Logistic Regression 6. You're So Naïve, Bayes 7. Optimizing by Choosing a New Algorithm 8. Exploring scikit-learn Test First 9. Bringing It All Together Index

Applying our classifier


Now we put the pedal to the metal. Can we classify gender by height, weight, and BMI? We will get our data from the Kaggle competition at https://www.kaggle.com/c/pf2012-diabetes/data.

We'll be using the SyncPatient and SyncTranscript data. You can look up the details regarding these datasets in the associated data dictionary. The examples that follow are placed in the data files, in a directory named data. The files have also been renamed from SyncPatient.csv and SyncTranscript.csv to training_SyncPatient.csv and training_SyncTranscript.csv respectively.

Our first step will be to create a harness that will let us explore our data to make sure that it seems reasonable. Before we do this, we should create a new method on our Naïve Bayes class that can show us what the internal data looks like. This is the code that should be added to your Naïve Bayes class:

def _calculate_model_parameters(self):
  class_metrics = {}
  for class_label, data in self._classifications.items...
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 $15.99/month. Cancel anytime}