Managing model signatures and schemas
An important feature of MLflow is to provide an abstraction for input and output schemas of models and the ability to validate model data during prediction and training.
MLflow throws an error if your input does not match the schema and signature of the model during prediction:
- We will next look at a code listing of a simple model of digit classification (the details of the dataset are available here: https://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+Digits). The following code flattens the image into a pandas DataFrame and fits a model to the dataset:
from sklearn import datasets, svm, metrics from sklearn.model_selection import train_test_split import mlflow digits = datasets.load_digits() n_samples = len(digits.images) data = digits.images.reshape((n_samples, -1)) clf = svm.SVC(gamma=0.001) X_train, X_test, y_train, y_test = train_test_split( data, digits.target, test_size=0.5, shuffle...