MLflow XGBoost flavour with probabilities
Project description
mlflow-xgboost-proba
MLflow XGBoost flavour with probabilities
This package implements mlflow_xgboost_proba
MLflow flavour, which allows to run predict_proba
method of xgboost
models during inference with MLflow mlflow models serve
CLI command.
Implementation is based on mlflow.xgboost module, which is copied and modified to have the wrapper with predict_proba
method and predict
method calling predict_proba
by default.
The API of the module is identical to mlflow.xgboost, only without support of autologging.
- Github repository: https://github.com/sergray/mlflow-xgboost-proba/
Usage
Install package with pip install mlflow-xgboost-proba
.
Prepare XGBoost model and save as MLflow model:
from xgboost import XGBClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import mlflow_xgboost_proba
# Prepare training dataset
data = load_iris()
X_train, X_test, y_train, y_test = train_test_split(data["data"], data["target"], test_size=0.2)
# Prepare XGBoost model
xgb_model = XGBClassifier(n_estimators=2, max_depth=2, learning_rate=1, objective="binary:logistic")
xgb_model.fit(X_train, y_train)
# Save XGBoost model as MLflow model
mlflow_xgboost_proba.save_model(xgb_model, "mlflow_xgb_iris_classifier")
Run model inference with the probabilities using MLflow:
mlflow models serve --model-uri mlflow_xgb_iris_classifier --env-manager local
Repository initiated with fpgmaas/cookiecutter-poetry.
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
Built Distribution
File details
Details for the file mlflow_xgboost_proba-0.3.1.tar.gz
.
File metadata
- Download URL: mlflow_xgboost_proba-0.3.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa327ea039fae914d3414ec1377ee44b835bf3e7da87516efa2409675fed7fe1 |
|
MD5 | 35a7beee8baca2bd2f5e8365fd860e16 |
|
BLAKE2b-256 | 433c2a5c8e9f911117dfbc378ff1819ef6d008f798a694d990700a7e8a7d2cb4 |
File details
Details for the file mlflow_xgboost_proba-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: mlflow_xgboost_proba-0.3.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45ad4da70b302d2760ec538bfe77c09acef553afa80711f8e293f11c41dc5226 |
|
MD5 | 30995bd1991a0609fb474774aae1787e |
|
BLAKE2b-256 | 0f0a79c2df858b77557a82d3b143347a21bd2ca1b6e315fd5a13e0fd24d5e210 |