XuhanLiu / DrugEx

Deep learning toolkit for Drug Design with Pareto-based Multi-Objective optimization in Polypharmacology
MIT License
196 stars 67 forks source link

AttributeError: 'int' object has no attribute 'predict_proba' #5

Open a919224757 opened 4 years ago

a919224757 commented 4 years ago

when run the agent.py , There was an error and I didn't debug it

Could you give me some advice? Thank you

Traceback (most recent call last): File "agent.py", line 159, in main() File "agent.py", line 124, in main Policy_gradient(agent, environ, explore=explore) File "agent.py", line 38, in Policy_gradient preds = environ(smiles) File "C:\Users\wmy\DL\DrugEx\util.py", line 194, in call preds = self.clf.predict_proba(fps)[:, 1] AttributeError: 'int' object has no attribute 'predict_proba'

XuhanLiu commented 4 years ago

I guess it is caused by the classification model in your environment. self.clf should by a scikit-learn based machine learning model, not int type. Before you run the "agent.py", you have to train a classification model with Scikit-Learn and dump it in your hard drive and set the 'env_path' as the file path of this model.

a919224757 commented 4 years ago

I guess it is caused by the classification model in your environment. self.clf should by a scikit-learn based machine learning model, not int type. Before you run the "agent.py", you have to train a classification model with Scikit-Learn and dump it in your hard drive and set the 'env_path' as the file path of this model.

Thank you! This is because I generated the wrong .pkg model ! One thing I care about is that environ.py could automatically generate a .pkg file yesterday, but today only generated the cv and ind, it couldn't generate the .pkg until I changed some code: model = RandomForestClassifier(n_estimators=1000, n_jobs=10) model.fit(X, y[:, 0]) joblib.dump(model, out+'.pkg')

its very interteresting......

(It was the use of yesterday's model that emerge the bug.....@_@)