question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: cannot perform reduce with flexible type OR AttributeError: 'Predictor' object has no attribute 'grid_search_pipelines'

See original GitHub issue

Very cool package!

I am trying out auto_ml with this dataset on SMS spam. I added a header row to the file to give it column names and then do the following:

import pandas as p  
import dill  
from sklearn.model_selection import train_test_split   
from auto_ml import Predictor 

df = p.read_table('/home/data/auto_ml/sms.txt')
df_train, df_test = train_test_split(df, test_size=0.5, random_state=42)
column_descriptions = {
  'spam': 'output'
  , 'text': 'nlp'
}

ml_predictor = Predictor(type_of_estimator='classifier', column_descriptions=column_descriptions)
ml_predictor.train(df_train)

You can see it sort of works because it is telling me about feature importance but then gives :

… nlp_text_txt: 0.0373 nlp_text_free: 0.0441 Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/usr/local/lib/python2.7/dist-packages/auto_ml/predictor.py”, line 597, in train if len(self.grid_search_pipelines) > 1: AttributeError: ‘Predictor’ object has no attribute ‘grid_search_pipelines’

Originally I was trying: ml_predictor.train(df_train,ml_for_analytics=True)

and got:

test_score = ml_predictor.score(df_test, df_test.spam) Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/usr/local/lib/python2.7/dist-packages/auto_ml/predictor.py”, line 1014, in score score, probas = self._scorer.score(self.trained_pipeline, X_test, y_test, advanced_scoring=advanced_scoring) File “/usr/local/lib/python2.7/dist-packages/auto_ml/utils_scoring.py”, line 268, in score score = self.scoring_func(y, predictions) File “/usr/local/lib/python2.7/dist-packages/sklearn/metrics/classification.py”, line 1884, in brier_score_loss pos_label = y_true.max() File “/usr/local/lib/python2.7/dist-packages/numpy/core/_methods.py”, line 26, in _amax return umr_maximum(a, axis, None, out, keepdims) TypeError: cannot perform reduce with flexible type

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
calz1commented, Mar 12, 2017

No need to apologize, the idea is a cool one and you’re doing the community a great service by looking into issues so quick.

I was using:

auto-ml==1.9.7 xgboost==0.6a2

and upgrading auto_ml fixed it! I will continue experimenting…

0reactions
ClimbsRockscommented, Mar 12, 2017

yay!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: cannot perform reduce with flexible type
My best advice facing that error. Typically you have to check the type compatibility of your data. Take few minutes ...
Read more >
How to Fix: TypeError: cannot perform reduce with flexible type
This error occurs when you attempt to perform some calculation on an object in Python that is not numeric. The following example shows...
Read more >
How to Fix: TypeError: cannot perform reduce with flexible type
To overcome this problem create a 2D array using Pandas DataFrame instead of NumPy. Since DataFrame has an index value for each row...
Read more >
ma.median: cannot perform reduce with flexible type #5424
Strangely enough, when I do a clean install of 1.9.1 on a machine running Ubuntu 12.04, i continue to have the same problem....
Read more >
PYTHON : TypeError: cannot perform reduce with flexible type
PYTHON : TypeError : cannot perform reduce with flexible type [ Gift : Animated Search Engine : https://www.hows.tech/p/recommended.html ] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found