TypeError: 'float' object is not subscriptable

Open
#767 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, scikit-learn

Research direction

Start with train_real_estate_model.py at line 102 and follow serialization into mleap/sklearn/base.py, especially line 64 where intercept_ is indexed. Reproduce the pipeline serialization and determine how the scalar intercept is represented; done means the reported TypeError no longer occurs and the pipeline serializes successfully.

Written by the indexing model from the issue text.

Description

I am buliding a Linear Regression model pipeline. While serializing the pipeline I am getting the following error.
Traceback (most recent call last): File "train_real_estate_model.py", line 102, in <module> init = True File "/Users/atharva.muley/opt/miniconda3/envs/ds-stg/lib/python3.7/site-packages/mleap/sklearn/pipeline.py", line 29, in serialize_to_bundle serializer.serialize_to_bundle(self, path, model_name, init) File "/Users/atharva.muley/opt/miniconda3/envs/ds-stg/lib/python3.7/site-packages/mleap/sklearn/pipeline.py", line 107, in serialize_to_bundle step_i.serialize_to_bundle(bundle_dir, step_i.name) File "/Users/atharva.muley/opt/miniconda3/envs/ds-stg/lib/python3.7/site-packages/mleap/sklearn/base.py", line 27, in serialize_to_bundle return serializer.serialize_to_bundle(self, path, model_name) File "/Users/atharva.muley/opt/miniconda3/envs/ds-stg/lib/python3.7/site-packages/mleap/sklearn/base.py", line 64, in serialize_to_bundle attributes.append(('intercept', transformer.intercept_.tolist()[0])) TypeError: 'float' object is not subscriptable

Does someone know how to fix this?
Thank you!

Dominant language
Scala
Stars
1.5k
Forks
313
Avg merge
22m
Merged PRs (30d)
1

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from combust/mleap

All issues in combust/mleap

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.