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

Unified Diff: tracing/tracing/base/statistics.html

Issue 2162963002: [polymer] Merge of master into polymer10-migration (Closed) Base URL: git@github.com:catapult-project/catapult.git@polymer10-migration
Patch Set: Merge polymer10-migration int polymer10-merge Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/base/range.html ('k') | tracing/tracing/base/statistics_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/base/statistics.html
diff --git a/tracing/tracing/base/statistics.html b/tracing/tracing/base/statistics.html
index 3b3408c0342701f8005a4042c8a124306cc77270..5aa686ab0e80d0b0a6812949acd67fee9667410f 100644
--- a/tracing/tracing/base/statistics.html
+++ b/tracing/tracing/base/statistics.html
@@ -7,6 +7,26 @@ found in the LICENSE file.
<link rel="import" href="/tracing/base/math.html">
<link rel="import" href="/tracing/base/range.html">
+<script src="/mannwhitneyu/mannwhitneyu.js"></script>
+
+<script>
+'use strict';
+// In node, the script-src for mannwhitneyu above brings in mannwhitneyui
+// into a module, instead of into the global scope. Whereas this file
+// assumes that mannwhitneyu is in the global scope. So, in Node only, we
+// require() it in, and then take all its exports and shove them into the
+// global scope by hand.
+(function(global) {
+ if (tr.isNode) {
+ var mwuAbsPath = HTMLImportsLoader.hrefToAbsolutePath(
+ '/mannwhitneyu.js');
+ var mwuModule = require(mwuAbsPath);
+ for (var exportName in mwuModule) {
+ global[exportName] = mwuModule[exportName];
+ }
+ }
+})(this);
+</script>
<script>
'use strict';
@@ -131,13 +151,6 @@ tr.exportTo('tr.b', function() {
return tmp[idx];
};
- /* Clamp a value between some low and high value. */
- Statistics.clamp = function(value, opt_low, opt_high) {
- opt_low = opt_low || 0.0;
- opt_high = opt_high || 1.0;
- return Math.min(Math.max(value, opt_low), opt_high);
- };
-
/**
* Sorts the samples, and map them linearly to the range [0,1].
*
@@ -342,8 +355,8 @@ tr.exportTo('tr.b', function() {
discrepancy /= sample_scale;
} else {
// Compute relative discrepancy
- discrepancy = Statistics.clamp(
- (discrepancy - inv_sample_count) / (1.0 - inv_sample_count));
+ discrepancy = tr.b.clamp(
+ (discrepancy - inv_sample_count) / (1.0 - inv_sample_count), 0.0, 1.0);
}
return discrepancy;
};
@@ -739,6 +752,8 @@ tr.exportTo('tr.b', function() {
return new Statistics.LogNormalDistribution(location, shape);
};
+ Statistics.mwu = mannwhitneyu;
+
return {
Statistics: Statistics
};
« no previous file with comments | « tracing/tracing/base/range.html ('k') | tracing/tracing/base/statistics_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698