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

Side by Side Diff: appengine/findit/libs/math/test/functions_test.py

Issue 2517383005: Implementing loglinear classification (without training), for CL classification (Closed)
Patch Set: breaking apart normalized and unnormalized models Created 4 years 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 unittest 5 import unittest
6 6
7 from libs.math.functions import Function 7 from libs.math.functions import Function
8 from libs.math.functions import MemoizedFunction 8 from libs.math.functions import MemoizedFunction
9 9
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 """``MemoizedFunction._ClearMemos`` does actually clear the memos. 51 """``MemoizedFunction._ClearMemos`` does actually clear the memos.
52 52
53 That is, we call the underlying function once (to set the memo), 53 That is, we call the underlying function once (to set the memo),
54 then swap put the underlying function with a different one (to be 54 then swap put the underlying function with a different one (to be
55 sure we know whether the next ``__call__`` goes to the memos or to 55 sure we know whether the next ``__call__`` goes to the memos or to
56 the function), and finally clear the memos and check. 56 the function), and finally clear the memos and check.
57 """ 57 """
58 f = MemoizedFunction(_F) 58 f = MemoizedFunction(_F)
59 f(5) 59 f(5)
60 f._f = _G 60 f._f = _G
61 f._ClearMemos() 61 f.ClearMemos()
62 self.assertEqual(_G(5), f(5)) 62 self.assertEqual(_G(5), f(5))
OLDNEW
« appengine/findit/crash/loglinear.py ('K') | « appengine/findit/libs/math/functions.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698