1341 bandit algorithms for website optimization

87 86 0
  • Loading ...
    Loading ...
    Loading ...

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Tài liệu liên quan

Thông tin tài liệu

Ngày đăng: 06/03/2019, 16:39

www.it-ebooks.info www.it-ebooks.info Bandit Algorithms for Website Optimization John Myles White www.it-ebooks.info Bandit Algorithms for Website Optimization by John Myles White Copyright © 2013 John Myles White All rights reserved Printed in the United States of America Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://my.safaribooksonline.com) For more information, contact our corporate/ institutional sales department: 800-998-9938 or corporate@oreilly.com Editors: Mike Loukides and Meghan Blanchette Production Editor: Christopher Hearse December 2012: Proofreader: Christopher Hearse Cover Designer: Randy Comer Interior Designer: David Futato Illustrator: Rebecca Demarest First Edition Revision History for the First Edition: 2012-12-07 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449341336 for release details Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc Bandit Algorithms for Website Optimization, the image of an eastern barred bandicoot, and related trade dress are trademarks of O’Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 978-1-449-34133-6 LSI www.it-ebooks.info Table of Contents Preface v Two Characters: Exploration and Exploitation The Scientist and the Businessman Cynthia the Scientist Bob the Businessman Oscar the Operations Researcher The Explore-Exploit Dilemma 1 Why Use Multiarmed Bandit Algorithms? What Are We Trying to Do? The Business Scientist: Web-Scale A/B Testing The epsilon-Greedy Algorithm 11 Introducing the epsilon-Greedy Algorithm Describing Our Logo-Choosing Problem Abstractly What’s an Arm? What’s a Reward? What’s a Bandit Problem? Implementing the epsilon-Greedy Algorithm Thinking Critically about the epsilon-Greedy Algorithm 11 13 13 14 14 15 19 Debugging Bandit Algorithms 21 Monte Carlo Simulations Are Like Unit Tests for Bandit Algorithms Simulating the Arms of a Bandit Problem Analyzing Results from a Monte Carlo Study Approach 1: Track the Probability of Choosing the Best Arm Approach 2: Track the Average Reward at Each Point in Time Approach 3: Track the Cumulative Reward at Each Point in Time 21 22 26 26 28 29 iii www.it-ebooks.info Exercises 31 The Softmax Algorithm 33 Introducing the Softmax Algorithm Implementing the Softmax Algorithm Measuring the Performance of the Softmax Algorithm The Annealing Softmax Algorithm Exercises 33 35 37 40 46 UCB – The Upper Confidence Bound Algorithm 47 Introducing the UCB Algorithm Implementing UCB Comparing Bandit Algorithms Side-by-Side Exercises 47 49 53 56 Bandits in the Real World: Complexity and Complications 59 A/A Testing Running Concurrent Experiments Continuous Experimentation vs Periodic Testing Bad Metrics of Success Scaling Problems with Good Metrics of Success Intelligent Initialization of Values Running Better Simulations Moving Worlds Correlated Bandits Contextual Bandits Implementing Bandit Algorithms at Scale 60 60 61 62 62 63 63 63 64 65 65 Conclusion 69 Learning Life Lessons from Bandit Algorithms A Taxonomy of Bandit Algorithms Learning More and Other Topics iv | Table of Contents www.it-ebooks.info 69 71 72 Preface Finding the Code for This Book This book is about algorithms But it’s not a book about the theory of algorithms It’s a short tutorial introduction to algorithms that’s targetted at people who like to learn about new ideas by experimenting with them in practice Because we want you to experiment, this book is meant to be read while you’re near an interpreter for your favorite programming language In the text, we illustrate every al‐ gorithm we describe using Python As part of the accompanying online materials, there is similar code available that implements all of the same algorithms in Julia, a new programming language that is ideally suited for implementing bandit algorithms Alongside the Python and Julia code, there are also links to similar implementations in other languages like JavaScript We’ve chosen to use Python for this book because it seems like a reasonable lingua franca for programmers If Python isn’t your style, you should be able to translate our Python code into your favorite programming language fairly easily Assuming you are happy using Python or Julia, you can find the code for the book on GitHub at https://github.com/johnmyleswhite/BanditsBook If you find mistakes or would like to submit an implementation in another language, please make a pull request Dealing with Jargon: A Glossary While this book isn’t meant to introduce you to the theoretical study of the Multiarmed Bandit Problem or to prepare you to develop novel algorithms for solving the problem, we want you to leave this book with enough understanding of existing work to be able to follow the literature on the Multiarmed Bandit Problem In order to that, we have to introduce quite a large number of jargon words These jargon words can be a little v www.it-ebooks.info odd at a first, but they’re universally used in the academic literature on Multiarmed Bandit Problems As you read this book, you will want to return to the list of jargon words below to remind yourself what they mean For now, you can glance through them, but we don’t expect you to understand these words yet Just know that this material is here for you to refer back to if you’re ever confused about a term we use Reward A quantitative measure of success In business, the ultimate rewards are profits, but we can often treat simpler metrics like click-through rates for ads or sign-up rates for new users as rewards What matters is that (A) there is a clear quantitative scale and (B) it’s better to have more reward than less reward Arm What options are available to us? What actions can we take? In this book, we’ll refer to the options available to us as arms The reasons for this naming convention will be easier to understand after we’ve discuss a little bit of the history of the Multiarmed Bandit Problem Bandit A bandit is a collection of arms When you have many options available to you, we call that collection of options a Multiarmed Bandit A Multiarmed Bandit is a mathematical model you can use to reason about how to make decisions when you have many actions you can take and imperfect information about the rewards you would receive after taking those actions The algorithms presented in this book are ways of trying to solve the problem of deciding which arms to pull when We refer to the problem of choosing arms to pull as the Multiarmed Bandit Problem Play/Trial When you deal with a bandit, it’s assumed that you get to pull on each arm multiple times Each chance you have to pull on an arm will be called a play or, more often, a trial The term “play” helps to invoke the notion of gambling that inspires the term “arm”, but the term trial is quite commonly used Horizon How many trials will you have before the game is finished? The number of trials left is called the horizon If the horizon is short, you will often use a different strategy than you would use if the horizon were long, because having many chances to play each arm means that you can take greater risks while still having time to recover if anything goes wrong Exploitation An algorithm for solving the Multiarmed Bandit Problem exploits if it plays the arm with the highest estimated value based on previous plays vi | Preface www.it-ebooks.info Exploration An algorithm for solving the Multiarmed Bandit Problem explores if it plays any arm that does not have the highest estimated value based on previous plays In other words, exploration occurs whenever exploitation does not Explore/Exploit Dilemma The observation that any learning system must strike a compromise between its impulse to explore and its impulse to exploit The dilemma has no exact solution, but the algorithms described in this book provide useful strategies for resolving the conflicting goals of exploration and exploitation Annealing An algorithm for solving the Multiarmed Bandit Problem anneals if it explores less over time Temperature A parameter that can be adjusted to increase the amount of exploration in the Softmax algorithm for solving the Multiarmed Bandit Problem If you decrease the temperature parameter over time, this causes the algorithm to anneal Streaming Algorithms An algorithm is a streaming algorithm if it can process data one piece at a time This is the opposite of batch processing algorithms that need access to all of the data in order to anything with it Online Learning An algorithm is an online learning algorithm if it can not only process data one piece at a time, but can also provide provisional results of its analysis after each piece of data is seen Active Learning An algorithm is an active learning algorithm if it can decide which pieces of data it wants to see next in order to learn most effectively Most traditional machine learn‐ ing algorithm are not active: they passively accept the data we feed them and not tell us what data we should collect next Bernoulli A Bernoulli system outputs a with probability p and a with probability – p Conventions Used in This Book The following typographical conventions are used in this book: Italic Indicates new terms, URLs, email addresses, filenames, and file extensions Preface www.it-ebooks.info | vii Constant width Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords Constant width bold Shows commands or other text that should be typed literally by the user Constant width italic Shows text that should be replaced with user-supplied values or by values deter‐ mined by context This icon signifies a tip, suggestion, or general note This icon indicates a warning or caution Using Code Examples This book is here to help you get your job done In general, if this book includes code examples, you may use the code in this book in your programs and documentation You not need to contact us for permission unless you’re reproducing a significant portion of the code For example, writing a program that uses several chunks of code from this book does not require permission Selling or distributing a CD-ROM of examples from O'™Reilly books does require permission Answering a question by citing this book and quoting example code does not require permission Incorporating a significant amount of example code from this book into your product'™s documentation does require per‐ mission We appreciate, but not require, attribution An attribution usually includes the title, author, publisher, and ISBN For example: "Bandit Algorithms for Website Optimiza‐ tion by John Myles White Copyright 2013 John Myles White, 978-1-449-34133-6.” If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at permissions@oreilly.com viii | Preface www.it-ebooks.info ously These experiments will end up overlapping: a site may use A/B testing to compare two different logo colors while also using A/B testing to compare two different fonts Even the existence of one extra test that’s not relating to the arms you’re comparing can add a lot of uncertainty into your results Things may still work out well But your experiments may also turn out very badly if the concurrent changes you’re making to your site don’t play well together and have strange interactions In an ideal world, concurrency issues raised by running multiple experiments at once won’t come up You’ll be aware that you have lots of different questions and so you would plan all of your tests in one giant group Then you would define your arms in terms of the combinations of all the factors you want to test: if you were testing both colors and fonts, you’d have one arm for every color/font pair This ideal world fails not only because people get sparks of inspiration that make them change course over time It also fails because the number of arms you would need to test can quickly blow up if you start combining the different factors you want to test into separate pairs Of course, if you don’t keep track of other tests, you may end up with a large number of puzzling results that are all artifacts of running so many experiments simultaneously The best solution to this is simple: try your best to keep track of all of the experiments each user is a part of and include this information in your analyses of any single experiment Continuous Experimentation vs Periodic Testing Are you planning to run tests for a while to decide which approaches are best? Are you then going to stop running new experiments after you’ve made that decision? In that case, A/B testing may often be wise if you have a similar set of proposed changes that would become arms in your Multiarmed Bandit setup If you’re doing short-term ex‐ periments, it’s often not so important to avoid testing inferior strategies because the consequences aren’t so bad But if you’re willing to let your experiments run much longer, turning things over to a bandit algorithm can be a huge gain because the algorithm will automatically start to filter out inferior designs over time without requiring you to make a judgment call Whether this is a good thing or not really depends on the details of your situation But the general point stands: bandit algorithms look much better than A/B testing when you are willing to let them run for a very long time If you’re willing to have your site perpet‐ ually be in a state of experimentation, bandit algorithms will be many times better than A/B testing A related issue to the contrast between continuous experimentation versus short periods of experimentation is the question of how many users should be in your experiments You’ll get the most data if you put more users into your test group, but you risk alienating more of them if you test something that’s really unpopular The answers to this question Continuous Experimentation vs Periodic Testing www.it-ebooks.info | 61 don’t depend on whether you’re using bandit algorithm or A/B testing, but the answers will affect how well a bandit algorithm can work in your setting If you run a bandit algorithm on a very small number of users, you may end up with too little data about the arms that the algorithm decided were inferior to make very strong conclusions about them in the future A/B testing’s preference for balancing people across arms can be advantageous if you aren’t going to gather a lot of data Bad Metrics of Success The core premise of using a bandit algorithm is that you have a well-defined measure of reward that you want to maximize A real business is much more complicated than this simple setup might suggest One potentially fatal source of increased complexity is that optimizing short-term click-through rates may destroy the long-term retainability of your users Greg Linden, one of the earlier developers of A/B testing tools at Amazon, says that this kind of thing actually happened to Amazon in the 1990’s when they first started doing automatic A/B testing The tools that were ostensibly optimizing their chosen metric were actually harming Amazon’s long-term business Amazon was able to resolve the situation, but the problem of optimizing the wrong metric of success is so ubiquitous that it’s likely other businesses have lost a great deal more than Amazon did because of poorly chosen metrics Unfortunately, there’s no algorithmic solution to this problem Once you decide to start working with automated metrics, you need to supplement those systems by exercising human judgment and making sure that you keep an eye on what happens as the system makes changes to your site Monitoring many different metrics you think are important to your business is probably the best thing you can hope For example, creating an aggregate site well-being score that simply averages together a lot of different metrics you want to optimize may often be a better measure of success than any single metric you would try in isolation Scaling Problems with Good Metrics of Success Even if you have a good metric of success, like the total amount of purchases made by a client over a period of a year, the algorithms described in this book may not work well unless you rescale those metrics into the 0-1 space we’ve used in our examples The reasons for this are quite boring: some of the algorithms are numerically unstable, es‐ pecially the softmax algorithm, which will break down if you start trying to calculate things like exp(10000.0) You need to make sure that you’ve scaled the rewards in your problem into a range in which the algorithms will be numerically stable If you can, try to use the 0-1 scale we’ve used, which is, as we briefly noted earlier, an absolute require‐ ment if you plan on using the UCB1 algorithm 62 | Chapter 7: Bandits in the Real World: Complexity and Complications www.it-ebooks.info Intelligent Initialization of Values In the section on the epsilon-Greedy algorithm, we mentioned how important it is to consider how you initialize the values of arms you’ve never explored In the real world, you can often this using information you have before ever deploying a bandit algo‐ rithm This smart initialization can happen in two ways First, you can use the historical metrics for the control arm in your bandit algorithm Whatever arm corresponds to how your site traditionally behaved can be given an initial value based on data from before you let the bandit algorithm loose In addition, you can initialize all of the unfamiliar arms using this same approach Second, you can use the amount of historical data you have to calibrate how much the algorithm thinks you know about the historical options For an algorithm like UCB1, that will strongly encourage the algorithm to explore new options until the algorithm has some confidence about their worth relative to tradition This can be a very good thing, although it needs to be done with caution Running Better Simulations In addition to initializing your algorithm using prior information you have before de‐ ploying a Bandit algorithm, you can often run much better simulations if you use his‐ torical information to build appropriate simulations In this book we’ve used a toy Monte Carlo simulation with click-through rates that varied from 0.1 to 0.9 Real world clickthrough rates are typically much lower than this Because low success rates may mean that your algorithm must run for a very long time before it is able to reach any strong conclusions, you should conduct simulations that are informed by real data about your business if you have access to it Moving Worlds In the real world, the value of different arms in a bandit problem can easily change over time As we said in the introduction, an orange and black site design might be perfect during Halloween, but terrible during Christmas Because the true value of an arm might actually shift over time, you want your estimates to be able to this as well Arms with changing values can be a very serious problem if you’re not careful when you deploy a bandit algorithm The algorithms we’ve presented will not handle most sorts of change in the underlying values of arms well The problem has to with the way that we estimate the value of an arm We typically updated our estimates using the following snippet of code: new_value = ((n - 1) / float(n)) * value + (1 / float(n)) * reward self.values[chosen_arm] = new_value Intelligent Initialization of Values www.it-ebooks.info | 63 The problem with this update rule is that / float(n) goes to as n gets large When you’re dealing with millions or billions of plays, this means that recent rewards will have almost zero effect on your estimates of the value of different arms If those values shifted only a small amount, the algorithm will take a huge number of plays to update its esti‐ mated values There is a simple trick for working around this that can be used if you’re careful: instead of estimating the values of the arms using strict averages, you can overweight recent events by using a slightly different update rule based on a different snippet of code: new_value = (1 - alpha) * value + (alpha) * reward self.values[chosen_arm] = new_value In the traditional rule, alpha changed from trial to trial In this alternative, alpha is a fixed value between 0.0 and 1.0 This alternative updating rule will allow your estimates to shift much more with recent experiences When the world can change radically, that flexibility is very important Unfortunately, the price you pay for that flexibility is the introduction of a new parameter that you’ll have to tune to your specific business We encourage you to experiment with this modified updating rule using simulations to develop an intuition for how it behaves in environments like yours If used appropriately in a changing world, setting alpha to a constant value can make a big difference relative to allowing alpha to go to too quickly But, if used carelessly, this same change will make your algorithm behave er‐ ratically If you set alpha = 1.0, you can expect to unleash a nightmare for yourself Correlated Bandits In many situations, you want to solve a Multiarmed Bandit Problem with a large number of arms This will be hopeless unless there is some way you can generalize your expe‐ riences with some arms to other arms When you can make generalizations safely, we say that the arms are correlated To be extremely precise, what matters is that the ex‐ pected rewards of different arms are correlated To illustrate this idea, let’s go back to our earlier idea about experimenting with different color logos It’s reasonable to assume that similar colors are likely to elicit similar reac‐ tions So you might try to propagate information about rewards from one color to other colors based on their degree of similarity If you’re working with thousands of colors, simple algorithms like UCB1 may not be appropriate because they can’t exploit the correlations across colors You’ll need to find ways to relate arms and update your estimates based on this information In this short book we don’t have time to get into issues much, but we encourage you to look into classical smoothing techniques in statistics to get a sense for how you might deal with correlated arms 64 | Chapter 7: Bandits in the Real World: Complexity and Complications www.it-ebooks.info Contextual Bandits In addition to correlations between arms in a bandit task, it’s often the case that we have background information about the context in which we’re trying out different options For example, we may find that certain fonts are more appealing to male users than to female users We refer to this side information as context There are a variety of algo‐ rithms like LinUCB and GLMUCB for working with contextual information: you can read about them in two academic papers called “A Contextual-Bandit Approach to Per‐ sonalized News Article Recommendation” and “Parametric Bandits: The Generalized Linear Case” Both of these algorithms are more complicated than the algorithms we’ve covered in this book, but the spirit of these models is easy to describe: you want to develop a predictive model of the value of arms that depends upon context You can use any of the techniques available in conventional machine learning for doing this If those tech‐ niques allow you to update your model using online learning, you can build a contextual bandit algorithm out of them LinUCB does this by updating a linear regression model for the arms’ values after each play GLMUCB does this by updating a General Linear Model for the arms’ values after each play Many other algorithms exist and you could create your own with some re‐ search into online versions of your favorite machine learning algorithm Implementing Bandit Algorithms at Scale Many of the topics we’ve discussed make bandit algorithms more complex in order to cope with the complexity of the real world But that complexity may make deploying a bandit algorithm prohibitively difficult at scale Why is that? Even in the simplest real-world settings, the bandit algorithms we’ve described in this book may not work as well as they in simulations because you often may not know what happened on your N-th play in the real world until a while after you’ve been forced to serve a new page for (and therefore select a new arm for) many other users This destroys the clean sequential structure we’ve assumed throughout the book If you’re a website that serves hundreds of thousands of hits in a second, this can be a very sub‐ stantial break from the scenarios we’ve been envisoning This is only one example of how the algorithms we’ve described are non-trivial when you want to get them to scale up, but we’ll focus on it for the sake of brevity Our proposed solution seems to be the solution chosen by Google for Google Analytics based on information in their help documents, although we don’t know the details of how their system is configured Contextual Bandits www.it-ebooks.info | 65 In short, our approach to dealing with imperfect sequential assignments is to embrace this failure and develop a system that is easier to scale up We propose doing this in two parts: Blocked assignments Assign incoming users to new arms in advance and draw this information from a fast cache when users actually arrive Store their responses for batch processing later in another fast cache Blocked updates Update your estimates of arm values in batches on a regular interval and regenerate your blocked assignments Because you work in batches, it will be easier to perform the kind of complex calculations you’ll need to deal with correlated arms or con‐ textual information Changes like this can go a long way in making bandit algorithms scale up for large websites But, once you start to make changes to bandit algorithms to deal with these sorts of scale problems, you’ll find that the theoretical literature on bandits often be‐ comes less informative about what you can expect will happen There are a few papers that have recently come out: if you’re interested, this problem is referred to as the problem of delayed feedback in the academic literature Thankfully, even though the academic literature is a little sparser on the topic of delayed feedback, you can still run Monte Carlo simulations to test your approach before de‐ ploying a bandit system that has to cope with delayed feedback Of course, you’ll have to make simulations that are more complex than those we’ve described already, but those more complex simulations are still possible to design And they may convince you that your proposed algorithms works even though you’re working in uncharted waters be‐ yond what theoreticians have studied That’s the reason we’ve focused on using simu‐ lations through the book We want you to feel comfortable exploring this topic for yourself, even when doing so will take you into areas that science hasn’t fully reached yet While you’re exploring, you’ll come up with lots of other interesting questions about scaling up bandit algorithms like: • What sort of database should you store information in? Is something like MySQL usable or you need to work with something like Memcached? If you need to pull out assignments to arms quickly, it’s probably wise to move this information into the lowest latency data storage tool you have available to you 66 | Chapter 7: Bandits in the Real World: Complexity and Complications www.it-ebooks.info • Where in your production code should you be running the equivalent of our se lect_arm and update functions? In the blocked assignments model we described earlier, this happens far removed from the tools that directly generate served pages But in the obvious strategy for deploying bandit algorithms, this happens in the page generation mechanism itself We hope you enjoy the challenges that making bandit algorithms work in large pro‐ duction environments can pose We think this is one of the most interesting questions in engineering today Implementing Bandit Algorithms at Scale www.it-ebooks.info | 67 www.it-ebooks.info CHAPTER Conclusion Learning Life Lessons from Bandit Algorithms In this book, we’ve presented three algorithms for solving the Multiarmed Bandit Problem: • The epsilon-Greedy Algorithm • The Softmax Algorithm • The UCB Algorithm In order to really take advantage of these three algorithms, you’ll need to develop a good intuition for how they’ll behave when you deploy them on a live website Having an intuition about which algorithms will work in practice is important because there is no universal bandit algorithm that will always the best job of optimizing a website: domain expertise and good judgment will always be necessary To help you develop the intuition and judgment you’ll need, we’ve advocated a Monte Carlo simulation framework that lets you see how these algorithms and others will behave in hypothetical worlds By testing an algorithm in many different hypothetical worlds, you can build an appreciation for the qualitative dynamics that cause a bandit algorithm to succeed in one scenario and to fail in another In this last section, we’d like to help you further down that path by highlighting these qualitative patterns explicitly We’ll start off with some general life lessons that we think are exemplified by bandit algorithms, but actually apply to any situation you might ever find yourself in Here are the most salient lessons: 69 www.it-ebooks.info Trade-offs, trade-offs, trade-offs In the real world, you always have to trade off between gathering data and acting on that data Pure experimentation in the form of exploration is always a shortterm loss, but pure profit-making in the form of exploitation is always blind to the long-term benefits of curiosity and openmindedness You can be clever about the compromises you make, but you will have to make some compromises God does play dice Randomization is the key to the good life Controlled experiments online won’t work without randomization If you want to learn from your experiences, you need to be in complete control of those experiences While the UCB algorithms we’ve used in this book aren’t truly randomized, they behave at least partially like random‐ ized algorithms from the perspective of your users Ultimately what matters most is that you make sure that end-users can’t self-select into the arms you want to experiment with Defaults matter a lot The way in which you initialize an algorithm can have a powerful effect on its longterm success You need to figure out whether your biases are helping you or hurting you No matter what you do, you will be biased in some way or another What matters is that you spend some time learning whether your biases help or hurt Part of the genius of the UCB family of algorithms is that they make a point to this initialization in a very systematic way right at the start Take a chance You should try everything at the start of your explorations to insure that you know a little bit about the potential value of every option Don’t close your mind without giving something a fair shot At the same time, just one experience should be enough to convince you that some mistakes aren’t worth repeating Everybody’s gotta grow up sometime You should make sure that you explore less over time No matter what you’re doing, it’s important that you don’t spend your whole life trying out every crazy idea that comes into your head In the bandit algorithms we’ve tried, we’ve seen this lesson play out when we’ve implemented annealing The UCB algorithms achieve similar effects to annealing by explicitly counting their experiences with different arms Either strategy is better than not taking any steps to become more conservative over time Leave your mistakes behind You should direct your exploration to focus on the second-best option, the thirdbest option and a few other options that are just a little bit further away from the best Don’t waste much or any of your time on options that are clearly losing bets Naive experimentation of the sort that occurs in A/B testing is often a deadweight loss if some of the ideas you’re experimenting with are disasters waiting to happen 70 | Chapter 8: Conclusion www.it-ebooks.info Don’t be cocky You should keep track of how confident you are about your evaluations of each of the options available to you Don’t be close-minded when you don’t have evidence to support your beliefs At the same time, don’t be so unsure of yourself that you forget how much you already know Measuring one’s confidence explicitly is what makes UCB so much more effective than either the epsilon-Greedy algorithm or the Softmax algorithm in some settings Context matters You should use any and every piece of information you have available to you about the context of your experiments Don’t simplify the world too much and pretend you’ve got things figured out: there’s more to optimizing your business that com‐ paring A with B If you can figure out a way to exploit context using strategies like those seen in the contextual bandit algorithms we briefly discussed, use them And if there are ways to generalize your experiences across arms, take advantage of them A Taxonomy of Bandit Algorithms To help your remember how these lessons relate to the algorithms we’ve described, here are six dimensions along which you can measure most bandit algorithms you’ll come across, including all of the algorithms presented in this book: Curiosity: Does the algorithm keep track of how much it knows about each arm? Does the algorithm try to gain knowledge explicitly, rather than incidentally? In other words, is the algorithm curious? Increased Exploitation over Time: Does the algorithm explicitly try to explore less over time? In other words, does the algorithm use annealing? Strategic Exploration: What factors determine the algorithm’s decision at each time point? Does it maximize reward, knowledge, or a combination of the two? Number of Tunable Parameters: How many parameters does the algorithm have? Since you have to tune these parameters, it’s generally better to use algorithms that have fewer parameters Initialization Strategy: What assumptions does the algorithm make about the value of arms it has not yet explored? Context-Aware: Is the algorithm able to use background context about the value of the arms? A Taxonomy of Bandit Algorithms www.it-ebooks.info | 71 Learning More and Other Topics Hopefully this book has gotten you interested in bandit algorithms While you could easily spend the rest your life tinkering with the simulation framework we’ve given you to find the best possible settings of different parameters for the algorithms we’ve de‐ scribed, it’s probably better for you to read about how other people are using bandit algorithms Here’s a very partial reading list we’d suggest for those interested: • If you’re interested in digging into the academic literature on the Multiarmed Bandit Problem, the best introduction is probably in the classic textbook on Reinforcement Learning, which is a broader topic than the Multiarmed Bandit Problem: — Reinforcement Learning: An Introduction by Richard S Sutton and Andrew G Barto, (1998) • A good starting point for going beyond Sutton and Barto’s introduction is to read about some of the other bandit algorithms out there that we didn’t have time to discuss in this book As time goes on, we will implement more of those algorithms and place them on the website for this book In addition to exploring the supple‐ mental code that is already available on the website, you might be interested in going to the primary sources and reading about the following other algorithms for dealing with the Multiarmed Bandit Problem: — Exp3: You can read about Exp3 in “The Nonstochastic Multiarmed Bandit Prob‐ lem” by Auer et al., (2001) — Exp4: You can also read about Exp4 in “The Nonstochastic Multiarmed Bandit Problem” by Auer et al (2001) — The Knowledge Gradient: You can read about the Knowledge Gradient in “A knowledge-gradient policy for sequential information collection” by Frazier et al (2008) — Randomized Probability Matching: You can read about Randomized Probability Matching in “A modern Bayesian look at the multiarmed bandit” by Steven L Scott (2010) — Thompson Sampling: You can read about Thompson Sampling in “An Empirical Evaluation of Thompson Sampling” by Olivier Chapelle and Lihong Li (2011) • If you’re interested in contextual bandit algorithms like LinUCB and GLMUCB, you might look at: — LinUCB: “A Contextual-Bandit Approach to Personalized News Article Recom‐ mendation” by Li et al (2010) — GLMUCB: “Parametric Bandits: The Generalized Linear Case” by Filippi et al (2010) 72 | Chapter 8: Conclusion www.it-ebooks.info • If you’re ready to some much heavier reading on this subject, you might benefit from some of the best recent review papers discussing bandit algorithms: — “Sequential Decision Making in Non-stochastic Environments” by Jacob Aber‐ nethy (2012) — “Online Learning and Online Convex Optimization” by Shai Shalev-Shwartz (2012) • If you’re interested in reading about how Yahoo! used bandit algorithms in its busi‐ ness, John Langford and colleagues have written many interesting papers and pre‐ sentations including: — “Learning for Contextual Bandits” by Alina Beygelzimer and John Langford (2011) — “Contextual-Bandit Approach to Personalized News Article Recommendation” by Lihong Li et al (2010) Learning More and Other Topics www.it-ebooks.info | 73 www.it-ebooks.info About the Author John Myles White is a Ph.D student in the Princeton Psychology Department, where he studies behavioral decision theory Along with Drew Conway, he is the author of the book Machine Learning for Hackers (O’Reilly) John has worked on several popular R packages, including ProjectTemplate and log4r, and is currently working on building statistical packages for the new programming language Julia Colophon The animal on the cover of Bandit Algorithms for Website Optimization is the eastern barred bandicoot (Perameles gunnii) There are two subspecies, both of which inhabit southeastern Australia The subspecies that lives in Victoria is considered critically en‐ dangered despite restoration efforts by conservationists The other subspecies lives in Tasmania Barred banidcoots will typically make and live in ground nests made up of grass, leaves, and twigs The eastern barred bandicoot is a small marsupial that weighs around pounds This species of bandicoot is distinctive for its three to four bars on its hindquarters It is nocturnal, feeding at night on insects and plants With its claws and long snout, it will dig holes in the ground to find its food The typical life span of the eastern barred bandicoot is two to three years The cover image is from Wood’s Animate Creations The cover font is Adobe ITC Garamond The text font is Adobe Minion Pro; the heading font is Adobe Myriad Condensed; and the code font is Dalton Maag’s Ubuntu Mono www.it-ebooks.info ...www.it-ebooks.info Bandit Algorithms for Website Optimization John Myles White www.it-ebooks.info Bandit Algorithms for Website Optimization by John Myles White Copyright... Bandit Algorithms A Taxonomy of Bandit Algorithms Learning More and Other Topics iv | Table of Contents www.it-ebooks.info 69 71 72 Preface Finding the Code for This Book This book is about algorithms. .. success of that site For many web developers, the most famous type of website optimization is called Search Engine Optimization (or SEO for short), a process that involves modifying a website to increase
- Xem thêm -

Xem thêm: 1341 bandit algorithms for website optimization , 1341 bandit algorithms for website optimization , Chapter 1. Two Characters: Exploration and Exploitation, Chapter 2. Why Use Multiarmed Bandit Algorithms?, Chapter 6. UCB – The Upper Confidence Bound Algorithm, Chapter 7. Bandits in the Real World: Complexity and Complications

Mục lục

Xem thêm