@@ -34,13 +34,14 @@ def _do_test(self, dataset, X, nominal_indices, clf):
3434 return X_prime
3535
3636 def test_impute_indices (self ):
37- task_ids = [2 , 24 , 42 , 59 ]
37+ task_ids = [2 , 24 , 41 , 42 , 59 ]
3838
3939 for task_id in task_ids :
4040 task = openml .tasks .get_task (task_id )
4141 dataset = task .get_dataset ()
4242 X , _ = dataset .get_data (target = task .target_name )
43- nominal_indices = dataset .get_features_by_type ('nominal' , exclude = [len (dataset .features )- 1 ])
43+ nominal_indices = dataset .get_features_by_type ('nominal' , exclude = [task .target_name ])
44+ # print("task id %d indices %s" %(task_id, str(nominal_indices)))
4445 clf = ConditionalImputer (strategy = "median" ,
4546 strategy_nominal = "most_frequent" ,
4647 categorical_features = nominal_indices ,
@@ -50,13 +51,14 @@ def test_impute_indices(self):
5051
5152
5253 def test_impute_smart (self ):
53- task_ids = [2 , 24 , 42 , 59 ]
54+ task_ids = [2 , 24 , 41 , 42 , 59 ]
5455
5556 for task_id in task_ids :
5657 task = openml .tasks .get_task (task_id )
5758 dataset = task .get_dataset ()
5859 X , _ = dataset .get_data (target = task .target_name )
59- nominal_indices = dataset .get_features_by_type ('nominal' , exclude = [len (dataset .features )- 1 ])
60+ nominal_indices = dataset .get_features_by_type ('nominal' , exclude = [task .target_name ])
61+ # print("task id %d indices %s" %(task_id, str(nominal_indices)))
6062 clf = ConditionalImputer (strategy = "median" ,
6163 strategy_nominal = "most_frequent" ,
6264 categorical_features = None ,
@@ -71,7 +73,7 @@ def test_impute_with_constant(self):
7173 task = openml .tasks .get_task (task_id )
7274 dataset = task .get_dataset ()
7375 X , _ = dataset .get_data (target = task .target_name )
74- nominal_indices = dataset .get_features_by_type ('nominal' , exclude = [len ( dataset . features ) - 1 ])
76+ nominal_indices = dataset .get_features_by_type ('nominal' , exclude = [task . target_name ])
7577 clf = ConditionalImputer (strategy = "median" ,
7678 strategy_nominal = "most_frequent" ,
7779 categorical_features = None ,
0 commit comments