EncodingAccuracy

Inheritance Diagram

Inheritance diagram of ashpy.metrics.gan.EncodingAccuracy

class ashpy.metrics.gan.EncodingAccuracy(classifier, name='encoding_accuracy', model_selection_operator=None, logdir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/ashpy/checkouts/stable/docs/source/log'))[source]

Bases: ashpy.metrics.classifier.ClassifierMetric

Generator and Encoder accuracy performance.

Measure the Generator and Encoder performance together, by classifying: G(E(x)), y using a pre-trained classified (on the dataset of x).

Methods

__init__(classifier[, name, …]) Measure the Generator and Encoder performance together.
update_state(context) Update the internal state of the metric, using the information from the context object.

Attributes

best_folder Retrieve the folder used to save the best model when doing model selection.
best_model_sel_file Retrieve the path to JSON file containing the measured performance of the best model.
logdir Retrieve the log directory.
metric Retrieve the tf.keras.metrics.Metric object.
model_selection_operator Retrieve the operator used for model selection.
name Retrieve the metric name.
sanitized_name all / are _.
__init__(classifier, name='encoding_accuracy', model_selection_operator=None, logdir=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/ashpy/checkouts/stable/docs/source/log'))[source]

Measure the Generator and Encoder performance together.

This is done by classifying: G(E(x)), y using a pre-trained classified (on the dataset of x).

Parameters:
  • classifier (tf.keras.Model) – Keras Model to use as a Classifier to measure the accuracy. Generally assumed to be the Inception Model.
  • name (str) – Name of the metric.
  • model_selection_operator (typing.Callable) –

    The operation that will be used when model_selection is triggered to compare the metrics, used by the update_state. Any typing.Callable behaving like an operator is accepted.

    Note

    Model selection is done ONLY if an operator is specified here.

  • logdir (str) – Path to the log dir, defaults to a log folder in the current directory.
Return type:

None

update_state(context)[source]

Update the internal state of the metric, using the information from the context object.

Parameters:context (ashpy.contexts.GANEncoderContext) – An AshPy Context Object that carries all the information the Metric needs.
Return type:None