Example #1
0
 def __init__(self, base_dataset, offset_fun):
     """new dataset which is like base_dataset,
        but offset_fun(e) is subtracted from the target of each example e
     """
     self.base_dataset = base_dataset
     self.offset_fun = offset_fun
     Data_set.__init__(self, base_dataset.train, base_dataset.test,
                       base_dataset.prob_test, base_dataset.target_index)
Example #2
0
 def __init__(self, prob, train_size, test_size=100):
     """a data set of with train_size training examples,
     test_size test examples
     where each examples in generated where prob i the probability of 1
     """
     train = [[1] if random.random() < prob else [0]
              for i in range(train_size)]
     test = [[1] if random.random() < prob else [0]
             for i in range(test_size)]
     Data_set.__init__(self, train, test, target_index=0)