Skip to content
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

Error when trying to execute code in real_data_example.ipynb: module 'datasets' has no attribute 'GetDataset' #1

Closed
fboehm opened this issue Jun 3, 2021 · 4 comments

Comments

@fboehm
Copy link

fboehm commented Jun 3, 2021

I'm encountering an error when I try to run code in the file real_data_example.ipynb. Specifically, I encounter the error in the line:

X, y = datasets.GetDataset(dataset_name)

I appreciate any suggestions or assistance that you might provide.

@fboehm
Copy link
Author

fboehm commented Jun 4, 2021

I misunderstood the use of python's import command. I see now that the repository contains a file, datasets/datasets.py that specifies the code for GetDataset. I apologize for my confusion.

@fboehm
Copy link
Author

fboehm commented Jun 4, 2021

I'm now getting this error when trying to run the same code.


ImportError Traceback (most recent call last)
in
31
32 # load the dataset
---> 33 X, y = datasets.GetDataset(dataset_name, dataset_base_path)
34
35 # divide the dataset into test and train based on the test_ratio parameter

~/work/research/cqr/datasets/datasets.py in GetDataset(name, base_path)
338
339 # Impute mean values for samples with missing values
--> 340 from sklearn.preprocessing import Imputer
341
342 imputer = Imputer(missing_values = 'NaN', strategy = 'mean', axis = 0)

ImportError: cannot import name 'Imputer' from 'sklearn.preprocessing' (/home/fred/.local/lib/python3.9/site-packages/sklearn/preprocessing/init.py)

@fboehm
Copy link
Author

fboehm commented Jun 4, 2021

I see now that sklearn.preprocessing.Imputer is deprecated in current versions of sklearn.

@fboehm
Copy link
Author

fboehm commented Jun 4, 2021

Current versions of sklearn have sklearn.impute.SimpleImputer. I imagine that the code in the jupyter notebooks should be updated to reflect this.

@fboehm fboehm closed this as completed Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant