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

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

Issue 2595263003: [Predator] Making the Y sets conditional for loglinear models (Closed)
Patch Set: minor clarification in crash/suspect.py Created 3 years, 12 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 25 matching lines...) Expand all
36 def feature1(x): 36 def feature1(x):
37 return lambda y: FeatureValue('feature1', y == ((x % 2) == 1), None, None) 37 return lambda y: FeatureValue('feature1', y == ((x % 2) == 1), None, None)
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 = [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)]
OLDNEW
« no previous file with comments | « appengine/findit/crash/loglinear/model.py ('k') | appengine/findit/crash/loglinear/test/model_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698