Simple Voter Class Error - TypeError: Cannot cast array data from dtype('O') to dtype('int64') according to the rule 'safe'
See original GitHub issueAfter 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:
- Created 4 years ago
- Comments:5
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
Thanks. This looks like a bug in
sk-dist. I’ll work on a fix.