|
3 | 3 | import logging |
4 | 4 | import os |
5 | 5 | import six |
6 | | -import sys |
7 | 6 |
|
8 | 7 | import arff |
9 | 8 |
|
@@ -82,7 +81,7 @@ def __init__(self, dataset_id=None, name=None, version=None, description=None, |
82 | 81 | feature = OpenMLDataFeature(int(xmlfeature['oml:index']), |
83 | 82 | xmlfeature['oml:name'], |
84 | 83 | xmlfeature['oml:data_type'], |
85 | | - None, #todo add nominal values (currently not in database) |
| 84 | + None, # todo add nominal values (currently not in database) |
86 | 85 | int(xmlfeature.get('oml:number_of_missing_values', 0))) |
87 | 86 | if idx != feature.index: |
88 | 87 | raise ValueError('Data features not provided in right order') |
@@ -129,6 +128,28 @@ def __init__(self, dataset_id=None, name=None, version=None, description=None, |
129 | 128 | logger.debug("Saved dataset %d: %s to file %s" % |
130 | 129 | (self.dataset_id, self.name, self.data_pickle_file)) |
131 | 130 |
|
| 131 | + def push_tag(self, tag): |
| 132 | + """Annotates this data set with a tag on the server. |
| 133 | +
|
| 134 | + Parameters |
| 135 | + ---------- |
| 136 | + tag : string |
| 137 | + Tag to attach to the dataset. |
| 138 | + """ |
| 139 | + data = {'data_id': self.dataset_id, 'tag': tag} |
| 140 | + _perform_api_call("/data/tag", data=data) |
| 141 | + |
| 142 | + def remove_tag(self, tag): |
| 143 | + """Removes a tag from this dataset on the server. |
| 144 | +
|
| 145 | + Parameters |
| 146 | + ---------- |
| 147 | + tag : string |
| 148 | + Tag to attach to the dataset. |
| 149 | + """ |
| 150 | + data = {'data_id': self.dataset_id, 'tag': tag} |
| 151 | + _perform_api_call("/data/untag", data=data) |
| 152 | + |
132 | 153 | def __eq__(self, other): |
133 | 154 | if type(other) != OpenMLDataset: |
134 | 155 | return False |
@@ -315,7 +336,6 @@ def retrieve_class_labels(self, target_name='class'): |
315 | 336 | else: |
316 | 337 | return None |
317 | 338 |
|
318 | | - |
319 | 339 | def get_features_by_type(self, data_type, exclude=None, |
320 | 340 | exclude_ignore_attributes=True, |
321 | 341 | exclude_row_id_attribute=True): |
@@ -377,11 +397,7 @@ def publish(self): |
377 | 397 |
|
378 | 398 | Returns |
379 | 399 | ------- |
380 | | - return_code : int |
381 | | - Return code from server |
382 | | -
|
383 | | - return_value : string |
384 | | - xml return from server |
| 400 | + self |
385 | 401 | """ |
386 | 402 |
|
387 | 403 | file_elements = {'description': self._to_xml()} |
|
0 commit comments