Skip to main content

Truefoundry's Experiment Tracking, Model Registry and Model Monitoring Library

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

MlFoundry

This guide is to give an idea of how you can log metrics, paramaters, predictions, models, dataset using MlFoundry. MlFoundry supports logging above mentioned logs to S3 asynchronously.

API Workflow:

Using mlfoundry you ca create multiple projects and each projects can have multiple run.

Example

  1. Project 1
    • run 1
    • run 2
  2. Project 2
    • run 1
    • run 2
    • run 3
    • run 4

Each run under each project will have a unique run_id.

Quickstart

1. Install mlfoundry

# Install via pip
pip install mlfoundry --extra-index-url https://api.packagr.app/public

2. Setup AWS credentials

To setup AWS credentials MlLogs_foundry's CLI can be used. AWS credentials are required to store the artifacts like model, dataset, whylogs_metrics etc in S3 Bucket.

The CLI requires AWS credentials(SECRET_ACCESS_KEY, ACCESS_KEY_ID)

All the credentials can be set by running:

mlfoundry init

3. Initialise mlfoundry

Create an project and use the project_name to create a run:

 import mlfoundry as mlf

 # create a run
 mlf_run = mlf.create_run(project_name=<project-name>)

If you want to use a previously created run:

# printing all the runs available and get the run_id
show_all_runs()

run = get_run(run_id=<run_id>)

4. Start logging

To log a model:

run.log_model(sklearn_model, framework=mlf.ModelFramework.SKLEARN)

To log parameters:

run.log_params({'learning_rate':0.01,
                  'n_epochs:10'
                  })

To log metrics:

run.log_metrics({'accuracy':87,
                  'f1_score':0.84,
                  })

Log predictions synchronously:

feature_df: a pd.DataFrame, the input given to the model to make predictions

predictions: must be a list or pd.Series

To log predictions synchronously:

run.log_predictions(self, feature_df, predictions)

To log predictions asynchronously:

responses = run.log_predictions_async(self, feature_df, predictions)

#### To confirm that the log request completed successfully, await for futures to resolve: This is a blocking call
import concurrent.futures as cf
for response in cf.as_completed(responses):
  res = response.result()

Users can additionaly pass in feature_names argument which is a list of feture names for feature_df.

To release as Python package

Use Github Releases to create a tag on main and release it. This will trigger the workflow and publish the pip package

Tags must be of format vx.x.x, example v0.1.0

Development instructions

git clone https://github.com/truefoundry/mlfoundry.git
cd mlfoundry
virtualenv venv
source venv/bin/activate
pip install poetry==1.4.2
poetry install
pre-commit install

Run Manual QA

git clone https://github.com/truefoundry/mlf-test
cd mlf-test
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
cd mlf_examples
python main.py  In-this-step-check-for-error-logs
mlfoundry ui  In-this-step-go-to-the-listed-url-and-play-around-with-the-ui

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

mlfoundry-0.10.6rc1.tar.gz (96.4 kB view details)

Uploaded Source

Built Distribution

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

mlfoundry-0.10.6rc1-py3-none-any.whl (130.7 kB view details)

Uploaded Python 3

File details

Details for the file mlfoundry-0.10.6rc1.tar.gz.

File metadata

  • Download URL: mlfoundry-0.10.6rc1.tar.gz
  • Upload date:
  • Size: 96.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for mlfoundry-0.10.6rc1.tar.gz
Algorithm Hash digest
SHA256 871bc21af8c8e7b33c941272deda782f6836edafd5aaac17ec2e24bdb8b91932
MD5 90d5d8cb2f78efe3e8bc399773d8eca7
BLAKE2b-256 19a2e64b32973d940ca6fb5c8a9b85cc5880a56d321cc19da1c73a8fbb4b4c66

See more details on using hashes here.

File details

Details for the file mlfoundry-0.10.6rc1-py3-none-any.whl.

File metadata

  • Download URL: mlfoundry-0.10.6rc1-py3-none-any.whl
  • Upload date:
  • Size: 130.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for mlfoundry-0.10.6rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 2826dbe28e33840befc3e6e59ea40b9b9f9b52bb5cf8ff740d98965627ef193f
MD5 17fc52de26cf3bf4da941e1dff5dceea
BLAKE2b-256 9daa05093be2c82da3528a93381bd49e0cf3ef13034a7f7764054c3352110709

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