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.

Combine sklearn pipeline with keras or lightgbm

See original GitHub issue

Hello! It’s possible to use pipeline for preparing data and on top of that keras or lightgbm model? It is not clear for me - which convert function I should choose for this operation

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
PatrickSagercommented, Oct 23, 2019

@xadupre: I was also not able to export a pipeline that contains a scikit_learn.KerasClassifier. I’m getting the following error: Unable to find a shape calculator for type ‘<class ‘keras.wrappers.scikit_learn.KerasClassifier’>’. Could you please provide an example or add a statement, that this is the scikit_learn.KerasClassifier is currently not supported.

2reactions
xaduprecommented, Jan 31, 2019

We are currently refactoring onnxmltools and keras converters. The mechanism will be same (you need to register a new converter) but it should be more simple. The custom shape calculator should disappear to be replaced by a version coming from onnxmltools. So this line will remain:

update_registered_converter(LGBMClassifier, ‘LightGbmLGBMClassifier’,
lightgbm_classifier_shape_extractor, convert_lightgbm)

But you won’t have to implement lightgbm_classifier_shape_extractor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using keras models with scikit-learn pipelines - Kaggle
In this code, we will perform cross validation on the Keras model accuracy using the StatifiedKFold method in the sklearn library.
Read more >
Transfer Learning with ONNX
It is not quite easy in this case to mix framework, scikit-learn with pytorch (or skorch), the Keras API for Tensorflow, tf.keras.wrappers.scikit_learn.
Read more >
Gradient Boosting with Scikit-Learn, XGBoost, LightGBM, and ...
Gradient boosting refers to a class of ensemble machine learning algorithms that can be used for classification or regression predictive ...
Read more >
How to build pipeline with grid search cv and early stopping ...
Here is my code. It start with pipeline (standardizing,replace null value,onehotencoding and selectkbest) with lightgbm model to fit my data ...
Read more >
Extracting Feature Importances from Scikit-Learn Pipelines
Scikit-learn pipelines provide a really simple way to chain together the preprocessing steps with the model fitting stages in machine ...
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