Skip to main content

Union.ai Logo

UnionML

The easiest way to build and deploy machine learning microservices



PyPI - Python Version PyPI version shields.io Documentation Status Build PyPI - Downloads Roadmap OSS Planning


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 conda:

conda install -c conda-forge unionml

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
from sklearn.metrics import accuracy_score

@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.

Gitpod

Open in Gitpod

Metadata

Release files for unionml 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unionml 0.2.1
File Size Uploaded
unionml-0.2.1.tar.gz 61.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unionml 0.2.1
File Interpreter ABI Platform
unionml-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 149.1 kB

Release files / unionml-0.2.1.tar.gz

Download URL unionml-0.2.1.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c237a74a0599a98171a49e17ccdb138f6678b8f227d16f0d7eff154abea45d12
BLAKE2b-256 checksum
How to use checksums
c91d358c7d478d1a30446961126f609b49b2401d118637c57dbb029245c79fac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / unionml-0.2.1-py3-none-any.whl

Download URL unionml-0.2.1-py3-none-any.whl
Size 87.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae891baf744b2e4c2aa8445d92121158490a07b868b3e1c7f1033424e14e75bb
BLAKE2b-256 checksum
How to use checksums
2ffe31ce6b74e41e6335233e8b5acafef2a3d200e13a92513006a7c973e54b74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page