Advertisement
Guest User

Untitled

a guest
May 12th, 2019
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.21 KB | None | 0 0
  1. builtins.ValueError
  2.  
  3. ValueError: Found array with 0 sample(s) (shape=(0, 4)) while a minimum of 1 is required.
  4.  
  5. Traceback (most recent call last)
  6.  
  7. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2309, in __call__
  8.  
  9.  
  10.     def __call__(self, environ, start_response):
  11.         """The WSGI server calls the Flask application object as the
  12.        WSGI application. This calls :meth:`wsgi_app` which can be
  13.        wrapped to applying middleware."""
  14.         return self.wsgi_app(environ, start_response)
  15.  
  16.     def __repr__(self):
  17.         return '<%s %r>' % (
  18.             self.__class__.__name__,
  19.             self.name,
  20. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2295, in wsgi_app
  21.  
  22.             try:
  23.                 ctx.push()
  24.                 response = self.full_dispatch_request()
  25.             except Exception as e:
  26.                 error = e
  27.                 response = self.handle_exception(e)
  28.             except:
  29.                 error = sys.exc_info()[1]
  30.                 raise
  31.             return response(environ, start_response)
  32.         finally:
  33. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1741, in handle_exception
  34.  
  35.             # if we want to repropagate the exception, we can attempt to
  36.             # raise it with the whole traceback in case we can do that
  37.             # (the function was actually called from the except part)
  38.             # otherwise, we just raise the error again
  39.             if exc_value is e:
  40.                 reraise(exc_type, exc_value, tb)
  41.             else:
  42.                 raise e
  43.  
  44.         self.log_exception((exc_type, exc_value, tb))
  45.         if handler is None:
  46. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
  47.  
  48.     from io import StringIO
  49.  
  50.     def reraise(tp, value, tb=None):
  51.         if value.__traceback__ is not tb:
  52.             raise value.with_traceback(tb)
  53.         raise value
  54.  
  55.     implements_to_string = _identity
  56.  
  57. else:
  58.     text_type = unicode
  59. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2292, in wsgi_app
  60.  
  61.         ctx = self.request_context(environ)
  62.         error = None
  63.         try:
  64.             try:
  65.                 ctx.push()
  66.                 response = self.full_dispatch_request()
  67.             except Exception as e:
  68.                 error = e
  69.                 response = self.handle_exception(e)
  70.             except:
  71.                 error = sys.exc_info()[1]
  72. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
  73.  
  74.             request_started.send(self)
  75.             rv = self.preprocess_request()
  76.             if rv is None:
  77.                 rv = self.dispatch_request()
  78.         except Exception as e:
  79.             rv = self.handle_user_exception(e)
  80.         return self.finalize_request(rv)
  81.  
  82.     def finalize_request(self, rv, from_error_handler=False):
  83.         """Given the return value from a view function this finalizes
  84.        the request by converting it into a response and invoking the
  85. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
  86.  
  87.            return self.handle_http_exception(e)
  88.  
  89.        handler = self._find_error_handler(e)
  90.  
  91.        if handler is None:
  92.            reraise(exc_type, exc_value, tb)
  93.        return handler(e)
  94.  
  95.    def handle_exception(self, e):
  96.        """Default exception handling that kicks in when an exception
  97.         occurs that is not caught.  In debug mode the exception will
  98. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
  99.  
  100.     from io import StringIO
  101.  
  102.     def reraise(tp, value, tb=None):
  103.         if value.__traceback__ is not tb:
  104.             raise value.with_traceback(tb)
  105.         raise value
  106.  
  107.     implements_to_string = _identity
  108.  
  109. else:
  110.     text_type = unicode
  111. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
  112.  
  113.         self.try_trigger_before_first_request_functions()
  114.         try:
  115.             request_started.send(self)
  116.             rv = self.preprocess_request()
  117.             if rv is None:
  118.                 rv = self.dispatch_request()
  119.         except Exception as e:
  120.             rv = self.handle_user_exception(e)
  121.         return self.finalize_request(rv)
  122.  
  123.     def finalize_request(self, rv, from_error_handler=False):
  124. File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1799, in dispatch_request
  125.  
  126.         # request came with the OPTIONS method, reply automatically
  127.         if getattr(rule, 'provide_automatic_options', False) \
  128.            and req.method == 'OPTIONS':
  129.             return self.make_default_options_response()
  130.         # otherwise dispatch to the handler for that endpoint
  131.         return self.view_functions[rule.endpoint](**req.view_args)
  132.  
  133.     def full_dispatch_request(self):
  134.         """Dispatches the request and on top of that performs request
  135.        pre and postprocessing as well as HTTP exception catching and
  136.        error handling.
  137. File "C:\Users\Tomasz\Desktop\CreditMe\AssessingService.py", line 14, in predict
  138.  
  139. def predict():
  140.    json_ = request.json
  141.    query = pd.DataFrame(json_)
  142.    query = query.reindex(columns=model_columns)
  143.    print(query)
  144.    prediction = list(lr.predict(query))
  145.    return jsonify({'prediction': str(prediction)})
  146.  
  147. port=33333
  148. lr = joblib.load("PickledModel.pkl")
  149. model_columns = joblib.load("PickledModelColumns.pkl")
  150. File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\linear_model\base.py", line 281, in predict
  151.  
  152.        Returns
  153.        -------
  154.        C : array, shape [n_samples]
  155.            Predicted class label per sample.
  156.        """
  157.         scores = self.decision_function(X)
  158.         if len(scores.shape) == 1:
  159.             indices = (scores > 0).astype(np.int)
  160.         else:
  161.             indices = scores.argmax(axis=1)
  162.         return self.classes_[indices]
  163. File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\linear_model\base.py", line 257, in decision_function
  164.  
  165.         """
  166.        if not hasattr(self, 'coef_') or self.coef_ is None:
  167.            raise NotFittedError("This %(name)s instance is not fitted "
  168.                                 "yet" % {'name': type(self).__name__})
  169.  
  170.        X = check_array(X, accept_sparse='csr')
  171.  
  172.        n_features = self.coef_.shape[1]
  173.        if X.shape[1] != n_features:
  174.            raise ValueError("X has %d features per sample; expecting %d"
  175.                             % (X.shape[1], n_features))
  176. File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py", line 582, in check_array
  177.  
  178.        n_samples = _num_samples(array)
  179.        if n_samples < ensure_min_samples:
  180.            raise ValueError("Found array with %d sample(s) (shape=%s) while a"
  181.                             " minimum of %d is required%s."
  182.                             % (n_samples, shape_repr, ensure_min_samples,
  183.                                context))
  184.  
  185.    if ensure_min_features > 0 and array.ndim == 2:
  186.        n_features = array.shape[1]
  187.        if n_features < ensure_min_features:
  188.            raise ValueError("Found array with %d feature(s) (shape=%s) while"
  189. 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