Module ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias alias alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Str NameLoad NameLoad Num body If CompareIs NameLoad NameLoad body Assign NameStore TupleLoad Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Print Str Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Print Str Assign AttributeStore NameLoad attr Call NameLoad keyword NameLoad keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Print Str Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Print Str Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr AttributeStore NameLoad attr AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str Assign AttributeStore NameLoad attr Call NameLoad Call NameLoad AttributeLoad NameLoad attr BinOpMult Num Call NameLoad AttributeLoad NameLoad attr Num keyword NameLoad keyword NameLoad Print Str Assign AttributeStore NameLoad attr Call NameLoad Call NameLoad AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad ListLoad BinOpSub SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Num Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword Num keyword Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore ListLoad For NameStore AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad Call AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr Str Str attr Str Str attr Str Str attr Str Str If CompareIn NameLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr body If CompareIn Str NameLoad body Assign NameStore Str orelse Assign NameStore NameLoad Assign NameStore IfExp CompareIn Str NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index TupleLoad NameLoad NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad orelse Raise Call NameLoad BinOpAdd Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareEq NameLoad Num body Return Str orelse If CompareEq NameLoad Num body Return NameLoad orelse If CompareEq NameLoad Num body Return NameLoad orelse Return BinOpAdd Str Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareGtE NameLoad Num body Return Num orelse Return Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore BinOpSub Num Call NameLoad Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str NameLoad Assign NameStore BinOpSub Num Call NameLoad Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Print Str NameLoad Print BinOpMult Str Call NameLoad NameLoad Str Print BinOpMult Str Call NameLoad NameLoad Str decorator_list decorator_list
N/A pybrain.structure SigmoidLayer pybrain.tools.shortcuts buildNetwork pybrain.supervised.trainers BackpropTrainer pybrain.datasets ClassificationDataSet pybrain.utilities percentError utils get_matches get_team_stats extract_samples normalize split_samples team_year_key CrystalBall N/A object N/A N/A 
    A matches predictor.

    input_features: a list of the features I will feed to the classifier as
                    input data.
    output_feature: the feature giving the result the classifier must learn to
                    predict (I recommend allways using 'winner')
    exclude_ties: used to avoid including tied matches in the learning process.
                  I found this greatly improves the classifier accuracy. I know
                  there will be some ties, but I'm willing to fail on those and
                  have better accuracy with all the rest. At this point, this
                  code will break if you set it to False, because the network
                  uses a sigmoid function with a threeshold for output, so it
                  is able to distinguish only 2 kinds of results.
    duplicate_with_reversed: used to duplicate matches data, reversing the
                             teams (team1->team2, and viceversa). This helps on
                             visualizations, and also improves precission of
                             the predictions avoiding a dependence on the order
                             of the teams from the input.
    recent_years: how many years is "recent" in the stats
     __init__ N/A N/A self input_features output_feature exclude_ties duplicate_with_reversed recent_years N/A None winner True True 2 N/A N/A N/A input_features None N/A N/A input_features N/A year years_played_all_time_1 years_played_all_time_2 matches_played_all_time_1 matches_played_all_time_2 matches_played_recent_1 matches_played_recent_2 matches_won_recent_1 matches_won_recent_2 matches_won_all_time_1 matches_won_all_time_2 matches_won_percent_recent_1 matches_won_percent_recent_2 matches_won_percent_all_time_1 matches_won_percent_all_time_2 N/A N/A self input_features input_features N/A N/A self output_feature output_feature N/A N/A self exclude_ties exclude_ties N/A N/A self duplicate_with_reversed duplicate_with_reversed N/A N/A self recent_years recent_years N/A read_data N/A N/A self N/A N/A N/A Read matches and stats. N/A Getting team stats... N/A N/A self team_stats N/A get_team_stats N/A self recent_years N/A Getting matches... N/A N/A self matches N/A get_matches with_team_stats True duplicate_with_reversed N/A self duplicate_with_reversed exclude_ties N/A self exclude_ties recent_years N/A self recent_years use_these_team_stats N/A self team_stats N/A prepare_learning N/A N/A self N/A N/A N/A Pre-process data for the learning needs, build network + trainer. N/A Separating inputs and outputs... N/A N/A N/A self inputs N/A self outputs N/A extract_samples N/A self matches N/A self input_features N/A self output_feature N/A Normalizing data... N/A N/A N/A self normalizer N/A self inputs N/A normalize N/A self inputs N/A Separating train and test sets... N/A N/A N/A self train_inputs N/A self train_outputs N/A self test_inputs N/A self test_outputs N/A split_samples N/A self inputs N/A self outputs N/A Building neural network... N/A N/A self network N/A buildNetwork N/A len N/A self input_features N/A 2 N/A len N/A self input_features 1 outclass SigmoidLayer bias True N/A Building and filling pybrain train set object... N/A N/A self train_set N/A ClassificationDataSet N/A len N/A self input_features N/A N/A i input_line N/A enumerate N/A self train_inputs N/A N/A N/A N/A N/A self train_set addSample N/A N/A self train_inputs N/A i N/A N/A N/A N/A self train_outputs N/A i 1 N/A N/A self trainer N/A BackpropTrainer N/A self network dataset N/A self train_set momentum 0.5 weightdecay 0.0 N/A N/A N/A N/A self train_set assignClasses N/A train N/A N/A self iterations N/A 1 N/A N/A Interactively train the network. N/A _ N/A range iterations N/A N/A N/A N/A N/A self trainer train N/A N/A N/A self test_network N/A predict N/A N/A self year team1 team2 N/A N/A N/A 
        Function to be able to easily predict from human input (pre-processing
        data and everything needed to obtain something in the neural network input
        format)
         N/A inputs N/A N/A feature N/A self input_features N/A N/A stat_name N/A N/A N/A N/A N/A N/A N/A N/A feature replace _1 replace _2 replace _recent replace _all_time N/A N/A stat_name N/A N/A N/A self team_stats columns values N/A N/A N/A all_time feature N/A N/A stat_year all_time N/A N/A stat_year year N/A team N/A N/A _1 feature team1 team2 N/A team_year N/A team_year_key team stat_year N/A value N/A N/A N/A self team_stats loc N/A N/A team_year stat_name N/A N/A N/A feature year N/A N/A value year N/A N/A N/A ValueError N/A Don't know where to get feature:  feature N/A N/A N/A inputs append value N/A inputs N/A N/A N/A self normalizer transform inputs N/A result N/A N/A self neural_result inputs N/A N/A result 0 N/A N/A tie N/A N/A N/A result 1 N/A N/A team1 N/A N/A N/A result 2 N/A N/A team2 N/A N/A N/A Unknown result:  N/A str result N/A neural_result N/A N/A self input N/A N/A N/A 
        Call the neural network, and translates its output to a match result.
         N/A n_output N/A N/A N/A self network activate input N/A N/A n_output 0.5 N/A N/A 2 N/A N/A 1 N/A test_network N/A N/A self N/A N/A N/A Calculate train and test sets errors. N/A train_accuracy N/A 100 N/A percentError N/A map N/A self neural_result N/A self train_inputs N/A self train_outputs N/A Train accuracy: train_accuracy N/A test_accuracy N/A 100 N/A percentError N/A map N/A self neural_result N/A self test_inputs N/A self test_outputs N/A Test accuracy: test_accuracy N/A N/A # N/A int train_accuracy TR N/A N/A # N/A int test_accuracy TE N/A N/A