neuraxle.metaopt.data.vanilla

Module-level documentation for neuraxle.metaopt.data.vanilla. Here is an inheritance diagram, including dependencies to other base modules of Neuraxle:


Neuraxle’s Base Hyperparameter Repository Classes

Data objects and related repositories used by AutoML.

Classes are splitted like this for the AutoML:

  • Projects

  • Clients

  • Rounds (runs)

  • Trials

  • TrialSplits

  • MetricResults

Functions

as_named_odict(obj, …)

from_json(_json)

object_decoder(obj[, odictify])

object_pairs_decoder(obj)

to_int_if_not_float_or_none(attr)

to_json(obj)

to_str_if_not_none(attr)

Classes

BaseDataclass(*args, **kwds)

BaseTrialDataclassMixin(hyperparams, status, …)

Mixin class for TrialMetadata and TrialSplitMetadata that also must inherit from BaseMetadata.

ClientDataclass(*args, **kwds)

DataclassHasListMixin()

DataclassHasOrderedDictMixin()

MetadataJSONEncoder(*[, skipkeys, …])

MetricResultsDataclass(metric_name, …)

MetricResult object used by AutoML algorithm classes.

ProjectDataclass(*args, **kwds)

RootDataclass(*args, **kwds)

RoundDataclass(*args, **kwds)

ScopedLocation(project_name, client_name, …)

A location in the metadata tree.

TrialDataclass(hyperparams, status, …)

This class is a data structure most often used under AutoML to store information about a trial.

TrialSplitDataclass(hyperparams, status, …)

TrialSplit object used by AutoML algorithm classes.


neuraxle.metaopt.data.vanilla.to_int_if_not_float_or_none(attr) → int[source]
neuraxle.metaopt.data.vanilla.to_str_if_not_none(attr) → str[source]
class neuraxle.metaopt.data.vanilla.ScopedLocation(project_name: str = None, client_name: str = None, round_number: int = None, trial_number: int = None, split_number: int = None, metric_name: str = None)[source]

Bases: neuraxle.base.BaseService

A location in the metadata tree.

project_name = None
client_name = None
round_number = None
trial_number = None
split_number = None
metric_name = None
copy() → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a copy of the ScopedLocation.

with_dc(dc: neuraxle.metaopt.data.vanilla.BaseDataclass) → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a new ScopedLocation with the provided BaseDataclass (dc) type’s id added.

fill_to_dc(dc: neuraxle.metaopt.data.vanilla.BaseDataclass) → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a ScopedLocation with the provided BaseDataclass (dc) type’s id added at the end, with the particularity that if some elements are missing, they are filled with the default null values.

pad_nans() → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a ScopedLocation with the missing elements filled with the default null values.

with_id(_id: Union[str, int]) → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a longer ScopedLocation with the provided id added at the end.

at_dc(dc: neuraxle.metaopt.data.vanilla.BaseDataclass) → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a trimmed ScopedLocation with the provided BaseDataclass (dc) type’s id as the ScopedLocation’s deepest attribute.

static default_full() → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a ScopedLocation with all attributes set to the default non-null value instead of None.

static default(round_number: Optional[int] = None, trial_number: Optional[int] = None, split_number: Optional[int] = None, metric_name: Optional[str] = None) → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns the default ScopedLocation. That is:

peek() → Union[str, int][source]

Pop without removing the last element: return the last non-None element.

pop() → Union[str, int][source]

Returns the last not None scoped location attribute and remove it from self.

popped() → neuraxle.metaopt.data.vanilla.ScopedLocation[source]

Returns a new ScopedLocation with the last not None scoped location attribute removed.

as_list(stringify: bool = False) → List[Union[int, str]][source]

Returns a list of the scoped location attributes. Item that has a value of None are not included in the list.

Parameters

stringify (bool) – If True, the scoped location attributes are converted to strings.

Returns

list of not none scoped location attributes

new_dataclass_from_id()[source]

Creates a new BaseDataclass of the right type with just the provided ID filled.

last_dc_type() → Type[neuraxle.metaopt.data.vanilla.BaseDataclass][source]
__init__(project_name: str = None, client_name: str = None, round_number: int = None, trial_number: int = None, split_number: int = None, metric_name: str = None) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.BaseDataclass(*args, **kwds)[source]

Bases: typing.Generic, abc.ABC

