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")

Answer from Tophat on Stack Exchange
🌐
GitHub
github.com › waylandy › phosformer › issues › 1
'numpy.ndarray' object has no attribute 'numpy'. · Issue #1 · waylandy/phosformer
November 16, 2023 - Traceback (most recent call last): File "/Users/joshuasacher/phosformer/wip1_S234.py", line 17, in <module> predictions = Phosformer.predict_many( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuasacher/phosformer/Phosformer/modules.py", line 204, in predict_many return np.array([i['pred'] for i in batch_job(kinases, peptides, **kwargs)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuasacher/phosformer/Phosformer/modules.py", line 204, in <listcomp> return np.array([i['pred'] for i in batch_job(kinases, peptides, **kwargs)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/joshuasacher/phosformer/Phosformer/modules.py", line 96, in batch_job pred = softmax(result['logits'].cpu(), axis=1)[:,1].numpy() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'numpy.ndarray' object has no attribute 'numpy'.
Author   jrsacher
Discussions

AttributeError: 'numpy.ndarray' object has no attribute 'predict'
AttributeError: ‘numpy.ndarray’ object has no attribute ‘predict’ Untitled4.ipynb (117.2 KB) how to solve this? More on community.deeplearning.ai
🌐 community.deeplearning.ai
0
0
March 29, 2022
python 3.x - 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
I've finished modelling the forecasting on my training data. Now I want to plot a forecast with the function 'predict' to evaluate it with my test data. But my code does not work I received the er... More on stackoverflow.com
🌐 stackoverflow.com
October 25, 2019
python - AttributeError: 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Ask questions, find answers and collaborate at work with Stack Overflow for Teams More on stackoverflow.com
🌐 stackoverflow.com
September 9, 2019
AttributeError: 'numpy.ndarray' object has no attribute 'numpy'
@ptrblck, Hi! I’m trying to visualize the adversarial images generated by this script: https://pytorch.org/tutorials/beginner/fgsm_tutorial.html This tutorial is used for the mnist data. Now I want to use for other data which is trained using the inception_v1 architecture, below is the gist ... More on discuss.pytorch.org
🌐 discuss.pytorch.org
12
0
April 9, 2019
🌐
Streamlit
discuss.streamlit.io › community cloud
While predict we are getting error AttributeError: 'numpy.ndarray' object has no attribute 'predict' - Community Cloud - Streamlit
April 2, 2024 - Github link : git@github.com:pawaravinash0007/MachineLearning.git streamlit deployment link : Streamlit Dear All, We are getting attribute errors AttributeError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded ...
🌐
Stack Overflow
stackoverflow.com › questions › 58560741 › numpy-ndarray-object-has-no-attribute-predict
python 3.x - 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
October 25, 2019 - 1 ARIMA prediction in python · ... 'numpy.ndarray' has no attribute '__array_function__' 0 Unable to predict values for a given input date in ARIMA using predict() function ·...
🌐
Stack Overflow
stackoverflow.com › questions › 57847177 › attributeerror-numpy-ndarray-object-has-no-attribute-predict
python - AttributeError: 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
September 9, 2019 - 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.
Find elsewhere
🌐
PyTorch Forums
discuss.pytorch.org › vision
AttributeError: 'numpy.ndarray' object has no attribute 'numpy' - vision - PyTorch Forums
April 9, 2019 - @ptrblck, Hi! I’m trying to visualize the adversarial images generated by this script: https://pytorch.org/tutorials/beginner/fgsm_tutorial.html This tutorial is used for the mnist data. Now I want to use for other data which is trained using the inception_v1 architecture, below is the gist ...
🌐
Stack Overflow
stackoverflow.com › questions › 72648690 › ml-model-error-numpy-ndarray-object-has-no-attribute-predict
python - ML model error 'numpy.ndarray' object has no attribute 'predict' - Stack Overflow
June 16, 2022 - from flask import Flask, render_template, request import pickle import numpy as np import joblib model = pickle.load(open('model_car_price', 'rb')) joblib.dump(model,'model_car_prices_data') # imported the pickle file containing the ML model realmodel = pickle.load(open('model_car_prices_data', 'rb')) app = Flask(__name__) app.debug = True app.config['TEMPLATES_AUTO_RELOAD'] = True @app.route('/') def man(): return render_template('home.html') @app.route('/predict', methods=['POST']) def home(): data1 = request.form['a'] data2 = request.form['b'] data3 = request.form['c'] data4 = request.form['d'] data5 = request.form['e'] data6 = request.form['f'] data7 = request.form['g'] arr = np.array([[data1, data2, data3, data4, data5, data6, data7]]) pred = model.predict(arr) return render_template('after.html', data=pred) if __name__ == "__main__": app.run(debug=True)
🌐
GitHub
github.com › pycaret › pycaret › issues › 2079
AttributeError: 'numpy.ndarray' object has no attribute 'columns' · Issue #2079 · pycaret/pycaret
January 20, 2022 - AttributeError: 'numpy.ndarray' object has no attribute 'columns'#2079 · Copy link · Assignees · Labels · bugSomething isn't workingSomething isn't working · FredericoSL · opened · on Jan 20, 2022 · Issue body actions · Describe the bug File "AutoML.py", line 75, in predictions = predict_model(automlmodel, X_test) File "/azureml-envs/azureml_00fe395d564c8928d8ab7de32f77ce0a/lib/python3.8/site-packages/pycaret/classification.py", line 2025, in predict_model return pycaret.internal.tabular.predict_model( File "/azureml-envs/azureml_00fe395d564c8928d8ab7de32f77ce0a/lib/python3.8/site-pac
Author   FredericoSL
🌐
Stack Overflow
stackoverflow.com › questions › 58456397 › numpy-ndarray-object-has-no-attribute-predict-proba
python - " 'numpy.ndarray' object has no attribute 'predict_proba' " - Stack Overflow
October 19, 2019 - Thanks aminrd- I was able to run predict_proba by calling gnb first · – niugrads1999 Commented Oct 18, 2019 at 22:46 · Add a comment | Related questions · 4 · 'numpy.ndarray' object is not callable error · 5 · AttributeError: 'numpy.ndarray' object has no attribute 'toarray' 1 ·
🌐
CopyProgramming
copyprogramming.com › howto › attributeerror-numpy-ndarray-object-has-no-attribute-predict
Python: No 'predict' attribute found for 'numpy.ndarray' object in AttributeError
March 25, 2023 - print(model.predict([['Finance and Control'], ['EMEA'], ['Professional Services']])) Upon execution, an error with the code AttributeError: 'numpy.ndarray' object has no attribute 'predict' was encountered.
🌐
GitHub
github.com › marcotcr › anchor › issues › 37
'numpy.ndarray' object has no attribute 'feature_names' · Issue #37 · marcotcr/anchor
November 29, 2019 - I get this error 'numpy.ndarray' object has no attribute 'feature_names' When trying to execute explainer = AnchorTabular(model.predict, feature_names=X_test.columns.values.tolist()) I tried to convert to numpy array, but that did not wo...
Author   alexlaurence
🌐
Fast.ai
forums.fast.ai › part 1 (2019) › advanced (part 1 v3)
Can I do lesson 2 on real time system? - Advanced (Part 1 v3) - fast.ai Course Forums
April 9, 2019 - I trained my data at kaggle and ı download my trained model . When ı try to predict one of frame ,python gives me an error : AttributeError: ‘numpy.ndarray’ object has no attribute ‘apply_tfms’ . I am using opencv for ca…