HungaBunga
HungaBunga copied to clipboard
sklearn.exceptions.NotFittedError: This SGDClassifier instance is not fitted yet
Hello
This is the code i'm trying to run:
X_train, y_train = prepare_data_for_ml(X_train, y_train)
y_train, y_test = prepare_data_for_ml(X_test, y_test)
clf = HungaBungaClassifier()
clf.fit(X_train, y_train)
clf.predict(X_test)
That's the error:
100%|██████████| 15/15 [00:00<00:00, 43.02it/s]
Traceback (most recent call last):
File "/Users/yonatab/PycharmProjects/VisualFitnessUtils/activate_ml/activate_ml_on_joints.py", line 62, in <module>
main()
File "/Users/yonatab/PycharmProjects/VisualFitnessUtils/activate_ml/activate_ml_on_joints.py", line 43, in main
clf.predict(X_test)
File "/Users/yonatab/opt/anaconda3/envs/CondaEnv/lib/python3.7/site-packages/hunga_bunga/classification.py", line 202, in predict
return self.model.predict(x)
File "/Users/yonatab/opt/anaconda3/envs/CondaEnv/lib/python3.7/site-packages/sklearn/linear_model/base.py", line 289, in predict
scores = self.decision_function(X)
File "/Users/yonatab/opt/anaconda3/envs/CondaEnv/lib/python3.7/site-packages/sklearn/linear_model/base.py", line 263, in decision_function
"yet" % {'name': type(self).__name__})
sklearn.exceptions.NotFittedError: This SGDClassifier instance is not fitted yet
Am I missing something?
Thanks
Hi, I think you overwrite the variable y_train involuntarily (second line), there should probably be X_test. Hope that helps.