Exemple #1
0
 def register(self, feature_values_pandas_frame, target_values_pandas_frame):
     register_request = OptimizerService_pb2.RegisterObservationsRequest(
         OptimizerHandle=self.optimizer_handle,
         Observations=OptimizerService_pb2.Observations(
             Features=OptimizerService_pb2.Features(FeaturesJsonString=feature_values_pandas_frame.to_json(orient='index', double_precision=15)),
             ObjectiveValues=OptimizerService_pb2.ObjectiveValues(
                 ObjectiveValuesJsonString=target_values_pandas_frame.to_json(orient='index', double_precision=15)
             )
         )
     )
     self._optimizer_stub.RegisterObservations(register_request)
Exemple #2
0
    def register(self, parameter_values_pandas_frame, target_values_pandas_frame, context_values_pandas_frame=None):
        if context_values_pandas_frame is not None:
            raise NotImplementedError("Context not currently supported on remote optimizers")

        feature_values_pandas_frame = parameter_values_pandas_frame
        register_request = OptimizerService_pb2.RegisterObservationsRequest(
            OptimizerHandle=self.optimizer_handle_for_optimizer_service,
            Observations=OptimizerService_pb2.Observations(
                Features=OptimizerService_pb2.Features(FeaturesJsonString=feature_values_pandas_frame.to_json(orient='index', double_precision=15)),
                ObjectiveValues=OptimizerService_pb2.ObjectiveValues(
                    ObjectiveValuesJsonString=target_values_pandas_frame.to_json(orient='index', double_precision=15)
                )
            )
        )
        self._optimizer_stub.RegisterObservations(register_request) # TODO: we should be using the optimizer_stub for this.