The easiest way to build and deploy machine learning microservices.
Project description
UnionML
The easiest way to build and deploy machine learning microservices
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:
- Execute locally to debug and iterate on your code.
- Serve Seamlessly with FastAPI for online prediction.
- Deploy on a Flyte Cluster to scale your model training and schedule offline prediction jobs.
Contributing
All contributions are welcome 🤝 ! Check out the contribution guide to learn more about how to contribute.
Gitpod
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file unionml-0.2.1.tar.gz
.
File metadata
- Download URL: unionml-0.2.1.tar.gz
- Upload date:
- Size: 61.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c237a74a0599a98171a49e17ccdb138f6678b8f227d16f0d7eff154abea45d12 |
|
MD5 | 6a5abe3c1c94ebec750ec416c2d5d65c |
|
BLAKE2b-256 | c91d358c7d478d1a30446961126f609b49b2401d118637c57dbb029245c79fac |
File details
Details for the file unionml-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: unionml-0.2.1-py3-none-any.whl
- Upload date:
- Size: 87.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae891baf744b2e4c2aa8445d92121158490a07b868b3e1c7f1033424e14e75bb |
|
MD5 | c3112d94c654605f97023dfc53cd133b |
|
BLAKE2b-256 | 2ffe31ce6b74e41e6335233e8b5acafef2a3d200e13a92513006a7c973e54b74 |