Skip to main content

Machine Learning Version Control made Simple

Project description Code Health


Machine Learning Versioning made Simple


Estimators helps organize, track machine learning models and datasets. Estimators functions as an api for your machine learning models and datasets, to convieniently persist, retrieve and machine learning models and datasets.

This repo utilizes sqlalchemy as an ORM. If you’re using django, try django-estimators instead.


Estimators is not yet on PyPI, so just run:

pip install estimators

Environment Setup

First, we need to initialize our database and filesystem. This only needs to happen once per database/filesystem. In future releases, we anticipate this step will be simplified.

from estimators import Estimator, DataSet, DataBase
db = DataBase()

Basic Usage

We can see the power of Estimators in 2 steps. Let’s say we are developing a classifier. We’ll load up the data, split it for validation, and then create and train a model.

from sklearn.datasets import load_digits
from sklearn.ensemble import RandomForestClassifier

digits = load_digits() # 1797 by 64
X =
y =

# simple splitting for validation testing
X_train, X_test = X[:1200], X[1200:]
y_train, y_test = y[:1200], y[1200:]

rfc = RandomForestClassifier(), y_train)

1. First import an Evaluator object that instantiates an evaluation plan. Set the estimator, X_test and y_test to that evaluator object.

from estimators import Evaluator

plan = Evaluator()
plan.estimator = rfc
plan.X_test = X_test
plan.y_test = y_test

# persist all objects upon prediction
result = plan.evaluate()

# including our predictions

2. At a later date, we can retrieve the results, along with the original estimator, X_test dataset and y_test dataset using sqlalchemy orm.

from estimators import DataBase, EvaluationResult
db = DataBase()

result = db.Session.query(EvaluationResult).first()

# which has all our attributes

Advanced Usage

Continuing with the above example, we can pull specific estimators or datasets from our database.

from estimators import Estimator, DataSet

# to return an estimator proxy object
es = db.Session.query(Estimator)[-1]

# return our fitted RandomForestClassifier

# to returns all datasets as proxy objects

ds = db.Session.query(DataSet).all()

But we can continue on to use all of sqlalchemy’s expressions

X_test_one = db.Session.query(DataSet).filter(DataSet.hash=='a381b220d0cd271d608a27eb52dfb654').first()
y_test_one = db.Session.query(DataSet).filter(DataSet.hash=='fe773b5c53aec02fd98ffc65feb4714d').first()

Furthermore, we can run more evaluations using our new proxy objects. The Evaluator object handles the proxy Estimator and DataSet objects just like regular data.

plan = Evaluator()
plan.estimator = es
plan.X_test = X_test_one
plan.y_test = y_test_one

result_two = plan.evaluate()

Additionally if we want to use a different database connection, we can pass the sqlalchemy session object to the evaluator.

from estimators import DataBase
db = DataBase(url='sqlite://')

plan = Evaluator()
plan.session = db.Session
# and continue as expected otherwise

Development Installation

To install the latest version of estimators, clone the repo, change directory to the repo, and pip install it into your current virtual environment.:

$ git clone
$ cd estimators
$ <activate your project’s virtual environment>
(virtualenv) $ pip install -e .  # the dot specifies for this current repo

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

estimators-0.1.0.dev0-py2.py3-none-any.whl (17.6 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page