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
|
|
|
|
|
|
|
|
|
|
|
Classes
|
|
|
Mixin class for |
|
|
|
|
|
MetricResult object used by AutoML algorithm classes. |
|
|
|
|
|
|
|
A location in the metadata tree. |
|
This class is a data structure most often used under |
|
TrialSplit object used by AutoML algorithm classes. |
-
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 providedBaseDataclass
(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 providedBaseDataclass
(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 providedBaseDataclass
(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.
-
__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
-
_id_attr_name
¶
-
_sublocation_attr_name
¶
-
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.
-
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.
-
_tree
(_list: List[neuraxle.metaopt.data.vanilla.ScopedLocation], parent_scope: neuraxle.metaopt.data.vanilla.ScopedLocation) → List[neuraxle.metaopt.data.vanilla.ScopedLocation][source]¶
-
_abc_impl
= <_abc_data object>¶
-
-
class
neuraxle.metaopt.data.vanilla.
DataclassHasOrderedDictMixin
[source]¶ Bases:
object
-
set_sublocation_keys
(keys: List[Union[int, str]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[source]¶
-
-
class
neuraxle.metaopt.data.vanilla.
DataclassHasListMixin
[source]¶ Bases:
object
-
set_sublocation_keys
(keys: List[Union[int, str]]) → neuraxle.metaopt.data.vanilla.BaseDataclass[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
andTrialSplitMetadata
that also must inherit fromBaseMetadata
.-
start_time
= None¶
-
end_time
= None¶
-
-
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
¶
-
_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 theHyperparameterRepository
class and theTrial
class within the AutoML.-
trial_number
= 0¶
-
retrained_split
= None¶
-
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.
-
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¶
-
__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]¶
-
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 aTypeError
).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)
-