@@ -37,9 +37,11 @@ def main():
3737 # First example: Use predefined accuracy metric
3838 print ("#" * 80 )
3939 print ("Use predefined accuracy metric" )
40- cls = autosklearn .classification .\
41- AutoSklearnClassifier (time_left_for_this_task = 60 ,
42- per_run_time_limit = 30 , seed = 1 )
40+ cls = autosklearn .classification .AutoSklearnClassifier (
41+ time_left_for_this_task = 60 ,
42+ per_run_time_limit = 30 ,
43+ seed = 1 ,
44+ )
4345 cls .fit (X_train , y_train , metric = autosklearn .metrics .accuracy )
4446
4547 predictions = cls .predict (X_test )
@@ -50,14 +52,18 @@ def main():
5052 # Second example: Use own accuracy metric
5153 print ("#" * 80 )
5254 print ("Use self defined accuracy metric" )
53- accuracy_scorer = autosklearn .metrics .make_scorer (name = "accu" ,
54- score_func = accuracy ,
55- greater_is_better = True ,
56- needs_proba = False ,
57- needs_threshold = False )
58- cls = autosklearn .classification .\
59- AutoSklearnClassifier (time_left_for_this_task = 60 ,
60- per_run_time_limit = 30 , seed = 1 )
55+ accuracy_scorer = autosklearn .metrics .make_scorer (
56+ name = "accu" ,
57+ score_func = accuracy ,
58+ greater_is_better = True ,
59+ needs_proba = False ,
60+ needs_threshold = False ,
61+ )
62+ cls = autosklearn .classification .AutoSklearnClassifier (
63+ time_left_for_this_task = 60 ,
64+ per_run_time_limit = 30 ,
65+ seed = 1 ,
66+ )
6167 cls .fit (X_train , y_train , metric = accuracy_scorer )
6268
6369 predictions = cls .predict (X_test )
@@ -68,21 +74,28 @@ def main():
6874 # Third example: Use own accuracy metric with additional argument
6975 print ("#" * 80 )
7076 print ("Use self defined accuracy with additional argument" )
71- accuracy_scorer = autosklearn .metrics .make_scorer (name = "accu_add" ,
72- score_func = accuracy_wk ,
73- greater_is_better = True ,
74- needs_proba = False ,
75- needs_threshold = False ,
76- dummy = None )
77- cls = autosklearn .classification .\
78- AutoSklearnClassifier (time_left_for_this_task = 60 ,
79- per_run_time_limit = 30 , seed = 1 )
77+ accuracy_scorer = autosklearn .metrics .make_scorer (
78+ name = "accu_add" ,
79+ score_func = accuracy_wk ,
80+ greater_is_better = True ,
81+ needs_proba = False ,
82+ needs_threshold = False ,
83+ dummy = None ,
84+ )
85+ cls = autosklearn .classification .AutoSklearnClassifier (
86+ time_left_for_this_task = 60 ,
87+ per_run_time_limit = 30 ,
88+ seed = 1 ,
89+ )
8090 cls .fit (X_train , y_train , metric = accuracy_scorer )
8191
8292 predictions = cls .predict (X_test )
83- print ("Accuracy score {:g} using {:s}" .
84- format (sklearn .metrics .accuracy_score (y_test , predictions ),
85- cls ._automl ._metric .name ))
93+ print (
94+ "Accuracy score {:g} using {:s}" .format (
95+ sklearn .metrics .accuracy_score (y_test , predictions ),
96+ cls ._automl ._metric .name
97+ )
98+ )
8699
87100
88101if __name__ == "__main__" :
0 commit comments