Beispiel #1
0
 def GetWeightUpdate(self, request, context):
     for k,v in dict(request.delta_w).items():
         if k in self.all_delta_w:
             self.all_delta_w[k] += v
         else:
             self.all_delta_w[k] = v
     self.wait_for_all_nodes_counter += 1
     response = hogwild_pb2.Empty()
     return response
Beispiel #2
0
 def StartSGD(self, request, context):
     self.learning_rate = request.learning_rate
     self.lambda_reg = request.lambda_reg
     self.epochs = request.epochs
     self.batch_size = request.batch_size
     dim = max([max(k) for k in self.data]) + 1
     self.svm = SVM(learning_rate=self.learning_rate, lambda_reg=self.lambda_reg, dim=dim)
     self.ready_to_calculate = True
     response = hogwild_pb2.Empty()
     return response
Beispiel #3
0
 def GetDataSet(self, request, context):
     datapoints = request.datapoints
     for d in datapoints:
         self.data.append(dict(d.datapoint))
         self.targets.append(d.target)
     print('Received dataset!')
     print('Dataset length = {}'.format(len(self.data)))
     print('Targets length = {}'.format(len(self.targets)))
     self.dataset_received = True
     response = hogwild_pb2.Empty()
     return response
Beispiel #4
0
 def GetNodeInfo(self, request, context):
     print('Received node network information!')
     self.coordinator_address = request.coordinator_address
     self.node_addresses = request.node_addresses
     print('Coordinator at {}'.format(self.coordinator_address))
     print('Other nodes at {}'.format(self.node_addresses))
     for node_addr in list(self.node_addresses) + [str(self.coordinator_address)]:
         channel = grpc.insecure_channel(node_addr)
         stub = hogwild_pb2_grpc.HogwildStub(channel)
         self.stubs[node_addr] = stub
     response = hogwild_pb2.Empty()
     return response
Beispiel #5
0
 def GetEpochsDone(self, request, context):
     self.epochs_done += 1
     response = hogwild_pb2.Empty()
     return response
Beispiel #6
0
 def GetReadyToGo(self, request, context):
     self.ready_to_go_counter += 1
     response = hogwild_pb2.Empty()
     return response