TransformerWrapper' object has no attribute '_memory_transform - python

I used PyCaret 3.0-rc. I developed model and saved them. after almost 3 weeks, now I loaded model. But when I want to use them :
train_predictions = predict_model(model, data=train)
I got the following error:
AttributeError: 'TransformerWrapper' object has no attribute '_memory_transform'
Can any one help me solve it?

Related

Pycaret Classification setup fails because 'OneHotEncoder' object has no attribute 'get_feature_names'

I'm trying to run this using PyCaret:
exp = setup(data = df, target = 'CureFlag',fold_shuffle=True, session_id=2)
but I get the error that 'OneHotEncoder' object has no attribute 'get_feature_names'.
Can anyone please help with this?

How to fix "AttributeError: 'numpy.bool_' object has no attribute 'predict'"

I have trained a classifier model and its working nicely in terms of giving prediction(boolian) in my local machine.
% movie data
% [Rating, Production_Budget_million]
movie_data=[1,20]
likelihood_pos=multivariate_normal_pos.pdf(movie_data)
likelihood_neg=multivariate_normal_neg.pdf(movie_data)
post_pos=likelihood_pos*prior_pos/(likelihood_pos*prior_pos+likelihood_neg*prior_neg)
post_neg=likelihood_neg*prior_neg/(likelihood_neg*prior_neg+likelihood_pos*prior_pos)
pred= post_pos>post_neg
pred
The problem I am facing ,after dumping the model as pickle when I am trying to calling the model and test with user data its giving an error"AttributeError: 'numpy.bool_' object has no attribute 'predict'"
I know the result will be boolian as"TRUE/FALSE".
#dumping/saving the model
import pickle
pickle.dump(pred, open('pred.pkl','wb'))
#calling the model
predx = pickle.load(open('pred.pkl','rb'))
#testing with user data
print(predx.predict([[1,20]]))
How can I solve the issue and fined the boolian output?

AttributeError: 'numpy.int64' object has no attribute 'isnull'

I am trying to do EDA and running below code
data = data[~data.age.isnull()].copy()
Getting error as "AttributeError: 'numpy.int64' object has no attribute 'isnull'"
Please help me if anybody knows.
Thanks
I tried to convert the values but still did not get a perfect solution. What I am missing?

AttributeError: 'numpy.ndarray' object has no attribute 'predict'

i am trying to find a predicted Y value (output is numerical) with x inputs using strings (eg. Business type, Department and Region). After using this :
print(model.predict([['Finance and Control'], ['EMEA'], ['Professional Services']]))
it returned this error : AttributeError: 'numpy.ndarray' object has no attribute 'predict'
import pickle
model = pickle.load(open('model3.pkl','rb'))
print(model.predict([['Finance and Control'], ['EMEA'], ['Professional Services']]))
Sample array after OHE
I ran into a similar issue as this, though without additional context, I'm not sure our errors derive from the same problem. However, the resolution I arrived at may help someone in the future as they go down the SO rabbit hole.
Using sklearn-0.20,
import joblib
model = joblib.load('model.pkl')
model.predict(previously_loaded_data)
Resulted in
AttributeError: 'numpy.ndarray' object has no attribute 'predict'
However, the following allowed me to load the actual model and use its predict method:
from sklearn.externals import joblib
model = joblib.load('model.pkl')
model.predict(previously_loaded_data)
sklearn.externals.joblib is deprecated since sklearn-0.23+, but my use case required sklearn-0.20.

AttributeError: 'module' object has no attribute 'doc

i am a beginner and i trying to model system dynamic model using python programming.the problem is when i trying to print the components of the sd model, the error message comes out like this:
"AttributeError: 'module' object has no attribute 'doc'"
my code:
import pysd
educationmodel = pysd.read_vensim('Education.mdl')
print educationmodel.components.doc()
As far as understand from the git repo, the doc() method is inside Class PySD. Also, read_vensim returns an instance of this class.
So your problem should get solved if you directly use educationmodel.doc().
That may be my fault - I had to move the .doc() function to the model object instead of the components object as a way to work towards including Vensim macros properly. If it's still an issue, may want to update to the latest release (0.7.4). If that doesn't help either, then we may have to fix something. =)

Categories

Resources