Skip to content

Commit 2c07bba

Browse files
committed
fix row id attribute mask
1 parent d6d87ff commit 2c07bba

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

openml/datasets/dataset.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,12 @@ def retrieve_class_labels(self, target_name='class'):
313313
return None
314314

315315

316-
def get_features_by_type(self, data_type, exclude=None, exclude_ignore_attributes=True):
316+
def get_features_by_type(self, data_type, exclude=None, exclude_ignore_attributes=True, exclude_row_id_attribute=True):
317317
assert data_type in OpenMLDataFeature.LEGAL_DATA_TYPES, "Illegal feature type requested"
318318
if self.ignore_attributes is not None:
319319
assert type(self.ignore_attributes) is list, "ignore_attributes should be a list"
320+
if self.row_id_attribute is not None:
321+
assert type(self.row_id_attribute) is str, "row id attribute should be a str"
320322
if exclude is not None:
321323
assert type(exclude) is list, "Exclude should be a list"
322324
assert all(isinstance(elem, str) for elem in exclude), "Exclude should be a list of strings"
@@ -325,6 +327,8 @@ def get_features_by_type(self, data_type, exclude=None, exclude_ignore_attribute
325327
to_exclude.extend(exclude)
326328
if exclude_ignore_attributes and self.ignore_attributes is not None:
327329
to_exclude.extend(self.ignore_attributes)
330+
if exclude_row_id_attribute and self.row_id_attribute is not None:
331+
to_exclude.append(self.row_id_attribute)
328332

329333
result = []
330334
offset = 0

tests/test_utils/test_conditionalimputer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ 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, 41, 42, 45, 59]
37+
task_ids = [2, 24, 41, 42, 45, 59] # would like to: 3950
3838

3939
for task_id in task_ids:
4040
task = openml.tasks.get_task(task_id)

0 commit comments

Comments
 (0)