-
Notifications
You must be signed in to change notification settings - Fork 68
Replace Boston dataset from examples and tests. #717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| """ | ||
| This is a simple script to download and transform some example data from | ||
| sklearn.datasets. | ||
|
|
||
| :author: Michael Heilman (mheilman@ets.org) | ||
| :author: Aoife Cahill (acahill@ets.org) | ||
| :author: Nitin Madnani (nmadnani@ets.org) | ||
| :organization: ETS | ||
| """ | ||
|
|
||
| import json | ||
| import os | ||
|
|
||
| import numpy as np | ||
| import sklearn.datasets | ||
| from sklearn.model_selection import train_test_split | ||
|
|
||
|
|
||
| def main(): | ||
| """ | ||
| Download some example data and split it into training and test data. | ||
| The california data set is meant for regression modeling. | ||
| """ | ||
| print("Retrieving california data from servers...", end="") | ||
| california = sklearn.datasets.fetch_california_housing() | ||
| print("done") | ||
|
|
||
| # this dataset contains 20,640 samples which is too many | ||
| # let's just sample this dataset to get 500 samples | ||
| rng = np.random.default_rng(42) | ||
| chosen_indices = rng.integers(0, california.target.shape[0], size=500) | ||
| X = california.data[chosen_indices, :] | ||
| Y = california.target[chosen_indices] | ||
|
|
||
| # crate example jsonlines dictionaries | ||
|
desilinguist marked this conversation as resolved.
|
||
| examples = [ | ||
| {"id": f"EXAMPLE_{i}", "y": y, "x": {f"f{j}": x_val for j, x_val in enumerate(x)}} | ||
| for i, (x, y) in enumerate(zip(X, Y)) | ||
| ] | ||
|
|
||
| (examples_train, examples_test) = train_test_split(examples, test_size=0.33, random_state=42) | ||
|
|
||
| print("Writing training and testing files...", end="") | ||
| for examples, suffix in [(examples_train, "train"), (examples_test, "test")]: | ||
| california_dir = os.path.join("california", suffix) | ||
| if not os.path.exists(california_dir): | ||
| os.makedirs(california_dir) | ||
| jsonlines_path = os.path.join(california_dir, "example_california_features.jsonlines") | ||
| with open(jsonlines_path, "w") as f: | ||
| for ex in examples: | ||
| f.write(f"{json.dumps(ex)}\n") | ||
| print("done") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
tests/other/expected/Boston_Voting_Evaluate_example_boston_VotingRegressor.results.json
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...other/expected/California_Voting_Evaluate_example_california_VotingRegressor.results.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [{"experiment_name": "California_Voting_Evaluate", "train_set_name": "train", "train_set_size": 335, "test_set_name": "test", "test_set_size": 165, "featureset": "[\"example_california_features\"]", "featureset_name": "example_california", "shuffle": false, "learner_name": "VotingRegressor", "task": "evaluate", "start_timestamp": "08 Sep 2022 16:46:00.730349", "version": "3.0.0", "feature_scaling": "both", "folds_file": "", "grid_search": true, "grid_objective": "pearson", "grid_search_folds": "3", "min_feature_count": 1, "cv_folds": "None", "using_folds_file": false, "save_cv_folds": true, "save_cv_models": false, "use_folds_file_for_grid_search": true, "stratified_folds": true, "scikit_learn_version": "1.1.2", "end_timestamp": "08 Sep 2022 16:46:01.258898", "total_time": "0:00:00.528549", "result_table": "", "accuracy": "", "pearson": 0.8166881235318064, "score": 0.8166881235318064, "fold": "", "model_params": "{\"estimators\": [[\"SVR\", \"{'vectorizer': DictVectorizer(sparse=False), 'selector': SelectByMinCount(), 'scaler': StandardScaler(), 'estimator': SVR(C=0.01, cache_size=1000)}\"], [\"LinearRegression\", \"{'vectorizer': DictVectorizer(sparse=False), 'selector': SelectByMinCount(), 'scaler': StandardScaler(), 'estimator': LinearRegression()}\"], [\"DecisionTreeRegressor\", \"{'vectorizer': DictVectorizer(sparse=False), 'selector': SelectByMinCount(), 'scaler': StandardScaler(), 'estimator': DecisionTreeRegressor(criterion='poisson', max_features='log2', random_state=123456789)}\"]], \"n_jobs\": null, \"verbose\": false, \"weights\": null}", "descriptive": {"actual": {"min": 0.425, "max": 5.00001, "avg": 2.0123758181818183, "std": 1.0334681372156997}, "predicted": {"min": 0.8218118503116726, "max": 3.7041058491575156, "avg": 1.9474491829550034, "std": 0.643682340272272}}, "additional_scores": {}}] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.