Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

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.8.0,<2.0.0"
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

Release files for mlfoundry 0.11.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlfoundry 0.11.5
File Size Uploaded
mlfoundry-0.11.5.tar.gz 94.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mlfoundry 0.11.5
File Interpreter ABI Platform
mlfoundry-0.11.5-py3-none-any.whl Python 3 none any Details

Total release size: 217.8 kB

Release files / mlfoundry-0.11.5.tar.gz

Download URL mlfoundry-0.11.5.tar.gz
Size 94.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0da5061b79d4707107ec1fe56996dbc424b329b5340408bb53db755eace7752f
BLAKE2b-256 checksum
How to use checksums
5dc22fd11b5533068347e1eb5e12945c3f618987963a42a917e092e19d0cd590
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / mlfoundry-0.11.5-py3-none-any.whl

Download URL mlfoundry-0.11.5-py3-none-any.whl
Size 123.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
91d7b666e16cf640bc8d76cedca3ebdad2a62b46f095f918ff4b797e177f3b6a
BLAKE2b-256 checksum
How to use checksums
325aca8c05e8ada49425ae31cdd3d5f6c592a93d5bf3069c450fdad7074a5d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.11.5 This release

2 release files

0.7.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page