Socket
Socket
Sign inDemoInstall

@tracerbench/stats

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tracerbench/stats - npm Package Compare versions

Comparing version 4.4.0 to 4.5.0

15

dist/src/stats.d.ts

@@ -0,1 +1,9 @@

export interface Bucket {
min: number;
max: number;
count: {
control: number;
experiment: number;
};
}
export interface ISevenFigureSummary {

@@ -54,3 +62,7 @@ min: number;

readonly controlSortedMS: number[];
private range;
readonly buckets: Bucket[];
readonly range: {
min: number;
max: number;
};
constructor(options: IStatsOptions);

@@ -64,3 +76,4 @@ private getOutliers;

private getSparkline;
private getBuckets;
}
//# sourceMappingURL=stats.d.ts.map

@@ -49,2 +49,3 @@ "use strict";

};
this.buckets = this.getBuckets(this.controlSortedMS, this.experimentSortedMS);
}

@@ -130,4 +131,39 @@ getOutliers(a, sevenFigSum) {

}
getBuckets(controlSortedMS, experimentSortedMS, bucketCount = 12) {
const { min, max } = this.range;
const buffer = 1;
const minBuffer = min - buffer;
const maxBuffer = max + buffer;
const bucketIncrementor = (maxBuffer - minBuffer) / bucketCount;
const buckets = [];
let count = minBuffer;
while (count < maxBuffer) {
buckets.push({
min: Math.floor(count),
max: Math.floor(count + bucketIncrementor),
count: {
control: 0,
experiment: 0
}
});
count += bucketIncrementor;
}
// since we use a buffer all samples will be caught
// within each bucket regardless of comparator
buckets.map((bucket) => {
controlSortedMS.map((sample) => {
if (sample >= bucket.min && sample < bucket.max) {
bucket.count.control++;
}
});
experimentSortedMS.map((sample) => {
if (sample >= bucket.min && sample < bucket.max) {
bucket.count.experiment++;
}
});
});
return buckets;
}
}
exports.Stats = Stats;
//# sourceMappingURL=stats.js.map

4

package.json
{
"name": "@tracerbench/stats",
"version": "4.4.0",
"version": "4.5.0",
"description": "Stats class written in TS-Node",

@@ -66,3 +66,3 @@ "keywords": [

"engine": "node >= 10",
"gitHead": "3318ea593f5a8acacaae323e650bc03539eb04b2"
"gitHead": "04279ba7bba961c4201e0b555cb7f09e3b1593c5"
}

@@ -7,2 +7,11 @@ import { cross, histogram, quantile } from 'd3-array';

export interface Bucket {
min: number;
max: number;
count: {
control: number;
experiment: number;
};
}
export interface ISevenFigureSummary {

@@ -58,3 +67,4 @@ min: number;

public readonly controlSortedMS: number[];
private range: { min: number; max: number };
public readonly buckets: Bucket[];
public readonly range: { min: number; max: number };
constructor(options: IStatsOptions) {

@@ -154,2 +164,6 @@ const { name, control, experiment, confidenceLevel } = options;

};
this.buckets = this.getBuckets(
this.controlSortedMS,
this.experimentSortedMS
);
}

@@ -273,2 +287,44 @@

}
private getBuckets(
controlSortedMS: number[],
experimentSortedMS: number[],
bucketCount = 12
): Bucket[] {
const { min, max } = this.range;
const buffer = 1;
const minBuffer = min - buffer;
const maxBuffer = max + buffer;
const bucketIncrementor = (maxBuffer - minBuffer) / bucketCount;
const buckets = [];
let count = minBuffer;
while (count < maxBuffer) {
buckets.push({
min: Math.floor(count),
max: Math.floor(count + bucketIncrementor),
count: {
control: 0,
experiment: 0
}
});
count += bucketIncrementor;
}
// since we use a buffer all samples will be caught
// within each bucket regardless of comparator
buckets.map((bucket) => {
controlSortedMS.map((sample) => {
if (sample >= bucket.min && sample < bucket.max) {
bucket.count.control++;
}
});
experimentSortedMS.map((sample) => {
if (sample >= bucket.min && sample < bucket.max) {
bucket.count.experiment++;
}
});
});
return buckets;
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc