def _individual_to_json(individual): return { 'id': individual.id, 'parameters': individual.genome.encoded_parameters, 'learning_rate': individual.learning_rate, 'optimizer_state': StateEncoder.encode(individual.optimizer_state) }
def _individual_to_json(individual): json_response = { 'id': individual.id, 'parameters': individual.genome.encoded_parameters, 'learning_rate': individual.learning_rate, 'optimizer_state': StateEncoder.encode(individual.optimizer_state) } if individual.iteration is not None: json_response['iteration'] = individual.iteration return json_response
def individual_to_dict(individual): individual_dict = { 'id': individual.id, 'parameters': individual.genome.encoded_parameters, 'learning_rate': individual.learning_rate, 'optimizer_state': StateEncoder.encode(individual.optimizer_state) } if individual.iteration is not None: individual_dict['iteration'] = individual.iteration return individual_dict
def encoded_parameters(self): """ :return: base64 encoded representation of the networks state dictionary """ return StateEncoder.encode(self.net.state_dict())