<s> '''<STR_LIT>''' <EOL> from hyperopt import fmin , tpe , hp <EOL> import gupta_paper_further_formulas as snnrl <EOL> import sys <EOL> import cProfile <EOL> def do_cprofile ( func ) : <EOL> def profiled_func ( * args , ** kwargs ) : <EOL> profile = cProfile . Profile ( ) <EOL> try : <EOL> profile . enable ( ) <EOL> result = func ( * args , ** kwargs ) <EOL> profile . disable ( ) <EOL> return result <EOL> finally : <EOL> profile . print_stats ( ) <EOL> return profiled_func <EOL> def snnrlWithParams ( * args , ** kwargs ) : <EOL> sys . argv = [ '<STR_LIT>' , args , kwargs ] <EOL> '''<STR_LIT>''' <EOL> return snnrl . gupta_paper ( ) <EOL> @ do_cprofile <EOL> def objective ( args ) : <EOL> minRand , maxRand , posReinfVal , negReinfVal = args <EOL> randVal = str ( minRand ) + '<STR_LIT:->' + str ( maxRand ) <EOL> trainModel = snnrlWithParams ( evaluateClassifier = False , randomization = randVal , posReinf = posReinfVal , negReinf = negReinfVal ) <EOL> trainModel . run_model ( ) <EOL> del trainModel <EOL> testModel = snnrlWithParams ( evaluateClassifier = True , posReinf = posReinfVal , negReinf = negReinfVal ) <EOL> origAccPerc = testModel . run_model ( ) <EOL> accuracyPerc = <NUM_LIT:1> - ( origAccPerc ) <EOL> print "<STR_LIT>" , accuracyPerc <EOL> del testModel <EOL> return { '<STR_LIT>' : accuracyPerc } <EOL> space = [ hp . uniform ( '<STR_LIT>' , <NUM_LIT> , <NUM_LIT> ) , hp . uniform ( '<STR_LIT>' , <NUM_LIT> , <NUM_LIT> ) , hp . uniform ( '<STR_LIT>' , <NUM_LIT:1.0> , <NUM_LIT> ) , hp . uniform ( '<STR_LIT>' , <NUM_LIT:1.0> , <NUM_LIT> ) ] <EOL> best = fmin ( objective , <EOL> space , <EOL> algo = tpe . suggest , <EOL> max_evals = <NUM_LIT:3> ) <EOL> print best </s>
