Renku MLS documentation

launch demo docs

Renku-MLS plugin

Renku MLS is a renku plugin for machine learning models. Using Renku MLS one can expose the machine learning models used in renku projects (e.g. hyper-parameters, evaluation metrics etc.).

Start by creating a Renku project, for details see the renku documentation.

Getting started

In the project make sure that the machine learning models (e.g. scikit-learn, keras, xgboost etc) are exported using mlschema-model-converters plugin.

from xgboost import XGBClassifier
from sklearn.metrics import accuracy_score
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from mlsconverters import export

cancer = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(cancer.data, cancer.target, random_state=42)

X_train = cancer.data
y_train = cancer.target

# model creation
model = XGBClassifier()
model.fit(X_train, y_train)

# model eval
y_pred = model.predict(X_test)
acc = accuracy_score(y_test, y_test)

export(model, evaluation_measure=(accuracy_score, acc))

The export function persists the metadata about the model in Renku’s knowledge graph.

CLI Commands

The Renku MLS plugin provides a few convenient CLI commands that query the knowledge graph for machine learning models in a Renku project.

Leaderboard

renku mls leaderboard provides a quick overview of the machine learning models used in the project:

$ renku mls leaderboard

The output of this command is a sorted list of models used and exposed in the project to renku. The list is sorted by descending order of the provided evaluation measure (by default accuracy). Moreover, it will provide information of the type of model that was used as well as the input of those models.

Hyper-Parameters

renku mls params provides the hyper-parameter settings of a specific ML model in the project. If no run-id is provided, hyper-paramaters of all the models in project will be listed.

$ renku mls params

Demo

images/sneak-peak.gif

To try it live, launch a session from an example project on renkulab.io.

Indices and tables