| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from collections import defaultdict | 5 from collections import defaultdict |
| 6 import logging | 6 import logging |
| 7 | 7 |
| 8 from common.chrome_dependency_fetcher import ChromeDependencyFetcher | 8 from common.chrome_dependency_fetcher import ChromeDependencyFetcher |
| 9 from crash.stacktrace import StackInfo | |
| 10 from crash.suspect import Suspect | 9 from crash.suspect import Suspect |
| 11 from crash.crash_report import CrashReport | 10 from crash.crash_report import CrashReport |
| 12 from crash.loglinear.model import UnnormalizedLogLinearModel | 11 from crash.loglinear.model import UnnormalizedLogLinearModel |
| 13 | 12 |
| 14 | 13 |
| 15 class LogLinearChangelistClassifier(object): | 14 class LogLinearChangelistClassifier(object): |
| 16 """A ``LogLinearModel``-based implementation of CL classification.""" | 15 """A ``LogLinearModel``-based implementation of CL classification.""" |
| 17 | 16 |
| 18 def __init__(self, get_repository, meta_feature, meta_weight, | 17 def __init__(self, get_repository, meta_feature, meta_weight, |
| 19 top_n_frames=7, top_n_suspects=3): | 18 top_n_frames=7, top_n_suspects=3): |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 suspect.confidence = score | 128 suspect.confidence = score |
| 130 # features is ``MetaFeatureValue`` object containing all feature values. | 129 # features is ``MetaFeatureValue`` object containing all feature values. |
| 131 features = features_given_report(suspect) | 130 features = features_given_report(suspect) |
| 132 suspect.reasons = features.reason | 131 suspect.reasons = features.reason |
| 133 suspect.changed_files = [changed_file.ToDict() | 132 suspect.changed_files = [changed_file.ToDict() |
| 134 for changed_file in features.changed_files] | 133 for changed_file in features.changed_files] |
| 135 scored_suspects.append(suspect) | 134 scored_suspects.append(suspect) |
| 136 | 135 |
| 137 scored_suspects.sort(key=lambda suspect: -suspect.confidence) | 136 scored_suspects.sort(key=lambda suspect: -suspect.confidence) |
| 138 return scored_suspects[:self._top_n_suspects] | 137 return scored_suspects[:self._top_n_suspects] |
| OLD | NEW |