#NEWLINE# def choose_experiment( self , name ) : #NEWLINE# #INDENT# '\n        Opts a user into one of many choices for an experiment. They have a\n        90 percent chance of being opted into the default choice (the one with\n        the greatest results.) Otherwise they join a random choice (including\n        potentially the default choice anyway.)\n        ' #NEWLINE# experiment = oz . bandit . Experiment ( self . redis ( ) , name ) #NEWLINE# choice = self . get_experiment_choice ( name ) #NEWLINE# if ( not ( choice in experiment . choice_names ) ) : #NEWLINE# #INDENT# choice = None #NEWLINE# #UNINDENT# if ( not choice ) : #NEWLINE# #INDENT# if ( random . random ( ) >= 0.1 ) : #NEWLINE# #INDENT# default_choice = experiment . default_choice #NEWLINE# if default_choice : #NEWLINE# #INDENT# choice = default_choice #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not choice ) and ( len ( experiment . choice_names ) > 0 ) ) : #NEWLINE# #INDENT# choice = random . choice ( experiment . choice_names ) #NEWLINE# #UNINDENT# if choice : #NEWLINE# #INDENT# self . join_experiment ( name , choice ) #NEWLINE# #UNINDENT# #UNINDENT# if choice : #NEWLINE# #INDENT# experiment . add_play ( choice ) #NEWLINE# #UNINDENT# return choice