INNER CODE UNIT · Python
genome
joeddav/devol · devol/devol.py:65
genome = genome_handler.genome_representation() + metric_cols
writer.writerow(genome)
def set_objective(self, metric):
"""
Set the metric for optimization. Can also be done by passing to
`run`.
Args:
metric (str): either 'acc' to maximize classification accuracy, or
else 'loss' to minimize the loss function
"""
if metric == 'acc':
metric = 'accuracy'
if metric not in ['loss', 'accuracy']:
raise ValueError(('Invalid metric name {} provided - should be'
'"accuracy" or "loss"').format(metric))
self._metric = metric