Welcome to Pythia’s documentation!

Contents:

class pythia.Experiment(api_base, _id=None)

This class represents an experiment with an arbritary number of models.

__init__(api_base, _id=None)

Creates a new entitiy. If _id is provided, an already existing remote entity is fetched, otherwise a new one is created.

Parameters:
  • api_base – URI to the Pythia API instance
  • _id – if given, attempts to fetch an already existing model.
create_model(_id=None)

Creates a new model.

Parameters:_id – if given, attempts to fetch an already existing model.
class pythia.Model(api_base, experiment_id, _id=None)

This class abstracts the models an experiment has.

__init__(api_base, experiment_id, _id=None)

Returns new Model instance.

Parameters:
  • api_base – full URL to api instance including the version identifier. Example: http://localhost:5667/api/v1
  • experiment_id – the id of the experiment that owns the model
  • _id – if given, attempts to fetch an already existing model.
add_measurement(name, value, epoch=0, step=0)

Adds data point of a measurement with respect to a metric to the model.

Parameters:
  • name – name of metric
  • value – value of respective metric
  • epoch – respective epoch of the measurement point
  • step – respective step of the measurement point
class pythia.ApiBase(api_base, _id=None)

This class provides the basis for every remote entity. The resource simply specifies its attributes and path, as well as provides setters for the attributes.

It might also provide custom methods as well as a custom initiator. It is mandatory that the inheriting entity calls this class’s init method as well:

ApiBase.__init__(self, api_base, _id=_id)
check_api_compatibility()

Checks the API version to guarantee compatibility.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from pythia import Experiment

# init experiment

# implies that an instance of Pythia is listening on localhost
exp = Experiment('http://localhost:5667/api/v1/')

exp.name = "some catchy name"
exp.description = "describe the experiment here"

# create a model
model = exp.create_model()
model.name = "2 layers foo bar dropout softmax"

for i in range(NUM_EPOCHS):
    for j in range(NUM_EXAMPLES):
        # the following two lines are not really valid
        train_classifier()
        train_accuracy = accuracy(classifier)

        # save the measured training accuracy
        model.add_measurement(name='train_accuracy',
                              value=train_accuracy,
                              step=j,
                              epoch=i)

Indices and tables

Table Of Contents

This Page