예제 #1
0
 def to_json(self, f):
     perf = {}
     if self.auc:
         perf['auc'] = {
             'mean': to_percentage(self.auc_mean),
             'std': trunc(self.auc_std)
         }
     if self.probabilist:
         perf['thresholds'] = [{} for x in self.thresholds]
         for t in self.thresholds:
             summary = self.perf_threshold_summary[t]
             for v in summary.index:
                 perf['thresholds'][t][v] = {}
                 perf['thresholds'][t][v]['mean'] = to_percentage(
                     summary.loc[v, 'mean'])
                 perf['thresholds'][t][v]['std'] = trunc(summary.loc[v,
                                                                     'std'])
     else:
         for v in self.perf_threshold_summary.index:
             perf[v] = {}
             perf[v]['mean'] = to_percentage(
                 self.perf_threshold_summary.loc[v, 'mean'])
             perf[v]['std'] = trunc(self.perf_threshold_summary.loc[v,
                                                                    'std'])
     json.dump(perf, f, indent=2)
예제 #2
0
 def to_json(self, f):
     perf = {}
     perf['accuracy'] = {
         'mean': to_percentage(self.accuracy_mean),
         'std': trunc(self.accuracy_std)
     }
     perf['f1_micro'] = {
         'mean': to_percentage(self.f1_micro_mean),
         'std': trunc(self.f1_micro_std)
     }
     perf['f1_macro'] = {
         'mean': to_percentage(self.f1_macro_mean),
         'std': trunc(self.f1_macro_std)
     }
     json.dump(perf, f, indent=2)
예제 #3
0
 def get_exp_name(self):
     name = '__AlertsAnalysis__'
     name += 'threshold_%s__' % to_percentage(self.detection_threshold)
     if self.clustering_conf is not None:
         name += self.clustering_conf.get_exp_name()
     elif self.classifier_conf is not None:
         name += self.classifier_conf.get_exp_name()
     return name
예제 #4
0
 def get_exp_name(self):
     return '__Test_TemporalSplit_%s_%s' % (
                                         to_percentage(self.test_size),
                                         OneFoldTestConf.get_exp_name(self))
예제 #5
0
파일: alerts.py 프로젝트: tuantmb/SecuML
 def get_exp_name(self):
     return '__detectionThreshold_%s__%s' % (to_percentage(
         self.detection_threshold), self.clustering_conf.get_exp_name())