Skip to content

Commit

Permalink
allow to skip confirmation for load_builtin (#222)
Browse files Browse the repository at this point in the history
* allow no prompt on Dataset.from_builtin

* update docstring for Dataset.load_builtin

* add Zachary Glassman to contributors
  • Loading branch information
ZachGlassman authored and NicolasHug committed Oct 26, 2018
1 parent 1a707b3 commit a4d49ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ cross_validate(algo, data, measures=['RMSE', 'MAE'], cv=5, verbose=True)
**Output**:

```
Evaluating RMSE, MAE of algorithm SVD on 5 split(s).
Fold 1 Fold 2 Fold 3 Fold 4 Fold 5 Mean Std
RMSE 0.9311 0.9370 0.9320 0.9317 0.9391 0.9342 0.0032
MAE 0.7350 0.7375 0.7341 0.7342 0.7375 0.7357 0.0015
Fit time 6.53 7.11 7.23 7.15 3.99 6.40 1.23
Test time 0.26 0.26 0.25 0.15 0.13 0.21 0.06
Evaluating RMSE, MAE of algorithm SVD on 5 split(s).
Fold 1 Fold 2 Fold 3 Fold 4 Fold 5 Mean Std
RMSE 0.9311 0.9370 0.9320 0.9317 0.9391 0.9342 0.0032
MAE 0.7350 0.7375 0.7341 0.7342 0.7375 0.7357 0.0015
Fit time 6.53 7.11 7.23 7.15 3.99 6.40 1.23
Test time 0.26 0.26 0.25 0.15 0.13 0.21 0.06
```

[Surprise](http://surpriselib.com) can do **much** more (e.g,
Expand Down Expand Up @@ -190,7 +190,7 @@ The following persons have contributed to [Surprise](http://surpriselib.com):
caoyi, Олег Демиденко, Charles-Emmanuel Dias, dmamylin, Lauriane Ducasse,
franckjay, Lukas Galke, Pierre-François Gimenez, Nicolas Hug, Doruk
Kilitcioglu, Ravi Raju Krishna, Hengji Liu, Maher Malaeb, Manoj K, Naturale0,
nju-luke, Skywhat, David Stevens, Mike Lee Williams, Chenchen Xu, YaoZh1918.
nju-luke, Skywhat, David Stevens, Mike Lee Williams, Chenchen Xu, YaoZh1918, Zachary Glassman.

Thanks a lot :) !

Expand Down
7 changes: 5 additions & 2 deletions surprise/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, reader=None, rating_scale=None):
self.rating_scale = self.reader.rating_scale

@classmethod
def load_builtin(cls, name='ml-100k'):
def load_builtin(cls, name='ml-100k', prompt=True):
"""Load a built-in dataset.
If the dataset has not already been loaded, it will be downloaded and
Expand All @@ -76,6 +76,9 @@ def load_builtin(cls, name='ml-100k'):
name(:obj:`string`): The name of the built-in dataset to load.
Accepted values are 'ml-100k', 'ml-1m', and 'jester'.
Default is 'ml-100k'.
prompt(:obj:`bool`): Prompt before downloading if dataset is not
already on disk.
Default is True.
Returns:
A :obj:`Dataset` object.
Expand All @@ -93,7 +96,7 @@ def load_builtin(cls, name='ml-100k'):

# if dataset does not exist, offer to download it
if not os.path.isfile(dataset.path):
answered = False
answered = not prompt
while not answered:
print('Dataset ' + name + ' could not be found. Do you want '
'to download it? [Y/n] ', end='')
Expand Down

0 comments on commit a4d49ac

Please sign in to comment.