You don't want to pickle the predictions but rather the fit.
Change joblib.dump(nb_predict_train, "trained-model.pkl") to joblib.dump(nb_model, "trained-model.pkl")
AttributeError: 'numpy.ndarray' object has no attribute 'predict'
python 3.x - 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
python - AttributeError: 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
AttributeError: 'numpy.ndarray' object has no attribute 'numpy'
Videos
The problem is that train_test_split(X, y, ...) returns numpy arrays and not pandas dataframes. Numpy arrays have no attribute named columns
If you want to see what features SelectFromModel kept, you need to substitute X_train (which is a numpy.array) with X which is a pandas.DataFrame.
selected_feat= X.columns[(sel.get_support())]
This will return a list of the columns kept by the feature selector.
If you wanted to see how many features were kept you can just run this:
sel.get_support().sum() # by default this will count 'True' as 1 and 'False' as 0
because this :
X = df.iloc[:,:24481].values
y = df.iloc[:, -1].values
you should remove .values or make extra X_col, y_col like that
X_col = df.iloc[:,:24481]
y_col = df.iloc[:, -1]
https://imgur.com/gallery/yAdAjdx
Hello,
Linked is the screenshot of the two error messages I keep recieving as well as the code leading up to it. I'm trying to run an uplift on a classification tree. Any help is appreciated, I am still fairly new to python. Thank you!!