raysunau / pydatoolkit

Python Analytics Toolkit
MIT License
0 stars 0 forks source link

predict function error #1

Closed raysunau closed 3 years ago

raysunau commented 3 years ago

ERROR - Error while preparing predictions: Number of features of the model must match the input. Model n_features is 12 and input n_features is 13 Traceback (most recent call last): File "/Users/rsun/projects/code/pydatoolkit/datk/model.py", line 480, in predict y_pred = model.predict(x_val) File "/Users/rsun/projects/py_venv/pydatk/lib/python3.7/site-packages/sklearn/ensemble/_forest.py", line 629, in predict proba = self.predict_proba(X) File "/Users/rsun/projects/py_venv/pydatk/lib/python3.7/site-packages/sklearn/ensemble/_forest.py", line 673, in predict_proba X = self._validate_X_predict(X) File "/Users/rsun/projects/py_venv/pydatk/lib/python3.7/site-packages/sklearn/ensemble/_forest.py", line 421, in _validate_Xpredict return self.estimators[0]._validate_X_predict(X, check_input=True) File "/Users/rsun/projects/py_venv/pydatk/lib/python3.7/site-packages/sklearn/tree/_classes.py", line 399, in _validate_X_predict % (self.nfeatures, n_features)) ValueError: Number of features of the model must match the input. Model n_features is 12 and input n_features is 13

raysunau commented 3 years ago

Test data has the target column, fix the error by removing it.