mltk.core.EvaluateMixin

class EvaluateMixin[source]

Provides generic evaluation properties and methods to the base MltkModel

Refer to the Model Evaluation guide for more details.

Properties

eval_custom_function

Custom evaluation callback

eval_steps_per_epoch

Total number of steps (batches of samples) before declaring the prediction round finished.

Methods

__init__

property eval_steps_per_epoch

Total number of steps (batches of samples) before declaring the prediction round finished. Ignored with the default value of None. If x is a tf.data dataset and steps is None, predict will run until the input dataset is exhausted.

property eval_custom_function

Custom evaluation callback

This is invoked during the mltk.core.evaluate_model() API.

The given function should have the following signature:

my_custom_eval_function(my_model:MyModel, built_model: Union[KerasModel, TfliteModel]) -> EvaluationResults:
    results = EvaluationResults(name=my_model.name)

    if isinstance(built_model, KerasModel):
        results['overall_accuracy] = calculate_accuracy(built_model)
    return results