No project description provided
Project description
mlflow-toolkit
Getting started
Installation
pip install git+https://github.com/dubovikmaster/mlflow-toolkit.git
Usage
import pandas as pd
import numpy as np
import mlflow
from mlflow_toolkit import MLflowWorker
# set the tracking_uri and experiment name
mlflow.set_tracking_uri('http://localhost:5000') # or your MLflow server URI
mlflow.set_experiment('my-awesome-project')
# init mlflow worker
mlflow_worker = MLflowWorker()
# create some artifacts like yaml, txt, csv, parquet files
features = ['a', 'b', 'c', 'd']
params = {'iterations': 100, 'depth': 5, 'cat_features': ['a', 'b']}
df = pd.DataFrame(np.random.random((100, 4)), columns=features)
with mlflow.start_run() as run:
run_id = run.info.run_id
# log dataframe as csv file
mlflow_worker.log_dataframe(df, 'data/train_data.csv', run_id=run_id, output_file_type='csv')
# log dataframe as parquet file
mlflow_worker.log_dataframe(df, 'data/data.parq', run_id=run_id)
# log features names as text file
mlflow_worker.log_text(run.info.run_id, '\n'.join(features), 'features.txt')
# log model serialized model params
mlflow_worker.log_as_pickle(params, 'params.pkl', run_id=run_id)
# log model params as yaml file
mlflow_worker.log_dict(params, 'params.yml', run_id=run_id)
df_loaded = mlflow_worker.load_dataframe('data/train_data.parq', run_id=run_id)
# check the equals of dataframes
print(df_loaded.equals(df))
>> > True
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
mlflow_toolkit-0.1.0.tar.gz
(11.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlflow_toolkit-0.1.0.tar.gz.
File metadata
- Download URL: mlflow_toolkit-0.1.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c35ef7f866dbdced05d559bdf7f74662fe3c1c34e7076c05ae78433f82ef48e
|
|
| MD5 |
f338928adaa699a95d18eac7dd689c85
|
|
| BLAKE2b-256 |
30e6865b9c8b9bb3e1dc80aad5dbd03675af1943acc23e31b1be1378196be15f
|
File details
Details for the file mlflow_toolkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mlflow_toolkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d71da142259762413d2a2eb8f2114c7d886f00caefea6fae9d377f779b4c4d9
|
|
| MD5 |
d88a0519197d9926b03b46fa0eddb44a
|
|
| BLAKE2b-256 |
bb91c2cc7895023166cef779d18c3fb952eca2b9f93373bc65f3bc3b2883fee3
|