Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: appengine/findit/crash/scorers/aggregated_scorer.py

Issue 2157433002: [Findit] Pass changed files info to Fracas, 2 face design. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nits. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Uses aggregators to aggregator results from different scorers."""
chanli 2016/07/21 21:10:29 Nit: to aggregate ?
Sharu Jiang 2016/07/21 21:19:32 Done.
6
7 from crash.scorers import aggregators
8
9
10 class AggregatedScorer(object):
11
12 def __init__(self, scorers):
13 self.scorers = scorers
14
15 def Score(self, result,
16 score_aggregator=aggregators.Multiplier(),
17 reasons_aggregator=aggregators.IdentityAggregator(),
18 changed_files_aggregator=aggregators.ChangedFilesAggregator()):
19 """Aggregates score, reasons and changed_files from all the scorers.
20
21 Note: This method sets confidence, reasons and changed_files of results.
22 """
23 # Transforms array of [(score1, reason1, changed_files1), (score2, reason2,
24 # changed_files2)] to [(score1, score2), (reason1, reason2),
25 # (changed_files1, changed_files2)] for aggregators to aggregate.
26 scores, reasons, changed_files = zip(*[
27 scorer(result) for scorer in self.scorers])
28
29 result.confidence = score_aggregator(list(scores))
30 result.reasons = reasons_aggregator(list(reasons))
31 result.changed_files = changed_files_aggregator(list(changed_files))
32
33 return result.confidence, result.reasons, result.changed_files
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698