Skip to main content

Monitor ML models in production

Project description

Mltrics

Official command line utility to use Mltrics API programmatically.

We help businesses evaluate, compare, and monitor machine learning models in production. Therefore, identify failure cases and take action immediately.

Installation

Mltrics and its required dependencies can be installed using pip:

pip install mltrics

Usage

Once mltrics package is installed, check out the following usage documentation:

Authenticate to mltrics platform

from mltrics.mltrics import MltricsClient

import getpass

username = input("Enter username: ")
password = getpass.getpass(prompt='Enter password: ')
client = MltricsClient(username=username, password=password, env="prod")

Update user profile

organization, full_name = "<your-organization-name>", "<Your name>"
client.update_user_profile(organization=organization, full_name=full_name)

Create model and upload predictions

Create a baseline model

baseline_model_id, baseline_model_name = 'nn_iter_10k', 'Neural network (trained for 10K iters)'
baseline_model = client.create_model(baseline_model_id, baseline_model_name)
print(baseline_model)

Update model details

baseline_model_new_name = "Neural network (trained for 20K iters)"
updated_model = client.update_model_details(baseline_model_id, baseline_model_new_name)
print(updated_model)

Get uploaded models

models = client.get_models()
models

Upload predictions for model

baseline_preds = [
     {
      'pred_class': 'dog',
      'label_class': None,
      'model_id': baseline_model_id,
      'image_id': 'img1',
      'image_url': 'https://mltrics.s3.us-west-2.amazonaws.com/datasets/cats_vs_dogs/Cat/10896.jpg',
      'pred_file': None,
      'predictions': {},
     },
]
response = client.upload_model_predictions(baseline_model_id, baseline_preds)
print(response)

See all uploaded predictions

predictions = client.get_model_predictions(baseline_model_id)
predictions

Create candidate model and upload predictions for candidate model

### Create candidate model and upload predictions

candidate_model_id, candidate_model_name = "nn_50k_iter", "Neural Network (50K iter)"
candidate_model = client.create_model(candidate_model_id, candidate_model_name)

candidate_preds = [
     {
      'pred_class': 'cat',
      'label_class': None,
      'model_id': candidate_model_id,
      'image_id': 'img1',
      'image_url': 'https://mltrics.s3.us-west-2.amazonaws.com/datasets/cats_vs_dogs/Cat/10896.jpg',
      'pred_file': None,
      'predictions': {},
     },
]
response = client.upload_model_predictions(candidate_model_id, candidate_preds)
print(response)

Get model comparison between baseline and candidate model

comparison_results = client.compare_model_predictions(baseline_model_id, candidate_model_id)
print(comparison_results)

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

mltrics-0.1.4.tar.gz (11.4 kB view details)

Uploaded Source

File details

Details for the file mltrics-0.1.4.tar.gz.

File metadata

  • Download URL: mltrics-0.1.4.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for mltrics-0.1.4.tar.gz
Algorithm Hash digest
SHA256 778a0b5c2c7ca518a29096fd7fb9a9cd6870f607913806228b7bdf5dabacf6d1
MD5 de4516fc501eb58207b2e341867e1053
BLAKE2b-256 c04fc95e179ebf4e244188cf2f8520799ff5b59c369fad8b041f0d3fd02998de

See more details on using hashes here.

Supported by

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