Skip to main content

The easiest way to build and deploy machine learning microservices.

Project description

Union.ai Logo

UnionML

The easiest way to build and deploy machine learning microservices



PyPI version shields.io Documentation Status Python application


UnionML is an open source MLOps framework that aims to reduce the boilerplate and friction that comes with building models and deploying them to production.

You can create UnionML Apps by defining a few core methods that are automatically bundled into ML microservices, starting with model training and offline and online prediction.

Built on top of Flyte, UnionML provides a high-level interface for productionizing your ML models so that you can focus on curating a better dataset and improving your models.

To learn more, check out the 📖 documentation.

Installing

Install using pip:

pip install unionml

A Simple Example

Create a Dataset and Model, which together form a UnionML App:

from unionml import Dataset, Model

from sklearn.linear_model import LogisticRegression

dataset = Dataset(name="digits_dataset", test_size=0.2, shuffle=True, targets=["target"])
model = Model(name="digits_classifier", init=LogisticRegression, dataset=dataset)

Define Dataset and Model methods for training a hand-written digits classifier:

from typing import List

import pandas as pd
from sklearn.datasets import load_digits

@dataset.reader
def reader() -> pd.DataFrame:
    return load_digits(as_frame=True).frame

@model.trainer
def trainer(
    estimator: LogisticRegression,
    features: pd.DataFrame,
    target: pd.DataFrame,
) -> LogisticRegression:
    return estimator.fit(features, target.squeeze())

@model.predictor
def predictor(
    estimator: LogisticRegression,
    features: pd.DataFrame
) -> List[float]:
    return [float(x) for x in estimator.predict(features)]

@model.evaluator
def evaluator(
    estimator: LogisticRegression,
    features: pd.DataFrame,
    target: pd.DataFrame
) -> float:
    return float(accuracy_score(target.squeeze(), predictor(estimator, features)))

And that's all ⭐️!

By defining these four methods, you've created a minimal UnionML App that you can:

Contributing

All contributions are welcome 🤝 ! Check out the contribution guide to learn more about how to contribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unionml-0.0.2.tar.gz (20.9 kB view hashes)

Uploaded Source

Built Distribution

unionml-0.0.2-py3-none-any.whl (25.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page