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

A randomized probability matching algorithm


The randomized probability matching bandit algorithm is a Bayesian statistical approach to the problem of figuring out when to explore our options and when to exploit them for a nice payoff. It works by sampling a probability distribution that describes the probable mean of the payoff. As we gain more data, the variance of the possible means narrows significantly. As we go through the rest of this chapter, we'll delve deeper into how this algorithm works.

As a concrete example, we can run some simulations. The following is a histogram of repeatedly sampling means with 100 samples from a normal distribution:

plt.title('Distribution of means for N(35,5) distribution (sampling 100 vs 500 data points)')
plt.xlabel('')
plt.ylabel('Counts')

plt.hist([np.random.normal(loc=35, scale=5, size=100).mean() for i in range(2500)], label='100 sample mean')
plt.hist([np.random.normal(loc=35, scale=5, size=500).mean() for i in range(2500)], label='500 sample mean...
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}