Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- builtins.ValueError
- ValueError: Found array with 0 sample(s) (shape=(0, 4)) while a minimum of 1 is required.
- Traceback (most recent call last)
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2309, in __call__
- def __call__(self, environ, start_response):
- """The WSGI server calls the Flask application object as the
- WSGI application. This calls :meth:`wsgi_app` which can be
- wrapped to applying middleware."""
- return self.wsgi_app(environ, start_response)
- def __repr__(self):
- return '<%s %r>' % (
- self.__class__.__name__,
- self.name,
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2295, in wsgi_app
- try:
- ctx.push()
- response = self.full_dispatch_request()
- except Exception as e:
- error = e
- response = self.handle_exception(e)
- except:
- error = sys.exc_info()[1]
- raise
- return response(environ, start_response)
- finally:
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1741, in handle_exception
- # if we want to repropagate the exception, we can attempt to
- # raise it with the whole traceback in case we can do that
- # (the function was actually called from the except part)
- # otherwise, we just raise the error again
- if exc_value is e:
- reraise(exc_type, exc_value, tb)
- else:
- raise e
- self.log_exception((exc_type, exc_value, tb))
- if handler is None:
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
- from io import StringIO
- def reraise(tp, value, tb=None):
- if value.__traceback__ is not tb:
- raise value.with_traceback(tb)
- raise value
- implements_to_string = _identity
- else:
- text_type = unicode
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2292, in wsgi_app
- ctx = self.request_context(environ)
- error = None
- try:
- try:
- ctx.push()
- response = self.full_dispatch_request()
- except Exception as e:
- error = e
- response = self.handle_exception(e)
- except:
- error = sys.exc_info()[1]
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
- request_started.send(self)
- rv = self.preprocess_request()
- if rv is None:
- rv = self.dispatch_request()
- except Exception as e:
- rv = self.handle_user_exception(e)
- return self.finalize_request(rv)
- def finalize_request(self, rv, from_error_handler=False):
- """Given the return value from a view function this finalizes
- the request by converting it into a response and invoking the
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
- return self.handle_http_exception(e)
- handler = self._find_error_handler(e)
- if handler is None:
- reraise(exc_type, exc_value, tb)
- return handler(e)
- def handle_exception(self, e):
- """Default exception handling that kicks in when an exception
- occurs that is not caught. In debug mode the exception will
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
- from io import StringIO
- def reraise(tp, value, tb=None):
- if value.__traceback__ is not tb:
- raise value.with_traceback(tb)
- raise value
- implements_to_string = _identity
- else:
- text_type = unicode
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
- self.try_trigger_before_first_request_functions()
- try:
- request_started.send(self)
- rv = self.preprocess_request()
- if rv is None:
- rv = self.dispatch_request()
- except Exception as e:
- rv = self.handle_user_exception(e)
- return self.finalize_request(rv)
- def finalize_request(self, rv, from_error_handler=False):
- File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1799, in dispatch_request
- # request came with the OPTIONS method, reply automatically
- if getattr(rule, 'provide_automatic_options', False) \
- and req.method == 'OPTIONS':
- return self.make_default_options_response()
- # otherwise dispatch to the handler for that endpoint
- return self.view_functions[rule.endpoint](**req.view_args)
- def full_dispatch_request(self):
- """Dispatches the request and on top of that performs request
- pre and postprocessing as well as HTTP exception catching and
- error handling.
- File "C:\Users\Tomasz\Desktop\CreditMe\AssessingService.py", line 14, in predict
- def predict():
- json_ = request.json
- query = pd.DataFrame(json_)
- query = query.reindex(columns=model_columns)
- print(query)
- prediction = list(lr.predict(query))
- return jsonify({'prediction': str(prediction)})
- port=33333
- lr = joblib.load("PickledModel.pkl")
- model_columns = joblib.load("PickledModelColumns.pkl")
- File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\linear_model\base.py", line 281, in predict
- Returns
- -------
- C : array, shape [n_samples]
- Predicted class label per sample.
- """
- scores = self.decision_function(X)
- if len(scores.shape) == 1:
- indices = (scores > 0).astype(np.int)
- else:
- indices = scores.argmax(axis=1)
- return self.classes_[indices]
- File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\linear_model\base.py", line 257, in decision_function
- """
- if not hasattr(self, 'coef_') or self.coef_ is None:
- raise NotFittedError("This %(name)s instance is not fitted "
- "yet" % {'name': type(self).__name__})
- X = check_array(X, accept_sparse='csr')
- n_features = self.coef_.shape[1]
- if X.shape[1] != n_features:
- raise ValueError("X has %d features per sample; expecting %d"
- % (X.shape[1], n_features))
- File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 582, in check_array
- n_samples = _num_samples(array)
- if n_samples < ensure_min_samples:
- raise ValueError("Found array with %d sample(s) (shape=%s) while a"
- " minimum of %d is required%s."
- % (n_samples, shape_repr, ensure_min_samples,
- context))
- if ensure_min_features > 0 and array.ndim == 2:
- n_features = array.shape[1]
- if n_features < ensure_min_features:
- raise ValueError("Found array with %d feature(s) (shape=%s) while"
- ValueError: Found array with 0 sample(s) (shape=(0, 4)) while a minimum of 1 is required.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement