Skip to main content

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


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.2.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlflow_toolkit-0.2.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file mlflow_toolkit-0.2.0.tar.gz.

File metadata

  • Download URL: mlflow_toolkit-0.2.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for mlflow_toolkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b298e34d0d403cefca78d8df6948ef1f4fa43496b23b5f03da3aff0bd2a346a8
MD5 a210c83e93656392a7e0fce293069c2e
BLAKE2b-256 5f62b480f452ae4c3a0a684eeb66964217538d4b38dce0acd57c6ee8a15c7db8

See more details on using hashes here.

File details

Details for the file mlflow_toolkit-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mlflow_toolkit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b69955644a2047d74ce8b9603a7cee5903d6ee0e16075a8117edff033fc2aef0
MD5 b343ad370b2a1b7440d286355c22bcf9
BLAKE2b-256 bb2fcb8f2a66562bb8c9bbd76e87917a3ea0f80769b14bdbb82b14d15c0a749e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page