MODULE

IVORY.CORE.BASE

This module provides base classes for Ivory.

Classes
  • Base Base class for an entity class such as Client, Experiment, and Run.</>
  • Creator Creator class to create Run instances.</>
  • Callback Callback class for the Ivory callback system.</>
  • CallbackCaller Callback caller class.</>
  • Experiment Experimet class is one of the main classes of Ivory library.</>
class

ivory.core.base.Base(params=None, **instances)

Base class for an entity class such as Client, Experiment, and Run.

Parameters
  • params (dict, optional) Parameter dictionary to create this instance.
  • **instances Member instances. Key is its name and value is the member instance.
Attributes
  • dict
  • id (str) Instance ID given by MLFlow Tracking.
  • name (str) Instance name.
  • params (dict, optional) Parameter dictionary that is used to to create this instance.
  • source_name (str) Name of the YAML parameter file that is used to create this instance.
class

ivory.core.base.Creator(params=None, **instances)

Creator class to create Run instances.

Parameters
  • params (optional) Parameter dictionary to create this instance.
  • **instances Member instances. Key is its name and value is the member instance.
Attributes
  • dict
  • id (str) Instance ID given by MLFlow Tracking.
  • name (str) Instance name.
  • params (dict, optional) Parameter dictionary that is used to to create this instance.
  • source_name (str) Name of the YAML parameter file that is used to create this instance.
Methods
  • create_instance(instance_name, args, name, **kwargs) Creates an member instance of a Run according to arguments.</>
  • create_params(args, name, **kwargs) (dict, dict) Returns a tuple of (parameter dictionary, update dictionary).</>
  • create_run(args, name, **kwargs) (Run) Creates a Run instance according to arguments.</>
method

create_params(args=None, name='run', **kwargs) → (dict, dict)

Returns a tuple of (parameter dictionary, update dictionary).

The parameter dictionary is deeply copied from original one, then updated according to the arguments. The update dictionary includes updated parameter only.

