Check for invalid 'dataset_type' values.
@@ -94,10 +94,10 @@ def get_tox21(preprocessor=None, labels=None, return_smiles=False):
def _get_tox21_filepath(dataset_type):
"""Returns a filepath in which the tox21 dataset is cached.
- Thie function returns a filepath in which `dataset_type`
+ This function returns a filepath in which `dataset_type`
of the tox21 dataset is cached.
- Not that this function does not check if the dataset actually
- has been downloaded or not.
+ Note that this function does not check if the dataset has actually
+ been downloaded or not.
Args:
dataset_type(str): Name of the target dataset type.
@@ -106,6 +106,11 @@ def _get_tox21_filepath(dataset_type):
Returns (str): filepath for the tox21 dataset
"""
+ valid_dataset_types = {'train', 'val', 'test'}
+ if not dataset_type in valid_dataset_types:
+ raise ValueError('Invalid dataset type \'{}\'. Accepted values are '
+ '\'train\', \'val\' or \'test\'.'.format(dataset_type))
+
c = _config[dataset_type]
sdffile = c['filename']
@@ -117,7 +122,7 @@ def _get_tox21_filepath(dataset_type):
def get_tox21_filepath(dataset_type, download_if_not_exist=True):
"""Returns a filepath in which the tox21 dataset is cached.
- Thie function returns a filepath in which `dataset_type`
+ This function returns a filepath in which `dataset_type`
of the tox21 dataset is or will be cached.
If the dataset is not cached and if ``download_if_not_exist``
