示例#1
0
 def extractAlerts(self, predictions_monitoring):
     detection_threshold = self.alerts_conf.detection_threshold
     alerts = matrix_tools.extractRowsWithThresholds(
         predictions_monitoring.predictions, detection_threshold, None,
         'predicted_proba')
     alerts = matrix_tools.sortDataFrame(alerts, 'predicted_proba', False,
                                         False)
     return alerts
 def generateAnnotationQueries(self):
     unsure_df = matrix_tools.extractRowsWithThresholds(self.predictions,
                                                        self.proba_min,
                                                        self.proba_max,
                                                        'predicted_proba',
                                                        deepcopy=True)
     unsure_df['predicted_proba'] = abs(unsure_df['predicted_proba'] - 0.5)
     matrix_tools.sortDataFrame(unsure_df, 'predicted_proba', True, True)
     if self.num_annotations is not None and len(
             unsure_df) > self.num_annotations:
         unsure_df = unsure_df.head(n=self.num_annotations)
     for instance_id, row in unsure_df.iterrows():
         query = self.generateAnnotationQuery(instance_id,
                                              row['predicted_proba'], None,
                                              None)
         self.annotation_queries.append(query)
示例#3
0
 def runModels(self, already_queried=None):
     df = matrix_tools.extractRowsWithThresholds(self.predictions,
                                                 self.proba_min,
                                                 self.proba_max,
                                                 'predicted_proba')
     if already_queried is not None:
         self.predicted_ids = list(
             set(df.index).difference(set(already_queried)))
     else:
         self.predicted_ids = list(df.index)
     datasets = self.iteration.datasets
     self.annotated_instances = datasets.getAnnotatedInstances(
         label=self.label)
     self.families_analysis = self.familiesAnalysis()
     if self.families_analysis:
         self.annotations_type = 'families'
         start_time = time.time()
         self.buildCategories()
         self.analysis_time = time.time() - start_time
         self.categories.setLikelihood()
     else:
         self.annotations_type = 'individual'
         self.categories = None
         self.analysis_time = 0