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

Side by Side Diff: appengine/findit/crash/loglinear/test/loglinear_testcase.py

Issue 2617273002: [Predator] Move ``SingleFeatureScore`` to LLM. (Closed)
Patch Set: . Created 3 years, 11 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
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 import random 5 import random
6 import unittest 6 import unittest
7 7
8 from crash.loglinear.feature import FeatureValue 8 from crash.loglinear.feature import FeatureValue
9 from crash.loglinear.model import ToFeatureFunction 9 from crash.loglinear.model import ToFeatureFunction
10 10
(...skipping 27 matching lines...) Expand all
38 38
39 def feature2(x): 39 def feature2(x):
40 return lambda y: FeatureValue('feature2', y == (x <= 7), None, None) 40 return lambda y: FeatureValue('feature2', y == (x <= 7), None, None)
41 41
42 self._feature_list = [feature0, feature1, feature2] 42 self._feature_list = [feature0, feature1, feature2]
43 self._feature_function = ToFeatureFunction(self._feature_list) 43 self._feature_function = ToFeatureFunction(self._feature_list)
44 self._qty_features = len(self._feature_list) 44 self._qty_features = len(self._feature_list)
45 self._X = range(10) 45 self._X = range(10)
46 self._Y = lambda _x: [False, True] 46 self._Y = lambda _x: [False, True]
47 self._weights = [random.random() for _ in xrange(self._qty_features)] 47 self._weights = [random.random() for _ in xrange(self._qty_features)]
48 self._feature_to_weight = {'feature0': self._weights[0],
49 'feature1': self._weights[1],
50 'feature2': self._weights[2]}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698