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.
Metadata
Release files for mlflow-xgboost-proba 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mlflow_xgboost_proba-0.3.1.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlflow_xgboost_proba-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.3 kB
Release files / mlflow_xgboost_proba-0.3.1.tar.gz
| Download URL | mlflow_xgboost_proba-0.3.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa327ea039fae914d3414ec1377ee44b835bf3e7da87516efa2409675fed7fe1
|
|
BLAKE2b-256 checksum How to use checksums |
433c2a5c8e9f911117dfbc378ff1819ef6d008f798a694d990700a7e8a7d2cb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1022-azure
|
Release files / mlflow_xgboost_proba-0.3.1-py3-none-any.whl
| Download URL | mlflow_xgboost_proba-0.3.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45ad4da70b302d2760ec538bfe77c09acef553afa80711f8e293f11c41dc5226
|
|
BLAKE2b-256 checksum How to use checksums |
0f0a79c2df858b77557a82d3b143347a21bd2ca1b6e315fd5a13e0fd24d5e210
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1022-azure
|