Module markov.api.projects.project

Classes

class Project (name: str = '', description: str = '', project_scope: ProjectScope = ProjectScope.PUBLIC)

Interface to create projects in markov ml. Projects can be used to organize your models, experiments, and evaluations.

You can use this interface to create new models and start new experiments within the current project

Examples

>>> project = Project(name="My first project") # Creates the markov Project object
>>> project.register() # Registers the Project object with markov backend
>>> model = project.create_model(model_name="My first model")
>>> model.register()
>>> exp_recorder = project.create_experiment_recorder(experiment_name="My first experiment", hyper_parameters={"lr": 0.01})
>>> exp_recorder.register()
>>> with exp_recorder:
...      # training loop
...      exp_recorder.add_record({'loss': 0.9})
>>> eval_recorder = model.create_evaluation_recorder(evaluation_name="My first evaluation", dataset_id="dataset_id")
>>> eval_recorder.register()
>>> eval_recorder.add_record() # pass SingleTagInferenceRecord or MultiTagInferenceRecord

You can also get existing projects from markov backend

>>> project_from_id = Project.get_by_id(project_id="existing_project_id")
>>> project_from_name = Project.get_by_name(project_name="existing_project_name")

Static methods

def from_id(project_id: str) ‑> Optional[Project]

Fetches the project with id project_id from markov backend

Args

project_id
Id of the project to be fetched

Returns

Returns the markov project object if project found; Else returns None

def get_by_id(project_id: str) ‑> Optional[Project]

Fetches the project with id project_id from markov backend

Args

project_id
unique id of the project assigned to it by Markov. You can see it in the Project details page.

Returns

Returns the markov project object if project found; Else returns None

def get_by_name(project_name: str) ‑> Optional[Project]

Fetches the project with name project_name from markov backend if it exists

Args

project_name
Name of the project to be fetched

Returns

Returns the markov project object if project found; Else returns None

def get_model_by_id(model_id: str) ‑> Model

Model identified by the given model_id if it exists, otherwise None is returned

Args

model_id : str
unique model_id of the model on MarkovML backend

Returns

Model object if model with given name exists else None is returned

Instance variables

prop description

Returns: associated description text

prop name

Returns: name of the project

prop project_id

Returns: associated project_id

prop scope

Returns: current scope of this project

Methods

def create_experiment_recorder(self, experiment_name: str, experiment_notes: str = '', model_class: ModelClass = ModelClass.CLASSIFICATION, hyper_parameters: Dict = None, metadata: Dict = None, **kwargs) ‑> Optional[ExperimentRecorder]

Method to create experiment recorder associated with the current project

Args

experiment_name
name of the experiment
experiment_notes
notes for the experiment
model_class
class of the model being used to run the experiment
hyper_parameters
hyper_parameters of the model being experimented
metadata
any additional custom metadata for the experiment

**kwargs:

Returns

ExperimentRecorder to record metrics like loss, accuracy during training and validation process

def create_model(self, model_name: str, model_class: ModelClass = ModelClass.CLASSIFICATION, model_description: str = '') ‑> Optional[Model]

This method creates a new model within this project.

Args

model_name
name of the model
model_class
class of the model, the currently we only support ModelClass.CLASSIFICATION
model_description
description of the model to understand the scope and goal of this Model. It is helpful

for bookkeeping purposes and help your future self or your colleagues.

Returns

Model object (not registered with Markov backend)

def get_model_by_name(self, model_name: str) ‑> Model

Returns the model by name

Args

model_name : str
name of the model

Returns

Model object if model with given name exists else None is returned

def register(self)

Register Markov project object with Markov backend