def __init__(self, outer_boundary=False, **kwargs): if "offset_factor" in kwargs: kwargs.pop("offset_factor") RmmPerceptronNode.__init__(self, offset_factor=0, **kwargs) self.set_permanent_attributes( b=1, weight=[1, 1], one_class=True, outer_boundary=outer_boundary, samples="unused")
def __init__(self, outer_boundary=False, **kwargs): if "offset_factor" in kwargs: kwargs.pop("offset_factor") RmmPerceptronNode.__init__(self, offset_factor=0, **kwargs) self.set_permanent_attributes(b=1, weight=[1, 1], one_class=True, outer_boundary=outer_boundary, samples="unused")
def _execute(self, data): result = RmmPerceptronNode._execute(self, data) label = result.label prediction = result.prediction + 1 if prediction > 0: label = self.classes[1] elif 0 >= prediction > -1.0 * self.range + 1: label = self.classes[0] elif -1.0 * self.range + 1 >= prediction and self.outer_boundary: label = self.classes[1] prediction += self.range - 1 elif -1.0 * self.range + 1 >= prediction: label = self.classes[0] return PredictionVector(prediction=prediction, label=label, predictor=self)