示例#1
0
 def start(self):
     measurement = []
     for i in range(self.repeat):
         measure = []
         splitted_dataset = cross.split_list(self.raw_data, self.k, True)
         k_fold = cross.KFold(splitted_dataset)
         for fold in k_fold:
             stats, class_prob = NormalDist.calc_normal_stats(fold[0])
             confusion_matrices = ConfusionMatrix.ConfusionMatrixStatistic(
                 stats)
             for item in fold[1]:
                 confusion_matrices.add_result(
                     item[len(item) - 1],
                     NormalDist.get_class(stats, class_prob, item))
             measure.append(confusion_matrices.calc_stats())
         measurement.append(ConfusionMatrix.Measure.connect(measure))
     return ConfusionMatrix.Measure.connect(measurement)
示例#2
0
 def start(self):
     measurement = []
     for i in range(self.repeat):
         measure = []
         splitted_dataset = cross.split_list(self.raw_data, self.k, True)
         k_fold = cross.KFold(splitted_dataset)
         for fold in k_fold:
             stats, class_prob, buckets = edp.create_dictionary_with_buckets(
                 self.raw_data, fold[0], self.bins)
             confusion_matrices = ConfusionMatrix.ConfusionMatrixStatistic(
                 stats)
             for item in fold[1]:
                 confusion_matrices.add_result(
                     item[len(item) - 1],
                     edp.get_class(stats, class_prob, buckets, item))
             measure.append(confusion_matrices.calc_stats())
         measurement.append(ConfusionMatrix.Measure.connect(measure))
     return ConfusionMatrix.Measure.connect(measurement)