Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion openml/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ def __init__(self, dataset_id=None, name=None, version=None, description=None,
if features is not None:
self.features = {}
for idx, xmlfeature in enumerate(features['oml:feature']):
# split string of nominal values into type list if feature is nominal
# otherwise passing none for nominal values
try:
nom_vals = [str(x[1:-1]) for x in xmlfeature['oml:nominal_values'][1:-1].split(',')]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a brief explanation of this statement, preferably with an example string that is parsed?

except KeyError:
nom_vals = None
feature = OpenMLDataFeature(int(xmlfeature['oml:index']),
xmlfeature['oml:name'],
xmlfeature['oml:data_type'],
None, # todo add nominal values (currently not in database)
nom_vals,
int(xmlfeature.get('oml:number_of_missing_values', 0)))
if idx != feature.index:
raise ValueError('Data features not provided in right order')
Expand Down