Search icon
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

Planning our journey


TDD is a way to incrementally design our code, but this doesn't mean that we can stop thinking about it. Getting some idea of how we want to approach the problem can actually be quite useful, as long as we're prepared to leave behind our preconceptions if it doesn't prove to be a testable design.

Let's take a moment to review the Naïve Bayes and Random Forest classifiers. What are the methods/functions that they have in common? It looks like batch_train and classify have the same signature, and both appear on both classes. Python doesn't have the concept of interfaces similar to what Java or C# have, but if it did have, we might have an interface that would look like the following:

class Classifier:
  def batch_train(self, observations):
    pass
  def classify(self, observation):
    pass

In programming languages such as C# and Java, interfaces are useful for defining the methods that one expects a class to have, but this happens without specifying any implementation details...

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 €14.99/month. Cancel anytime}