BaseContext

Inheritance Diagram

Inheritance diagram of ashpy.contexts.base_context.BaseContext

class ashpy.contexts.base_context.BaseContext(metrics=None, dataset=None, log_eval_mode=<LogEvalMode.TEST: 0>, global_step=<tf.Variable 'global_step:0' shape=() dtype=int64, numpy=0>, ckpt=None)[source]

Bases: object

ashpy.contexts.BaseContext provide an interface for all contexts.

Methods

__init__([metrics, dataset, log_eval_mode, …])

Initialize the Context.

measure_metrics()

Measure the metrics.

model_selection()

Use the metrics to perform model selection.

Attributes

dataset

Retrieve the dataset.

global_step

Retrieve the global_step.

log_eval_mode

Retrieve model(s) mode.

metrics

Retrieve the metrics.

__init__(metrics=None, dataset=None, log_eval_mode=<LogEvalMode.TEST: 0>, global_step=<tf.Variable 'global_step:0' shape=() dtype=int64, numpy=0>, ckpt=None)[source]

Initialize the Context.

Parameters
Return type

None

_validate_metrics()[source]

Check if every metric is an ashpy.metrics.Metric.

property dataset

Retrieve the dataset.

Return type

DatasetV2

Returns

tf.data.Dataset.

property global_step

Retrieve the global_step.

Return type

Variable

Returns

tf.Variable.

property log_eval_mode

Retrieve model(s) mode.

Return type

LogEvalMode

Returns

ashpy.modes.LogEvalMode.

measure_metrics()[source]

Measure the metrics.

Return type

None

property metrics

Retrieve the metrics.

Return type

List[Metric]

Returns

list of [ashpy.metrics.metric.Metric].

model_selection()[source]

Use the metrics to perform model selection.

Return type

None