#NEWLINE# def test_root_CfEvaluator_evaluate_on_split( ) : #NEWLINE# #INDENT# 'Check evaluate_on_split method in CfEvaluator ' #NEWLINE# evaluator = CfEvaluator ( ) #NEWLINE# assert_raises ( ValueError , evaluator . evaluate_on_split , recsys , 'rank' ) #NEWLINE# rmse = evaluator . evaluate_on_split ( recsys , 'rmse' , permutation = False ) #NEWLINE# for p in rmse [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'rmse' ] >= 0.0 ) and ( p [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( rmse [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'rmse' ] >= 0.0 ) and ( rmse [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# mae = evaluator . evaluate_on_split ( recsys , 'mae' , permutation = False ) #NEWLINE# for p in mae [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'mae' ] >= 0.0 ) and ( p [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( mae [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'mae' ] >= 0.0 ) and ( mae [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# nmae = evaluator . evaluate_on_split ( recsys , 'nmae' , permutation = False ) #NEWLINE# for p in nmae [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'nmae' ] >= 0.0 ) and ( p [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( nmae [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'nmae' ] >= 0.0 ) and ( nmae [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# precision = evaluator . evaluate_on_split ( recsys , 'precision' , permutation = False ) #NEWLINE# for p in precision [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'precision' ] >= 0.0 ) and ( p [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( precision [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'precision' ] >= 0.0 ) and ( precision [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# recall = evaluator . evaluate_on_split ( recsys , 'recall' , permutation = False ) #NEWLINE# for p in recall [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'recall' ] >= 0.0 ) and ( p [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( recall [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'recall' ] >= 0.0 ) and ( recall [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# f1score = evaluator . evaluate_on_split ( recsys , 'f1score' , permutation = False ) #NEWLINE# for p in f1score [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'f1score' ] >= 0.0 ) and ( p [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( f1score [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'f1score' ] >= 0.0 ) and ( f1score [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# all_scores = evaluator . evaluate_on_split ( recsys , permutation = False ) #NEWLINE# for p in all_scores [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'f1score' ] >= 0.0 ) and ( p [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'recall' ] >= 0.0 ) and ( p [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'precision' ] >= 0.0 ) and ( p [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# for p in all_scores [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'mae' ] >= 0.0 ) and ( p [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'rmse' ] >= 0.0 ) and ( p [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'nmae' ] >= 0.0 ) and ( p [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( rmse [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'f1score' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'recall' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'precision' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'rmse' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'mae' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'nmae' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# assert_raises ( ValueError , evaluator . evaluate_on_split , boolean_recsys , 'rank' ) #NEWLINE# rmse = evaluator . evaluate_on_split ( boolean_recsys , 'rmse' , permutation = False ) #NEWLINE# for p in rmse [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'rmse' ] >= 0.0 ) and ( p [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( rmse [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'rmse' ] >= 0.0 ) and ( rmse [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# mae = evaluator . evaluate_on_split ( boolean_recsys , 'mae' , permutation = False ) #NEWLINE# for p in mae [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'mae' ] >= 0.0 ) and ( p [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( mae [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'mae' ] >= 0.0 ) and ( mae [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# nmae = evaluator . evaluate_on_split ( boolean_recsys , 'nmae' , permutation = False ) #NEWLINE# for p in nmae [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'nmae' ] >= 0.0 ) and ( p [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( nmae [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'nmae' ] >= 0.0 ) and ( nmae [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# precision = evaluator . evaluate_on_split ( boolean_recsys , 'precision' , permutation = False ) #NEWLINE# for p in precision [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'precision' ] >= 0.0 ) and ( p [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( precision [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'precision' ] >= 0.0 ) and ( precision [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# recall = evaluator . evaluate_on_split ( boolean_recsys , 'recall' , permutation = False ) #NEWLINE# for p in recall [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'recall' ] >= 0.0 ) and ( p [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( recall [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'recall' ] >= 0.0 ) and ( recall [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# f1score = evaluator . evaluate_on_split ( boolean_recsys , 'f1score' , permutation = False ) #NEWLINE# for p in f1score [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'f1score' ] >= 0.0 ) and ( p [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( f1score [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'f1score' ] >= 0.0 ) and ( f1score [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# all_scores = evaluator . evaluate_on_split ( boolean_recsys , permutation = False ) #NEWLINE# for p in all_scores [ 0 ] [ 'ir' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'f1score' ] >= 0.0 ) and ( p [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'recall' ] >= 0.0 ) and ( p [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'precision' ] >= 0.0 ) and ( p [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# for p in all_scores [ 0 ] [ 'error' ] : #NEWLINE# #INDENT# assert_true ( ( ( p [ 'mae' ] >= 0.0 ) and ( p [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'rmse' ] >= 0.0 ) and ( p [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( p [ 'nmae' ] >= 0.0 ) and ( p [ 'nmae' ] <= 1.0 ) ) ) #NEWLINE# #UNINDENT# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'f1score' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'f1score' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'recall' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'recall' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'precision' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'precision' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'rmse' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'rmse' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'mae' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'mae' ] <= 1.0 ) ) ) #NEWLINE# assert_true ( ( ( all_scores [ 1 ] [ 'final_error' ] [ 'avg' ] [ 'nmae' ] >= 0.0 ) and ( all_scores [ 1 ] [ 'final_error' ] [ 'stdev' ] [ 'nmae' ] <= 1.0 ) ) )