Ejemplo n.º 1
0
 def __init__(self, model=None, training_instances=None):
     learner.__init__(self)
     if model:
         self.set_model(model)
     else:
         self.model = None
     self.training_instances = training_instances
Ejemplo n.º 2
0
 def __init__(self, base_model=None, training_instances=None, attacker=None,
              params: Dict = None):
     learner.__init__(self)
     self.model = Model(base_model)
     # self.attack_alg = None  # Type: class
     # self.adv_params = None
     self.attacker = attacker  # Type: Adversary
     self.set_training_instances(training_instances)
     self.iteration_times = 5  # int: control the number of rounds directly
Ejemplo n.º 3
0
 def __init__(self, params=None, training_instances=None):
     learner.__init__(self)
     self.weight_vector = None
     self.bias = 0
     self.c_delta = 0.5
     if params is not None:
         self.set_params(params)
     if training_instances is not None:
         self.set_training_instances(training_instances)
Ejemplo n.º 4
0
    def __init__(self, training_instances=None, params=None):

        learner.__init__(self)
        self.weight_vector = None  # type: np.array(shape=(1))
        self.num_features = 0  # type: int
        self.hinge_loss_multiplier = 0.5  # type: float
        self.max_feature_deletion = 30  # type: int
        self.bias = 0  # type: int
        if params is not None:
            self.set_params(params)
        if training_instances is not None:
            self.set_training_instances(training_instances)
Ejemplo n.º 5
0
    def __init__(self, training_instances: List[Instance], n: int, lda=0.1,
                 verbose=False):
        """
        :param training_instances: the instances on which to train
        :param n: the number of unpoisoned instances in training_instances - the
                  size of the original dataset
        :param lda: lambda - for regularization term
        :param verbose: if True, the solver will be in verbose mode
        """

        learner.__init__(self)
        self.training_instances = training_instances
        self.n = n
        self.lda = lda  # lambda
        self.verbose = verbose
        self.num_features = self.training_instances[0].get_feature_count()
        self.w = None
        self.b = None
Ejemplo n.º 6
0
 def __init__(self):
     learner.__init__(self)
     raise NotImplementedError