cog-imperial / OMLT

Represent trained machine learning models as Pyomo optimization formulations
Other
273 stars 58 forks source link

Support for sci-kit learn neural networks #5

Open jalving opened 3 years ago

jalving commented 3 years ago

Is there interest in adding other readers in addition to ONNX? I have a working sci-kit learn neural network reader.

fracek commented 3 years ago

At the moment with ONNX we can support keras, tensorflow, and pytorch. Scikit has an ONNX exporter but I'm not sure how it works with neural networks.

joshuahaddad commented 2 years ago

@jalving do you still have interest in this? I saw there’s a package sklearn2onnx so I could work on building this out. Alternatively since the package exists we could just have the user do the conversion?

jalving commented 2 years ago

I think we should at least test out the converter and make sure that onnx model imports into OMLT. I think we should also add links to the ONNX converters for various ML platforms. Once we do that, we should discuss a direct interface to sci-kt learn. It's another interface to support, but it might be worthwhile.

joshuahaddad commented 2 years ago

I was curious so I messed around a bit with it today in between classes. I also wrote some code to convert sklearn scalers into OMLT scaling objects. It’s on my fork here https://github.com/joshuahaddad/OMLT/blob/sklearn-reader/src/omlt/io/sklearn-reader.py.

We should definitely talk about the specifics of the interface. I’d be interested in seeing some of the sklearn models Carl had if they’re not proprietary.

jalving commented 2 years ago

This is pretty cool. Going through ONNX is a good way to support sklearn models. I have a sklearn model that is not proprietary. I will send it your way.