loaded_model = pickle.load(open(filename, ‘rb’))
text = "I’m having a problem with ShareFile. I’ve received recent ShareFile uploads from my different clients, "
predictions = loaded_model.predict(text)
I get the error:
Traceback (most recent call last): File “c:\Users\15126\Desktop\Python\pyotrch_nlptickets\model_test.py”, line 154, in predictions = loaded_model.predict(text) File “C:\Users\15126\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\neighbors_classification.py”, line 214, in predict neigh_dist, neigh_ind = self.kneighbors(X) File “C:\Users\15126\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\neighbors_base.py”, line 717, in kneighbors X = self._validate_data(X, accept_sparse=“csr”, reset=False) File “C:\Users\15126\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\base.py”, line 566, in _validate_data X = check_array(X, **check_params) File “C:\Users\15126\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\utils\validation.py”, line 761, in check_array raise ValueError( ValueError: Expected 2D array, got scalar array instead: array=I’m having a problem with ShareFile. I’ve received recent ShareFile uploads from my different clients, but Meredith Griffeth from Supreme Lending uploaded a file from Aimee Vo to me twice and I haven’t received it. I normally get an email alerting me - I haven’t received those. I went out to the ShareFile in Okta and looked there - they aren’t there either… Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Just at a dead end with saving and loading models as if you were taking them to production.