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

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

Issue 2707603002: [Predator] Generate all changelogs in regression ranges instead of only matched changelogs (Closed)
Patch Set: . Created 3 years, 10 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 """Aggregated scorer which uses aggregators to aggregate results from
6 different scorers."""
7
8 from crash.scorers import aggregators
9
10
11 class AggregatedScorer(object):
12
13 def __init__(self, scorers):
14 self.scorers = scorers
15
16 def Score(self, result,
17 score_aggregator=aggregators.Multiplier(),
18 reasons_aggregator=aggregators.IdentityAggregator(),
19 changed_files_aggregator=aggregators.ChangedFilesAggregator()):
20 """Aggregates score, reasons and changed_files from all the scorers.
21
22 Note: This method sets confidence, reasons and changed_files of results.
23 """
24 # Transforms array of [(score1, reason1, changed_files1), (score2, reason2,
25 # changed_files2)] to [(score1, score2), (reason1, reason2),
26 # (changed_files1, changed_files2)] for aggregators to aggregate.
27 scores, reasons, changed_files = zip(*[
28 scorer(result) for scorer in self.scorers])
29
30 result.confidence = score_aggregator(list(scores))
31 result.reasons = reasons_aggregator(list(reasons))
32 result.changed_files = changed_files_aggregator(list(changed_files))
33
34 return result.confidence, result.reasons, result.changed_files
OLDNEW
« no previous file with comments | « appengine/findit/crash/scorers/__init__.py ('k') | appengine/findit/crash/scorers/aggregators.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698