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

Side by Side Diff: src/shared/random_test.cc

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 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
« no previous file with comments | « src/shared/random.h ('k') | src/shared/selectors.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 #include "src/shared/assert.h" 5 #include "src/shared/assert.h"
6 #include "src/shared/test_case.h" 6 #include "src/shared/test_case.h"
7 #include "src/shared/random.h" 7 #include "src/shared/random.h"
8 8
9 namespace fletch { 9 namespace dartino {
10 10
11 // Chi squared for getting m 0s out of n bits. 11 // Chi squared for getting m 0s out of n bits.
12 double ChiSquared(int m, int n) { 12 double ChiSquared(int m, int n) {
13 double ys_minus_np1 = (m - n / 2.0); 13 double ys_minus_np1 = (m - n / 2.0);
14 double chi_squared_1 = ys_minus_np1 * ys_minus_np1 * 2.0 / n; 14 double chi_squared_1 = ys_minus_np1 * ys_minus_np1 * 2.0 / n;
15 double ys_minus_np2 = ((n - m) - n / 2.0); 15 double ys_minus_np2 = ((n - m) - n / 2.0);
16 double chi_squared_2 = ys_minus_np2 * ys_minus_np2 * 2.0 / n; 16 double chi_squared_2 = ys_minus_np2 * ys_minus_np2 * 2.0 / n;
17 return chi_squared_1 + chi_squared_2; 17 return chi_squared_1 + chi_squared_2;
18 } 18 }
19 19
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 EXPECT(chi_squared <= 24); 80 EXPECT(chi_squared <= 24);
81 81
82 // If the predictor bit is a fixed 0 or 1 then it makes no sense to 82 // If the predictor bit is a fixed 0 or 1 then it makes no sense to
83 // repeat the test with a different age. 83 // repeat the test with a different age.
84 if (predictor_bit < 0) break; 84 if (predictor_bit < 0) break;
85 } 85 }
86 } 86 }
87 } 87 }
88 } 88 }
89 89
90 } // namespace fletch 90 } // namespace dartino
OLDNEW
« no previous file with comments | « src/shared/random.h ('k') | src/shared/selectors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698