Simple Voter Class Error - TypeError: Cannot cast array data from dtype('O') to dtype('int64') according to the rule 'safe'

See original GitHub issue

After creating a pipeline with my best models and including the feature-transformer I used to create the training data… I get the following error:

TypeError: Cannot cast array data from dtype(‘O’) to dtype(‘int64’) according to the rule ‘safe’

My feature pipeline makes use of StandardScaler, OneHotEncoder, HashingVectorizer and uses make_column_transformer to make a Pandas column transformer.

ensemble_pipeline = make_pipeline(
    feature_pipeline,
    SimpleVoter(
    best_models, 
    classes=best_models[0][1].classes_, voting="hard"
    ),
)

Any idea the reason behind this error?

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
denver1117commented, Oct 9, 2019

This has been addressed by this PR: https://github.com/Ibotta/sk-dist/pull/28 and is now reflected in version 0.1.5.

Thanks for the bug report.

1reaction
denver1117commented, Oct 8, 2019

Thanks. This looks like a bug in sk-dist. I’ll work on a fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot cast array data from dtype('float64') to ... - Stack Overflow
I think with voting='hard' it expects integer labels from all models, but gets some float values from regressors.
Read more >
Cannot cast array data from dtype('float64') to ... - appsloveworld
Try to use parameter voting='soft' for VotingClassifier. I think with voting='hard' it expects integer labels from all models, but gets some float values...
Read more >
Cannot cast array data from dtype('float32') to dtype('int64 ...
It's a type cast error at this line: tmp[negdx] = np.bincount(tmp[np.where(tmp<len( clsAttributes)-1)].ravel()).argmax().
Read more >
pandas: Cast DataFrame to a specific dtype with astype()
pandas.Series has one data type dtype and pandas.DataFrame has a different data type dtype for each column. You can specify dtype when ...
Read more >
Change data type of given numpy array - GeeksforGeeks
Problem #1 : Given a numpy array whose underlying data is of 'int32' type. Change the dtype ...
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