Skip to content

AttributeError: 'LeastSquaresError' object has no attribute 'get_init_raw_predictions' #6

Description

@rb-mwindh

I had some issues getting started with this repo, a hint on which python version to use would have been helpful.
FYI: when I first got started with this repo, I was using Python v3.8, which resulted in installation errors. After downgrading to Python v3.6.15, make install and python app.py run smoothly.

However, when executing ./make_predict.sh, I get the the following error message:

Traceback (most recent call last):
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/testuser/.py36/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/testuser/xpand/flask-ml-azure-serverless/app.py", line 68, in predict
    prediction = list(clf.predict(scaled_payload))
  File "/home/testuser/.py36/lib/python3.6/site-packages/sklearn/ensemble/_gb.py", line 2569, in predict
    return self._raw_predict(X).ravel()
  File "/home/testuser/.py36/lib/python3.6/site-packages/sklearn/ensemble/_gb.py", line 1655, in _raw_predict
    raw_predictions = self._raw_predict_init(X)
  File "/home/testuser/.py36/lib/python3.6/site-packages/sklearn/ensemble/_gb.py", line 1649, in _raw_predict_init
    raw_predictions = self.loss_.get_init_raw_predictions(
AttributeError: 'LeastSquaresError' object has no attribute 'get_init_raw_predictions'

I assume, this is due to some version conflict between the serialized prediction model from boston_housing_prediction.joblib and the version of scikit-learn.

I'm using an umodified version of requirements.txt.

Output of $ pip freeze:

astroid==2.4.2
click==8.0.4
dataclasses==0.8
Flask==1.0.2
importlib-metadata==4.8.3
isort==5.10.1
itsdangerous==2.0.1
Jinja2==3.0.3
joblib==1.1.1
lazy-object-proxy==1.4.3
MarkupSafe==2.0.1
mccabe==0.6.1
numpy==1.19.5
pandas==1.1.5
pylint==2.6.2
python-dateutil==2.8.2
pytz==2022.6
scikit-learn==0.22.2
scipy==1.5.4
six==1.16.0
toml==0.10.2
typed-ast==1.4.3
typing_extensions==4.1.1
Werkzeug==2.0.3
wrapt==1.14.1
zipp==3.6.0

Can you please help me resolving this issue as I'm unable to continue my training without this...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions