yromano / cqr

Conformalized Quantile Regression
https://sites.google.com/view/cqr
Other
239 stars 46 forks source link

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

Closed fboehm closed 1 year ago

fboehm commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

fboehm commented 3 years ago

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