I am saving a sklearn.impute.SimpleImputer object using pickle. The imputer is fit with
imputer = SimpleImputer(missing_values = np.nan, strategy = 'mean')
imputer = imputer.fit(train)
I then save the imputer with
pickle.dump(imputer,open('imputer.pkl','wb'))
and load the model in a flask app using
imputer = pickle.load(open('imputer.pkl','rb'))
I can successfully see the values that should be imputed if I check imputer.statistics_ . However, when I run
imputer.transform(test)
in my flask app using the imputer loaded with pickle, I get the following error:
"The reset parameter is False but there is no " RuntimeError: The reset parameter is False but there is no n_features_in_ attribute. Is this estimator fitted?
I am using sklearn version 0.23.1 to fit the imputer and transform the data. Does anyone have any insight on this? Please let me know what other information I can provide.