newrelic-experimental / ml-performance-monitoring

A Python package for sending model inference data, data metrics, and model metrics
Apache License 2.0
33 stars 19 forks source link

New Relic open source - Experimental

ML Performance Monitoring

New Relic's MLOps solution provides a Python library that makes it easy to monitor your ML models.

The key features:

Getting Started

Example Notebooks

Quickstart

Open In Colab easily try an end-to-end example of model monitoring.


# STEP 1: Initialize the monitoring
ml_monitor = MLPerformanceMonitoring(...)

# STEP 2: Add your algorithm
y = my_model.predict(X)

# STEP 3: Record your data
ml_monitor.record_inference_data(X, y)

Installation

With pip

pip install git+https://github.com/newrelic-experimental/ml-performance-monitoring.git

Usage

STEP 1: Set Your Environment Variable

Get your License key (also referenced as ingest - license) and set it as environment variable: NEW_RELIC_LICENSE_KEY. Click here for more details and instructions.

Are you reporting data to the New Relic EU region? click here for more instructions.

STEP 2: Import package

from ml_performance_monitoring.monitor import MLPerformanceMonitoring

STEP 3: Create model monitor

metadata = {"environment": "notebook"}
model_version = "1.0"
features_columns, labels_columns = (
    ["feature_1", "feature_2", "feature_3", "feature_4"],
    ["target"],
)

ml_monitor = MLPerformanceMonitoring(
    insert_key=None,  # set the environment variable NEW_RELIC_LICENSE_KEY or send your insert key here
    model_name="My stunning model",
    metadata=metadata,
    features_columns=features_columns,
    labels_columns=labels_columns,
    model_version=model_version
)

STEP 4: Do your thing

y = my_model.predict(X)

STEP 5: Record

ml_monitor.record_inference_data(X, y)

STEP 6: Monitor and alert

Done! Check your application in the New Relic UI to see the real time data.

EU Account Users

If you are using an EU account, set your environment variables as following:

They can also be sent as parameters at the MLPerformanceMonitoring call.

FAQ

Support

As an open source library, customers can interact with New Relic employees as well as other customers to get help by opening GitHub issues in the repository.

Contributing

We encourage your contributions to improve ml-performance-monitoring! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project. If you have any questions, or to execute our corporate CLA (required if your contribution is on behalf of a company) please drop us an email at opensource@newrelic.com.

A note about vulnerabilities: As noted in our security policy, New Relic is committed to the privacy and security of our customers and their data. We believe that providing coordinated disclosure by security researchers and engaging with the security community are important means to achieve our security goals.

If you believe you have found a security vulnerability in this project or any of New Relic's products or websites, we welcome and greatly appreciate you reporting it to New Relic through HackerOne.

License

ml-performance-monitoring is licensed under the Apache 2.0 License.

If applicable: The ml-performance-monitoring also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.