Parameters
  • args (dict, optional) Update dictionary.
  • name (str, optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Examples

Use args for parameters including dots:

params, update = experiment.create_params(
    {'hidden_sizes.0': 100}, fold=3
)

The params is the full parameter dictionary, while the update is a part of params, i.e., update = {'hidden_sizes.0': 100, 'fold': 3}.

method

create_run(args=None, name='run', **kwargs)

Creates a Run instance according to arguments.

Parameters
  • args (dict, optional) Update dictionary.
  • name (str, optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Returns (Run)

Created Run instance. The parameter for this instance is the returned dictionary from the create_params() function.

method

create_instance(instance_name, args=None, name='run', **kwargs)

Creates an member instance of a Run according to arguments.

Parameters
  • instance_name (str) Name of a member instance to create.
  • args (dict, optional) Update dictionary.
  • name (optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Returns

Created instance. The parameter for this instance is the returned directory from the create_params() function.

class

ivory.core.base.Callback(caller, methods)

Callback class for the Ivory callback system.

Parameters
Attributes
  • caller
  • methods
class

ivory.core.base.CallbackCaller(params=None, **instances)

Callback caller class.

Parameters
  • params (optional) Parameter dictionary to create this instance.
  • **instances Member instances. Key is its name and value is the member instance.
Attributes
  • dict
  • id (str) Instance ID given by MLFlow Tracking.
  • name (str) Instance name.
  • params (dict, optional) Parameter dictionary that is used to to create this instance.
  • source_name (str) Name of the YAML parameter file that is used to create this instance.
Methods
  • create_callbacks() Creates callback functions and store them in a dictionary.</>
  • create_instance(instance_name, args, name, **kwargs) Creates an member instance of a Run according to arguments.</>
  • create_params(args, name, **kwargs) (dict, dict) Returns a tuple of (parameter dictionary, update dictionary).</>
  • create_run(args, name, **kwargs) (Run) Creates a Run instance according to arguments.</>
method

create_params(args=None, name='run', **kwargs) → (dict, dict)

Returns a tuple of (parameter dictionary, update dictionary).

The parameter dictionary is deeply copied from original one, then updated according to the arguments. The update dictionary includes updated parameter only.

Parameters
  • args (dict, optional) Update dictionary.
  • name (str, optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Examples

Use args for parameters including dots:

params, update = experiment.create_params(
    {'hidden_sizes.0': 100}, fold=3
)

The params is the full parameter dictionary, while the update is a part of params, i.e., update = {'hidden_sizes.0': 100, 'fold': 3}.

method

create_run(args=None, name='run', **kwargs)

Creates a Run instance according to arguments.

Parameters
  • args (dict, optional) Update dictionary.
  • name (str, optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Returns (Run)

Created Run instance. The parameter for this instance is the returned dictionary from the create_params() function.

method

create_instance(instance_name, args=None, name='run', **kwargs)

Creates an member instance of a Run according to arguments.

Parameters
  • instance_name (str) Name of a member instance to create.
  • args (dict, optional) Update dictionary.
  • name (optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Returns

Created instance. The parameter for this instance is the returned directory from the create_params() function.

method

create_callbacks()

Creates callback functions and store them in a dictionary.

class

ivory.core.base.Experiment(params=None, **instances)

Experimet class is one of the main classes of Ivory library.

Basically, one experiment is corresponding to one YAML parameter file that is held in an Experiment instance as a parameter dictionary. This parameter dictionary defines the default parameter values to create Run instances.

Parameters
  • params (optional) Parameter dictionary to create this instance.
  • **instances Member instances. Key is its name and value is the member instance.
Attributes
  • dict
  • id (str) Instance ID given by MLFlow Tracking.
  • name (str) Instance name.
  • params (dict, optional) Parameter dictionary that is used to to create this instance.
  • source_name (str) Name of the YAML parameter file that is used to create this instance.
See Also

The base class ivory.core.base.Creator defines some functions to create a Run instance or its member instance.

Methods
  • create_instance(instance_name, args, name, **kwargs) Creates an member instance of a Run according to arguments.</>
  • create_params(args, name, **kwargs) (dict, dict) Returns a tuple of (parameter dictionary, update dictionary).</>
  • create_run(args, name, **kwargs) (Run) Creates a Run instance according to arguments.</>
  • create_study(args, **suggests) Creates a Study instance for hyperparameter tuning.</>
  • create_task() Creates a Task instance for multiple runs.</>
  • set_tracker(tracker) Sets a Tracker instance for tracking.</>
method

create_params(args=None, name='run', **kwargs) → (dict, dict)

Returns a tuple of (parameter dictionary, update dictionary).

The parameter dictionary is deeply copied from original one, then updated according to the arguments. The update dictionary includes updated parameter only.

Parameters
  • args (dict, optional) Update dictionary.
  • name (str, optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Examples

Use args for parameters including dots:

params, update = experiment.create_params(
    {'hidden_sizes.0': 100}, fold=3
)

The params is the full parameter dictionary, while the update is a part of params, i.e., update = {'hidden_sizes.0': 100, 'fold': 3}.

method

create_run(args=None, name='run', **kwargs)

Creates a Run instance according to arguments.

Parameters
  • args (dict, optional) Update dictionary.
  • name (str, optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Returns (Run)

Created Run instance. The parameter for this instance is the returned dictionary from the create_params() function.

method

create_instance(instance_name, args=None, name='run', **kwargs)

Creates an member instance of a Run according to arguments.

Parameters
  • instance_name (str) Name of a member instance to create.
  • args (dict, optional) Update dictionary.
  • name (optional) Run class name in lower case.
  • **kwargs Additional update dictionary.
Returns

Created instance. The parameter for this instance is the returned directory from the create_params() function.

method

set_tracker(tracker)

Sets a Tracker instance for tracking.

Parameters
  • tracker (Tracker) Tracker instance.
method

create_task()

Creates a Task instance for multiple runs.

See Also

For more details, see client.create_task()

Multiple Runs in Tutorial.

method

create_study(args=None, **suggests)

Creates a Study instance for hyperparameter tuning.

Parameters
  • args (optional)
  • **suggests
See Also

For more details, see client.create_study()

Hyperparameter Tuning in Tutorial