[ML]
Machine Learning for Machine Learning
2
Achieving ML interoperability via Deep Learning
Let us dope it
The long, tedious road to ML deployment
Product
Manager
Data Scientist
Software Engineers
Dev Ops
App
Requirements & Metrics
PoC Modeling
[R,Python]
Production code
Would’ve been better if
Product
Manager
Data Scientist
Software Engineers
Dev Ops
App
Requirements & Metrics
PoC Modeling
[R,Python]
Production code
But
Interoperability, the saviour
What is Machine Learning (ML) interoperability?
Why is it the saviour?
What are we hoping for?
Let us recall what JAVA has done to IT Industry at large -- same piece of code can run anywhere -- regardless of the host operating system. Can we do the same for ML. Is there a JAR file and JVM equivalent for ML?
What is the current landscape
dope’s approach is to fulfill an intent specified (in any framework), via any Deep Learning backend
The Design tenets
Modular
The very nature of neural network models is - they are extremely modular. In essence, it is this quality of neural network models that enables IMLY to accomplish the intent of a standard ML model using a neural network model.
For example, IMLY can convert a logistic regression, linear regression or lasso regression model without having to cause much changes to the core architecture of the neural network model it relies on.
This further enhances the ease of contributing more models and their corresponding mappings.
Zero learning curve: Just add one line of code to your existing workflow
The entire API collection of “dope” resembles that of scikit learn (any reference API) APIs. Except for one line of code(which connects the standard ML model’s intent to IMLY), the user experience is in coherence with that of Scikit-learn.
Scalable: Deep Learning scales from CPUs to TPUs
Software 2.0: “dope” is a semantic map between the target APIs and the backend Deep Learning Implementation
Implementation details
Primal Model
Dope’d Model
dope’d
Dope
Optimizer
Adapter
Implementation details
Primal model (API Spec)
Implementation details
Fulfillment via Deep Learning Models
Implementation details
Dope’d model
Add just 1 line of code
>>> from mlsquare.imly import dope
>>> from sklearn.linear_model import LinearRegression
>>> from sklearn.preprocessing import StandardScaler
>>> from sklearn.model_selection import train_test_split
>>> import pandas as pd
>>> from sklearn.datasets import load_diabetes
>>> model = LinearRegression()
>>> diabetes = load_diabetes()
>>> X = diabetes.data
>>> sc = StandardScaler()
>>> X = sc.fit_transform(X)
>>> Y = diabetes.target
>>> x_train, x_test, y_train, y_test =
train_test_split(X, Y, test_size=0.60, random_state=0)
>>> m = dope(model)
>>> # All sklearn operations can be performed on m, except that the underlying implementation uses DNN
>>> m.fit(x_train, y_train)
>>> m.score(x_test, y_test)
Discussion
No Free lunch theorem:
DOPE provides a semantic map to transpile an API in the target framework to its Deep Learning counterpart. It tries hard to retain the “intent” as much as possible but is not guaranteed, and not every time, there can be a one-to-one correspondence between target API parameter or specification to its Deep Learning counterpart.
However, it can be handle case by case basis and is an excellent research direction to work on
Demo
Roadmap
Contribute
Currently, we support many sklearn APIs.
But our goal is to map entire sklearn APIs, and extend the toolset to include other popular libraries in Python (such as XGBoost, Surpiselib for Recommendation Engines etc..)
We also are contributing new Keras Layers such as a Decision Tree layer, which we believe is a great new lego block in the Deep Leaning ecosystem, and waiting to see its wide range of applications.
If you are passionate about Scientific Computing in general, and Deep Learning in particular,
come - join the mission. checkout mlsquare.org for other interesting projects