Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Bootstrap fixes - #250

Merged
Eugene Fedorenko (eedorenko) merged 7 commits into
masterfrom
tcare/bootstrap-fixes
Apr 3, 2020
Merged

Eugene Fedorenko (eedorenko) merged 7 commits into
masterfrom
tcare/bootstrap-fixes

Conversation

@tcare

Copy link
Copy Markdown
Contributor
  • Project name is now additionally restricted to letters and underscores
  • Fix an issue where we try to load a non-existant dataset from sklearn after bootstrapping
  • Added some general error handling
  • Standardized arguments to short and long forms & updated README
  • General code cleanup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added a comment

try:
from sklearn.datasets import load_diabetes
except ImportError as e:
print("Project has already been bootstrapped, you must provide your own data.") # NOQA: E501

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't be so strong in this message. We don't know the reason of the error for sure. We just guess. I would go with something like "Failed to load diabetes dataset, perhaps the project has already ..."

The thing is that it will still rename load_diabetes into load_we_dont_call_his_name which introduces a buggy code (that we handle with this try-except). Perhaps it would make sense to move out all this load_diabetes dataset creation to a separate module (imported in this file) and exclude that module/file from "files" in replace_project_name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, separating dataset creation is the right way to go. A quick hotfix is to call replaceprojectname on the training script to rename the specific import.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought ImportError would be enough of a limited scope to avoid any weirdness. However you made me realize that this would actually be the first time that we encounter sklearn in the flow, so this could hide a dependency error. At the very least, we need to check that sklearn exists and the loading function doesn't.

Re: moving it out, if we're going to do the non-hacky fix, I feel that this should be generic enough that you don't need to rely on having a predefined dataset to export and rather can use a csv.

@tcare

Copy link
Copy Markdown
Contributor Author

I decided to take the middle ground. CSV creation from the diabetes data has been factored out, but when the project bootstraps the CSV loading will fail with a message that they need to provide a CSV. This way, we avoid a situation where we silently use diabetes data (happened to me :)) and still make it easy to bring a CSV to use.

@eedorenko

Copy link
Copy Markdown
Contributor

lgtm

@dtzar
David Tesar (dtzar) deleted the tcare/bootstrap-fixes branch April 9, 2020 21:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants