#NEWLINE# def test_logistic_custom_learner( ) : #NEWLINE# #INDENT# num_labels = 10 #NEWLINE# class_weights = ( [ ( 0.5 / ( num_labels - 1 ) ) for x in range ( ( num_labels - 1 ) ) ] + [ 0.5 ] ) #NEWLINE# ( train_fs , test_fs ) = make_classification_data ( num_examples = 600 , train_test_ratio = 0.8 , num_labels = num_labels , num_features = 5 , non_negative = True , class_weights = class_weights ) #NEWLINE# train_path = join ( _my_dir , 'train' , 'test_logistic_custom_learner.jsonlines' ) #NEWLINE# writer = NDJWriter ( train_path , train_fs ) #NEWLINE# writer . write ( ) #NEWLINE# test_path = join ( _my_dir , 'test' , 'test_logistic_custom_learner.jsonlines' ) #NEWLINE# writer = NDJWriter ( test_path , test_fs ) #NEWLINE# writer . write ( ) #NEWLINE# cfgfile = 'test_logistic_custom_learner.template.cfg' #NEWLINE# config_template_path = join ( _my_dir , 'configs' , cfgfile ) #NEWLINE# config_path = fill_in_config_paths ( config_template_path ) #NEWLINE# run_configuration ( config_path , quiet = True ) #NEWLINE# outprefix = 'test_logistic_custom_learner' #NEWLINE# preds = read_predictions ( join ( _my_dir , 'output' , '{}_{}_CustomLogisticRegressionWrapper.predictions' . format ( outprefix , outprefix ) ) ) #NEWLINE# expected = read_predictions ( join ( _my_dir , 'output' , '{}_{}_LogisticRegression.predictions' . format ( outprefix , outprefix ) ) ) #NEWLINE# assert_array_equal ( preds , expected )