Book Image

Test Driven Machine Learning

Book Image

Test Driven Machine Learning

Overview of this book

Table of Contents (16 chapters)
Test-Driven Machine Learning
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Perceptively Testing a Perceptron
Index

Simulating real world situations


What I'd like to do now is take a detour to see what the performance of this algorithm looks like over time. We won't be test driving the simulation harness that I will use here. We will instead use this as an opportunity to visually identify the performance characteristics of two separate multi-armed bandit algorithms. Let's start introducing the different concepts from the code. The following code sets up our experimental world to be simulated. I'll instantiate BanditScenario and set up treatments A-C to have certain parameters that will provide guidance on how well each does in our experiment:

simulated_experiment = BanditScenario({
  'A': {
    'conversion_rate': .05,
    'order_average': 35.00
  },
  'B':{
    'conversion_rate': .06,
    'order_average': 36.00
  }
})

The code should be read as The probability of treatment A causing a visitor to convert is 5 percent. If they order, the average order amount will be for $35.00, and so on. The BanditScenario...