@@ -42,6 +42,34 @@ def __init__(
4242 self .estimation_procedure_id = estimation_procedure_id
4343 self .split = None # type: Optional[OpenMLSplit]
4444
45+ def __str__ (self ):
46+ object_dict = self .__dict__
47+ output_str = ''
48+ task_type = '\n %-20s: %s\n ' % ("Task Type" , object_dict ['task_type' ])
49+ task_id = '%-20s: %s\n ' % ("Task ID" , object_dict ['task_id' ])
50+ url = 'https://www.openml.org/t/' + str (object_dict ['task_id' ])
51+ task_url = '%-20s: %s\n ' % ("Task URL" , url )
52+ evaluation_measure = ''
53+ if object_dict ['evaluation_measure' ] is not None :
54+ evaluation_measure = '%-20s: %s\n ' % ("Evaluation Measure" ,
55+ object_dict ['evaluation_measure' ])
56+ estimation_procedure = ''
57+ if object_dict ['estimation_procedure' ] is not None :
58+ estimation_procedure = '%-20s: %s\n ' % ("Estimation Procedure" ,
59+ object_dict ['estimation_procedure' ]['type' ])
60+ target = ''
61+ class_labels = ''
62+ cost_matrix = ''
63+ if object_dict ['target_name' ] is not None :
64+ target = '%-20s: %s\n ' % ("Target Feature" , object_dict ['target_name' ])
65+ if 'class_labels' in object_dict :
66+ class_labels = '%-20s: %s\n ' % ("# of Classes" , len (object_dict ['class_labels' ]))
67+ if 'cost_matrix' in object_dict :
68+ cost_matrix = '%-20s: %s\n ' % ("Cost Matrix" , "Available" )
69+ output_str = task_type + task_id + task_url + evaluation_measure + estimation_procedure + \
70+ target + class_labels + cost_matrix
71+ return (output_str )
72+
4573 def get_dataset (self ) -> datasets .OpenMLDataset :
4674 """Download dataset associated with task"""
4775 return datasets .get_dataset (self .dataset_id )
0 commit comments