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.

Provide wrappers for popular ML libraries

See original GitHub issue

It’d be convenient to provide support for use of Keras or PyTorch models in model selection. There are two issues:

  1. Keras/PyTorch models don’t conform to the Scikit-learn API.
  2. Keras models are not pickle-able.

I’m imaging this interface:

from torchvision.models import resnet18
import torch.optim as optim
from dask_ml.wrappers import PyTorchClassifier

pytorch_model = resnet18()
sklearn_model = SkorchClassifier(
    model=pytorch_model,
    model__alpha=1e-2,  # if resnet18 had a kwarg `alpha`
    optimizer=optim.SGD,
    optimizer__lr=0.1,
)

Related issues/PRs Same complaint in dask/distributed: https://github.com/dask/distributed/issues/3873

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
stsievertcommented, Jul 13, 2020

How difficult would it be to implement pickling … for Keras as well?

SciKeras has an implementation at scikeras/wrappers.py#L87. There’s currently an open PR to merge this into Tensorflow/Keras master: https://github.com/tensorflow/tensorflow/pull/39609

Does that answer your question?

1reaction
adriangbcommented, Jul 13, 2020

If you’re looking for a way to make Keras models conform to the scikit-learn API, check out SciKeras (full disclosure: I’m the author)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Python libraries for Machine Learning - GeeksforGeeks
Numpy; Scipy; Scikit-learn; Theano; TensorFlow; Keras; PyTorch; Pandas; Matplotlib. Numpy. NumPy is a very popular python library for ...
Read more >
Top 10 Python Packages for Machine Learning - ActiveState
#2 Pytorch​​ PyTorch is a popular ML library for Python based on Torch, which is an ML library implemented in C and wrapped...
Read more >
Top Python Libraries For Data Science And Machine Learning
Here's a list of the top Python libraries for Machine Learning: ... Provides I/O wrappers and readers that can import and support a...
Read more >
Top Python Machine Learning Libraries for 2022 - Simplilearn
Nolearn features a collection of abstractions and wrappers around existing neural network libraries, such as Lasagne (a lightweight library ...
Read more >
25 Most Popular Python Libraries for Machine Learning in 2019
Explore the top 25 python libraries for machine learning. ... It provides wrappers around different libraries like scikit-learn, xgboost, ...
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