def __init__()

in model_inversion.py [0:0]


    def __init__(self, train_data, target_attribute, model_type, weights, l2, one_hot=False):
        # Compute marginal counts (proportional to log marginal):
        self.log_marginal = compute_log_marginal(
            train_data, target_attribute, weights=weights, one_hot=one_hot)
        self.one_hot = one_hot
        # Store learned theta for each possible attribute
        self.thetas = torch.zeros(
                train_data["features"].size(0),
                target_attribute[1] - target_attribute[0] + (not one_hot),
                train_data["features"].size(1))
        for i in range(train_data["features"].size(0)):
            tmp = train_data["features"][i, range(*target_attribute)].clone()
            train_data["features"][i, range(*target_attribute)] = 0.
            for c in range(*target_attribute):
                j = c - target_attribute[0]
                train_data["features"][i, c] = 1.
                model = models.get_model(model_type)
                model.train(train_data, l2=l2, weights=weights)
                self.thetas[i, j] = model.theta
                train_data["features"][i, c] = 0.
            if not one_hot:
                # Try all 0s (last attribute)
                model = models.get_model(model_type)
                model.train(train_data, l2=l2, weights=weights)
                self.thetas[i, -1] = model.theta
            train_data["features"][i, range(*target_attribute)] = tmp