-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required by MinMaxScaler. #7
Comments
Facing the same issue have you found a work around please |
Make sure you download all the data from 1962 from the Yahoo page (set filter to Max & click Apply), otherwise the smoothing window goes over bounds. The default download is only 20 records. |
I cant understand this error and i also want a solution. Someone please explain !! |
I am getting the same error, any solution? |
I want to build a flask API that connects to a Flutter mobile application, bellow is the code of the flask api; app = Flask(name) Load the modelmodel = pickle.load(open('similarity1.pkl', 'rb')) Load the attractions and preferences dataattractions = pd.read_csv(r"C:\Users\Bogere\OneDrive\Desktop\Tourism\tourism_attractions.csv") Normalize the documentsnltk.download('stopwords') norm_corpus_attractions = attractions['experience_tags'].apply(normalize_document) Compute the cosine similarity scorestfidf_vectorizer = TfidfVectorizer(ngram_range=(1, 2), min_df=1) @app.route('/', methods=['GET'])
if name == 'main': |
Trying to train the scalar with training data and smooth data:
smoothing_window_size = 2500
for di in range(0,10000,smoothing_window_size):
scaler.fit(train_data[di:di+smoothing_window_size,:])
train_data[di:di+smoothing_window_size,:] = scaler.transform(train_data[di:di+smoothing_window_size,:])
I get this error:
ValueError Traceback (most recent call last)
in
2 smoothing_window_size = 2500
3 for di in range(0,10000,smoothing_window_size):
----> 4 scaler.fit(train_data[di:di+smoothing_window_size,:])
5 train_data[di:di+smoothing_window_size,:] = scaler.transform(train_data[di:di+smoothing_window_size,:])
~\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in fit(self, X, y)
306 # Reset internal state before fitting
307 self._reset()
--> 308 return self.partial_fit(X, y)
309
310 def partial_fit(self, X, y=None):
~\Anaconda3\lib\site-packages\sklearn\preprocessing\data.py in partial_fit(self, X, y)
332
333 X = check_array(X, copy=self.copy, warn_on_dtype=True,
--> 334 estimator=self, dtype=FLOAT_DTYPES)
335
336 data_min = np.min(X, axis=0)
~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
460 " minimum of %d is required%s."
461 % (n_samples, shape_repr, ensure_min_samples,
--> 462 context))
463
464 if ensure_min_features > 0 and array.ndim == 2:
ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required by MinMaxScaler.
Apologies if I'm missing something glaringly obvious but I'm at a loss.
The text was updated successfully, but these errors were encountered: