SQLTrack Documentation

SQLTrack is a library and set of tools to track and analyze your machine learning experiments.

We made SQLTrack, because using alternatives like MLflow Tracking or Sacred never felt like we truly owned our data, and we were limited by what these tools “allowed” us to do.

“Just let me program it!”

Clicking through GUIs can be time consuming and tedious, especially when you have to do so repeatedly, yet results are limited to whatever the GUI can do. Code is the most powerful user interface, why not use it to analyze your experiments?

This is what SQLTrack allows you to do. Easily and reliably collect and store experiment data in a well known, and most importantly highly accessible format: a SQL database, minus all the annoying boilerplate.

SQLTrack provides a simple yet powerful schema for experiments, runs, and metrics that you can extend to suit your needs, along with some tools to set up the database, and store and retrieve data with few lines.

A minimal example

Here is a minimal example for how to track an experiment:

import sqltrack
from sqltrack.commands import setup

def main():
    client = sqltrack.Client()
    setup(client)
    experiment = sqltrack.Experiment(client, name="Minimal")
    run = experiment.get_run()
    with run.track():
        for epoch in range(90):
            metrics = {"loss": 7**(1/(epoch+1))}
            run.add_metrics(metrics, step=epoch)

if __name__ == "__main__":
    main()

And this is a minimal example for how to retrieve data:

import sqltrack
from sqltrack.pandas import query_dataframe

def main():
    client = sqltrack.Client()
    metrics = query_dataframe(client, "SELECT * FROM metrics")
    print(metrics)

if __name__ == "__main__":
    main()

Which outputs:

    run_id  step  progress      loss
0        1     0       0.0  7.000000
1        1     1       0.0  2.645751
2        1     2       0.0  1.912931
3        1     3       0.0  1.626577
4        1     4       0.0  1.475773
..     ...   ...       ...       ...
85       1    85       0.0  1.022885
86       1    86       0.0  1.022619
87       1    87       0.0  1.022359
88       1    88       0.0  1.022105
89       1    89       0.0  1.021857

[90 rows x 4 columns]

You can now do whatever you wish with the metrics stored in this pandas.DataFrame. See Analyzing experiments for more advanced examples.

Contents

Indices and tables