_validate()[source]
static from_dict(_dict: Dict[str, Any]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
to_dict() → Dict[str, Any][source]
_id_attr_name
_sublocation_attr_name
get_id() → Union[str, int][source]
set_id(_id: Union[str, int]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
get_sublocation() → Union[List[SubDataclassT], OrderedDict[str, SubDataclassT]][source]
get_sublocation_items() → List[Tuple[Union[str, int], SubDataclassT]][source]
set_sublocation(sublocation: Union[List[SubDataclassT], OrderedDict[str, SubDataclassT]]) → BaseDataclass[source]
set_sublocation_keys(keys: List[Union[int, str]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Use this to set a shallow sublocation only from their keys.

_is_key_in_subattr(key_subattr)[source]
store(dc: SubDataclassT) → Union[str, int][source]

Add a subdataclass to the sublocation, at its proper ID.

shallow() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Replaces the sublocation items with None when the sublocation is a BaseDataclass type.

empty() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Do empty the sublocation when the sublocation is a BaseDataclass type.

has_sublocation_dataclasses() → bool[source]
get_sublocation_values() → List[SubDataclassT][source]
get_sublocation_keys() → List[Union[int, str]][source]
classmethod subdataclass_type() → Type[SubDataclassT][source]
is_terminal_leaf() → bool[source]
_tree(_list: List[neuraxle.metaopt.data.vanilla.ScopedLocation], parent_scope: neuraxle.metaopt.data.vanilla.ScopedLocation) → List[neuraxle.metaopt.data.vanilla.ScopedLocation][source]
tree() → List[neuraxle.metaopt.data.vanilla.ScopedLocation][source]
__init__() → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.DataclassHasOrderedDictMixin[source]

Bases: object

_validate()[source]
get_sublocation() → OrderedDict[ScopedLocationAttrStr, SubDataclassT][source]
set_sublocation(sublocation: OrderedDict[ScopedLocationAttrStr, SubDataclassT]) → None[source]
set_sublocation_keys(keys: List[Union[int, str]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
set_sublocation_items(items: List[Tuple[Union[str, int], SubDataclassT]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
get_sublocation_values() → List[SubDataclassT][source]
get_sublocation_keys() → List[str][source]
store(dc: SubDataclassT) → str[source]
shallow() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
empty() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
_sort()[source]
__init__() → None[source]
class neuraxle.metaopt.data.vanilla.DataclassHasListMixin[source]

Bases: object

_validate()[source]
get_sublocation() → List[SubDataclassT][source]
set_sublocation(sublocation: List[SubDataclassT]) → None[source]
set_sublocation_keys(keys: List[Union[int, str]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
set_sublocation_items(items: List[Tuple[Union[str, int], SubDataclassT]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
get_sublocation_values() → List[SubDataclassT][source]
get_sublocation_keys() → List[int][source]
_is_key_in_subattr(key_subattr)[source]
store(dc: SubDataclassT) → int[source]
shallow() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
empty() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
get_next_i() → int[source]
__init__() → None[source]
class neuraxle.metaopt.data.vanilla.BaseTrialDataclassMixin(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples = <factory>, status: neuraxle.base.TrialStatus = <TrialStatus.PLANNED: 'PLANNED'>, created_time: datetime.datetime = <factory>, start_time: datetime.datetime = None, end_time: datetime.datetime = None)[source]

Bases: object

Mixin class for TrialMetadata and TrialSplitMetadata that also must inherit from BaseMetadata.

status = 'PLANNED'[source]
start_time = None
end_time = None
_validate()[source]
_validate_date_attr(attr_name) → None[source]
start() → neuraxle.metaopt.data.vanilla.BaseTrialDataclassMixin[source]
end(status: neuraxle.base.TrialStatus) → neuraxle.metaopt.data.vanilla.BaseTrialDataclassMixin[source]
__init__(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples = <factory>, status: neuraxle.base.TrialStatus = <TrialStatus.PLANNED: 'PLANNED'>, created_time: datetime.datetime = <factory>, start_time: datetime.datetime = None, end_time: datetime.datetime = None) → None[source]
class neuraxle.metaopt.data.vanilla.RootDataclass(*args, **kwds)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasOrderedDictMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

_id_attr_name
_sublocation_attr_name
get_id() → Union[str, int][source]
get_sublocation() → OrderedDict[str, SubDataclassT][source]
__init__(projects: OrderedDict[str, ProjectDataclass] = <factory>) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.ProjectDataclass(*args, **kwds)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasOrderedDictMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

project_name = 'default_project'
__init__(project_name: str = 'default_project', clients: OrderedDict[str, ClientDataclass] = <factory>) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.ClientDataclass(*args, **kwds)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasListMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

client_name = 'default_client'
__init__(client_name: str = 'default_client', rounds: List[RoundDataclass] = <factory>) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.RoundDataclass(*args, **kwds)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasListMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

round_number = 0
main_metric_name = None
__init__(round_number: int = 0, trials: List[TrialDataclass] = <factory>, main_metric_name: str = None) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.TrialDataclass(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples = <factory>, status: neuraxle.base.TrialStatus = <TrialStatus.PLANNED: 'PLANNED'>, created_time: datetime.datetime = <factory>, start_time: datetime.datetime = None, end_time: datetime.datetime = None, trial_number: int = 0, validation_splits: List[TrialSplitDataclass] = <factory>, retrained_split: Optional[neuraxle.metaopt.data.vanilla.TrialSplitDataclass] = None)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasListMixin, neuraxle.metaopt.data.vanilla.BaseTrialDataclassMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

This class is a data structure most often used under AutoML to store information about a trial. This information is itself managed by the HyperparameterRepository class and the Trial class within the AutoML.

trial_number = 0
retrained_split = None
store(dc: SubDataclassT) → int[source]

Add a subdataclass to the sublocation, at its proper ID.

set_sublocation_keys(keys: List[Union[int, str]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Use this to set a shallow sublocation only from their keys.

set_sublocation_items(items: List[Tuple[Union[str, int], SubDataclassT]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]
shallow() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Replaces the sublocation items with None when the sublocation is a BaseDataclass type.

_set_shallow_retrained_split_id()[source]
empty() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Do empty the sublocation when the sublocation is a BaseDataclass type.

__init__(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples = <factory>, status: neuraxle.base.TrialStatus = <TrialStatus.PLANNED: 'PLANNED'>, created_time: datetime.datetime = <factory>, start_time: datetime.datetime = None, end_time: datetime.datetime = None, trial_number: int = 0, validation_splits: List[TrialSplitDataclass] = <factory>, retrained_split: Optional[neuraxle.metaopt.data.vanilla.TrialSplitDataclass] = None) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.TrialSplitDataclass(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples = <factory>, status: neuraxle.base.TrialStatus = <TrialStatus.PLANNED: 'PLANNED'>, created_time: datetime.datetime = <factory>, start_time: datetime.datetime = None, end_time: datetime.datetime = None, split_number: int = 0, metric_results: OrderedDict[str, MetricResultsDataclass] = <factory>)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasOrderedDictMixin, neuraxle.metaopt.data.vanilla.BaseTrialDataclassMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

TrialSplit object used by AutoML algorithm classes.

split_number = 0
is_retrain_split() → bool[source]
__init__(hyperparams: neuraxle.hyperparams.space.HyperparameterSamples = <factory>, status: neuraxle.base.TrialStatus = <TrialStatus.PLANNED: 'PLANNED'>, created_time: datetime.datetime = <factory>, start_time: datetime.datetime = None, end_time: datetime.datetime = None, split_number: int = 0, metric_results: OrderedDict[str, MetricResultsDataclass] = <factory>) → None[source]
_abc_impl = <_abc_data object>
class neuraxle.metaopt.data.vanilla.MetricResultsDataclass(metric_name: str = 'main', validation_values: List[float] = <factory>, train_values: List[float] = <factory>, higher_score_is_better: bool = True)[source]

Bases: neuraxle.metaopt.data.vanilla.DataclassHasListMixin, neuraxle.metaopt.data.vanilla.BaseDataclass

MetricResult object used by AutoML algorithm classes.

metric_name = 'main'
higher_score_is_better = True
shallow() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Replaces the sublocation items with None when the sublocation is a BaseDataclass type.

empty() → neuraxle.metaopt.data.vanilla.BaseDataclass[source]

Do empty the sublocation when the sublocation is a BaseDataclass type.

__init__(metric_name: str = 'main', validation_values: List[float] = <factory>, train_values: List[float] = <factory>, higher_score_is_better: bool = True) → None[source]
_abc_impl = <_abc_data object>
neuraxle.metaopt.data.vanilla.as_named_odict(obj: Union[neuraxle.metaopt.data.vanilla.BaseDataclass, List[neuraxle.metaopt.data.vanilla.BaseDataclass]]) → OrderedDict[ScopedLocationAttrStr, BaseDataclass][source]
neuraxle.metaopt.data.vanilla.object_pairs_decoder(obj)[source]
neuraxle.metaopt.data.vanilla.object_decoder(obj, odictify=False)[source]
class neuraxle.metaopt.data.vanilla.MetadataJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.encoder.JSONEncoder

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
neuraxle.metaopt.data.vanilla.to_json(obj: neuraxle.metaopt.data.vanilla.BaseDataclass) → str[source]
neuraxle.metaopt.data.vanilla.from_json(_json: str) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]