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

Side by Side Diff: chrome/renderer/safe_browsing/scorer.cc

Issue 7017032: Roll out v1 of the client-side phishing detection model, to replace v0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delete the old version of the model Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/chrome_constants.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/renderer/safe_browsing/scorer.h" 5 #include "chrome/renderer/safe_browsing/scorer.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 17 matching lines...) Expand all
28 28
29 void RecordScorerCreationStatus(ScorerCreationStatus status) { 29 void RecordScorerCreationStatus(ScorerCreationStatus status) {
30 UMA_HISTOGRAM_ENUMERATION("SBClientPhishing.ScorerCreationStatus", 30 UMA_HISTOGRAM_ENUMERATION("SBClientPhishing.ScorerCreationStatus",
31 status, 31 status,
32 SCORER_STATUS_MAX); 32 SCORER_STATUS_MAX);
33 } 33 }
34 } // namespace 34 } // namespace
35 35
36 namespace safe_browsing { 36 namespace safe_browsing {
37 37
38 const int Scorer::kMaxPhishingModelSizeBytes = 70 * 1024; 38 const int Scorer::kMaxPhishingModelSizeBytes = 90 * 1024;
39 39
40 // Helper function which converts log odds to a probability in the range 40 // Helper function which converts log odds to a probability in the range
41 // [0.0,1.0]. 41 // [0.0,1.0].
42 static double LogOdds2Prob(double log_odds) { 42 static double LogOdds2Prob(double log_odds) {
43 // 709 = floor(1023*ln(2)). 2**1023 is the largest finite double. 43 // 709 = floor(1023*ln(2)). 2**1023 is the largest finite double.
44 // Small log odds aren't a problem. as the odds will be 0. It's only 44 // Small log odds aren't a problem. as the odds will be 0. It's only
45 // when we get +infinity for the odds, that odds/(odds+1) would be NaN. 45 // when we get +infinity for the odds, that odds/(odds+1) would be NaN.
46 if (log_odds >= 709) { 46 if (log_odds >= 709) {
47 return 1.0; 47 return 1.0;
48 } 48 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // If the feature of the rule does not exist in the given feature map the 188 // If the feature of the rule does not exist in the given feature map the
189 // feature weight is considered to be zero. If the feature weight is zero 189 // feature weight is considered to be zero. If the feature weight is zero
190 // we leave early since we know that the rule score will be zero. 190 // we leave early since we know that the rule score will be zero.
191 return 0.0; 191 return 0.0;
192 } 192 }
193 rule_score *= it->second; 193 rule_score *= it->second;
194 } 194 }
195 return rule_score * rule.weight(); 195 return rule_score * rule.weight();
196 } 196 }
197 } // namespace safe_browsing 197 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/common/chrome_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698