Fitness_Function
- src.Fitness_Function.calculate_fitness(accuracy, inference_time=1, memory_footprint_tflite=1)[source]
Calculate the fitness of a model based on its accuracy and inference time.
The fitness is defined as a weighted combination of the accuracy and the normalized inference time, with a higher accuracy and a lower inference time leading to a higher fitness. The inference time is normalized using an arctangent function, which helps to limit its impact on the overall fitness.
Parameters
- accuracyfloat
The accuracy of the model on a given dataset. This should be a value between 0 (no correct predictions) and 1 (all predictions correct).
- inference_timefloat, optional (default=1)
The time taken by the model to make a prediction. This is usually measured in milliseconds. A lower inference time indicates a faster model.
- memory_footprint_tflitefloat, optional (default=1)
The memory footprint of the TensorFlow Lite model. This parameter is defined but not used in the function.
Returns
- fitnessfloat
The fitness of the model, calculated as a weighted combination of the accuracy and the normalized inference time. A higher fitness indicates a better model.