evalsense 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -66
- package/dist/{chunk-BE7CB3AM.cjs → chunk-BFGA2NUB.cjs} +40 -10
- package/dist/chunk-BFGA2NUB.cjs.map +1 -0
- package/dist/{chunk-K6QPJ2NO.js → chunk-IYLSY7NX.js} +40 -10
- package/dist/chunk-IYLSY7NX.js.map +1 -0
- package/dist/cli.cjs +11 -11
- package/dist/cli.js +1 -1
- package/dist/index.cjs +82 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BE7CB3AM.cjs.map +0 -1
- package/dist/chunk-K6QPJ2NO.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkBFGA2NUB_cjs = require('./chunk-BFGA2NUB.cjs');
|
|
4
4
|
require('./chunk-JEQ2X3Z6.cjs');
|
|
5
5
|
var fs = require('fs');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
|
|
8
8
|
// src/core/describe.ts
|
|
9
9
|
function describe(name, fn) {
|
|
10
|
-
const parentSuite =
|
|
10
|
+
const parentSuite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
11
11
|
const suite = {
|
|
12
12
|
name,
|
|
13
13
|
tests: [],
|
|
@@ -16,37 +16,37 @@ function describe(name, fn) {
|
|
|
16
16
|
beforeEach: [],
|
|
17
17
|
afterEach: []
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
chunkBFGA2NUB_cjs.setCurrentSuite(suite);
|
|
20
20
|
try {
|
|
21
21
|
fn();
|
|
22
22
|
} finally {
|
|
23
|
-
|
|
23
|
+
chunkBFGA2NUB_cjs.setCurrentSuite(parentSuite);
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
chunkBFGA2NUB_cjs.addSuite(suite);
|
|
26
26
|
}
|
|
27
27
|
function beforeAll(fn) {
|
|
28
|
-
const suite =
|
|
28
|
+
const suite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
29
29
|
if (!suite) {
|
|
30
30
|
throw new Error("beforeAll() must be called inside a describe() block");
|
|
31
31
|
}
|
|
32
32
|
suite.beforeAll?.push(fn);
|
|
33
33
|
}
|
|
34
34
|
function afterAll(fn) {
|
|
35
|
-
const suite =
|
|
35
|
+
const suite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
36
36
|
if (!suite) {
|
|
37
37
|
throw new Error("afterAll() must be called inside a describe() block");
|
|
38
38
|
}
|
|
39
39
|
suite.afterAll?.push(fn);
|
|
40
40
|
}
|
|
41
41
|
function beforeEach(fn) {
|
|
42
|
-
const suite =
|
|
42
|
+
const suite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
43
43
|
if (!suite) {
|
|
44
44
|
throw new Error("beforeEach() must be called inside a describe() block");
|
|
45
45
|
}
|
|
46
46
|
suite.beforeEach?.push(fn);
|
|
47
47
|
}
|
|
48
48
|
function afterEach(fn) {
|
|
49
|
-
const suite =
|
|
49
|
+
const suite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
50
50
|
if (!suite) {
|
|
51
51
|
throw new Error("afterEach() must be called inside a describe() block");
|
|
52
52
|
}
|
|
@@ -55,7 +55,7 @@ function afterEach(fn) {
|
|
|
55
55
|
|
|
56
56
|
// src/core/eval-test.ts
|
|
57
57
|
function evalTest(name, fn) {
|
|
58
|
-
const currentSuite =
|
|
58
|
+
const currentSuite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
59
59
|
if (!currentSuite) {
|
|
60
60
|
throw new Error("evalTest() must be called inside a describe() block");
|
|
61
61
|
}
|
|
@@ -63,12 +63,12 @@ function evalTest(name, fn) {
|
|
|
63
63
|
name,
|
|
64
64
|
fn
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
chunkBFGA2NUB_cjs.addTestToCurrentSuite(test2);
|
|
67
67
|
}
|
|
68
68
|
var test = evalTest;
|
|
69
69
|
var it = evalTest;
|
|
70
70
|
function evalTestSkip(name, _fn) {
|
|
71
|
-
const currentSuite =
|
|
71
|
+
const currentSuite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
72
72
|
if (!currentSuite) {
|
|
73
73
|
throw new Error("evalTest.skip() must be called inside a describe() block");
|
|
74
74
|
}
|
|
@@ -77,10 +77,10 @@ function evalTestSkip(name, _fn) {
|
|
|
77
77
|
fn: async () => {
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
chunkBFGA2NUB_cjs.addTestToCurrentSuite(test2);
|
|
81
81
|
}
|
|
82
82
|
function evalTestOnly(name, fn) {
|
|
83
|
-
const currentSuite =
|
|
83
|
+
const currentSuite = chunkBFGA2NUB_cjs.getCurrentSuite();
|
|
84
84
|
if (!currentSuite) {
|
|
85
85
|
throw new Error("evalTest.only() must be called inside a describe() block");
|
|
86
86
|
}
|
|
@@ -88,7 +88,7 @@ function evalTestOnly(name, fn) {
|
|
|
88
88
|
name: `[ONLY] ${name}`,
|
|
89
89
|
fn
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
chunkBFGA2NUB_cjs.addTestToCurrentSuite(test2);
|
|
92
92
|
}
|
|
93
93
|
evalTest.skip = evalTestSkip;
|
|
94
94
|
evalTest.only = evalTestOnly;
|
|
@@ -103,17 +103,17 @@ function loadDataset(path$1) {
|
|
|
103
103
|
} else if (ext === ".json") {
|
|
104
104
|
records = parseJSON(content);
|
|
105
105
|
} else {
|
|
106
|
-
throw new
|
|
106
|
+
throw new chunkBFGA2NUB_cjs.DatasetError(
|
|
107
107
|
`Unsupported file format: ${ext}. Use .json, .ndjson, or .jsonl`,
|
|
108
108
|
path$1
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
} catch (error) {
|
|
112
|
-
if (error instanceof
|
|
112
|
+
if (error instanceof chunkBFGA2NUB_cjs.DatasetError) {
|
|
113
113
|
throw error;
|
|
114
114
|
}
|
|
115
115
|
const message = error instanceof Error ? error.message : String(error);
|
|
116
|
-
throw new
|
|
116
|
+
throw new chunkBFGA2NUB_cjs.DatasetError(`Failed to load dataset from ${path$1}: ${message}`, path$1);
|
|
117
117
|
}
|
|
118
118
|
return {
|
|
119
119
|
records,
|
|
@@ -127,7 +127,7 @@ function loadDataset(path$1) {
|
|
|
127
127
|
function parseJSON(content) {
|
|
128
128
|
const parsed = JSON.parse(content);
|
|
129
129
|
if (!Array.isArray(parsed)) {
|
|
130
|
-
throw new
|
|
130
|
+
throw new chunkBFGA2NUB_cjs.DatasetError("JSON dataset must be an array of records");
|
|
131
131
|
}
|
|
132
132
|
return parsed;
|
|
133
133
|
}
|
|
@@ -140,7 +140,7 @@ function parseNDJSON(content) {
|
|
|
140
140
|
try {
|
|
141
141
|
records.push(JSON.parse(line));
|
|
142
142
|
} catch {
|
|
143
|
-
throw new
|
|
143
|
+
throw new chunkBFGA2NUB_cjs.DatasetError(`Invalid JSON at line ${i + 1} in NDJSON file`);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
return records;
|
|
@@ -165,7 +165,7 @@ async function runModel(dataset, modelFn) {
|
|
|
165
165
|
const id = getRecordId(record);
|
|
166
166
|
const prediction = await modelFn(record);
|
|
167
167
|
if (prediction.id !== id) {
|
|
168
|
-
throw new
|
|
168
|
+
throw new chunkBFGA2NUB_cjs.DatasetError(
|
|
169
169
|
`Prediction ID mismatch: expected "${id}", got "${prediction.id}". Model function must return the same ID as the input record.`
|
|
170
170
|
);
|
|
171
171
|
}
|
|
@@ -185,7 +185,7 @@ async function runModel(dataset, modelFn) {
|
|
|
185
185
|
function getRecordId(record) {
|
|
186
186
|
const id = record.id ?? record._id;
|
|
187
187
|
if (id === void 0 || id === null) {
|
|
188
|
-
throw new
|
|
188
|
+
throw new chunkBFGA2NUB_cjs.DatasetError('Dataset records must have an "id" or "_id" field for alignment');
|
|
189
189
|
}
|
|
190
190
|
return String(id);
|
|
191
191
|
}
|
|
@@ -207,7 +207,7 @@ async function runModelParallel(dataset, modelFn, concurrency = 10) {
|
|
|
207
207
|
for (const { prediction, record } of results) {
|
|
208
208
|
const id = getRecordId(record);
|
|
209
209
|
if (prediction.id !== id) {
|
|
210
|
-
throw new
|
|
210
|
+
throw new chunkBFGA2NUB_cjs.DatasetError(`Prediction ID mismatch: expected "${id}", got "${prediction.id}".`);
|
|
211
211
|
}
|
|
212
212
|
predictions.push(prediction);
|
|
213
213
|
aligned.push({
|
|
@@ -232,7 +232,7 @@ function alignByKey(predictions, expected, options = {}) {
|
|
|
232
232
|
for (const record of expected) {
|
|
233
233
|
const id = String(record[expIdField] ?? record._id);
|
|
234
234
|
if (!id || id === "undefined") {
|
|
235
|
-
throw new
|
|
235
|
+
throw new chunkBFGA2NUB_cjs.IntegrityError(
|
|
236
236
|
`Expected record missing ${expIdField} field: ${JSON.stringify(record)}`
|
|
237
237
|
);
|
|
238
238
|
}
|
|
@@ -243,7 +243,7 @@ function alignByKey(predictions, expected, options = {}) {
|
|
|
243
243
|
for (const prediction of predictions) {
|
|
244
244
|
const id = String(prediction[predIdField]);
|
|
245
245
|
if (!id || id === "undefined") {
|
|
246
|
-
throw new
|
|
246
|
+
throw new chunkBFGA2NUB_cjs.IntegrityError(
|
|
247
247
|
`Prediction missing ${predIdField} field: ${JSON.stringify(prediction)}`
|
|
248
248
|
);
|
|
249
249
|
}
|
|
@@ -267,7 +267,7 @@ function alignByKey(predictions, expected, options = {}) {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
if (strict && missingIds.length > 0) {
|
|
270
|
-
throw new
|
|
270
|
+
throw new chunkBFGA2NUB_cjs.IntegrityError(
|
|
271
271
|
`${missingIds.length} prediction(s) have no matching expected record`,
|
|
272
272
|
missingIds
|
|
273
273
|
);
|
|
@@ -346,7 +346,7 @@ function checkIntegrity(dataset, options = {}) {
|
|
|
346
346
|
if (missingFields.length > 0) {
|
|
347
347
|
issues.push(`${missingFields.length} record(s) missing required fields`);
|
|
348
348
|
}
|
|
349
|
-
throw new
|
|
349
|
+
throw new chunkBFGA2NUB_cjs.IntegrityError(`Dataset integrity check failed: ${issues.join("; ")}`);
|
|
350
350
|
}
|
|
351
351
|
return result;
|
|
352
352
|
}
|
|
@@ -364,7 +364,7 @@ function validatePredictions(predictions, expectedIds) {
|
|
|
364
364
|
|
|
365
365
|
// src/statistics/classification.ts
|
|
366
366
|
function computeClassificationMetrics(actual, expected) {
|
|
367
|
-
const confusionMatrix =
|
|
367
|
+
const confusionMatrix = chunkBFGA2NUB_cjs.buildConfusionMatrix(actual, expected);
|
|
368
368
|
return computeMetricsFromMatrix(confusionMatrix);
|
|
369
369
|
}
|
|
370
370
|
function computeMetricsFromMatrix(cm) {
|
|
@@ -372,10 +372,10 @@ function computeMetricsFromMatrix(cm) {
|
|
|
372
372
|
let totalSupport = 0;
|
|
373
373
|
let correctPredictions = 0;
|
|
374
374
|
for (const label of cm.labels) {
|
|
375
|
-
const tp =
|
|
376
|
-
const fp =
|
|
377
|
-
const fn =
|
|
378
|
-
const support =
|
|
375
|
+
const tp = chunkBFGA2NUB_cjs.getTruePositives(cm, label);
|
|
376
|
+
const fp = chunkBFGA2NUB_cjs.getFalsePositives(cm, label);
|
|
377
|
+
const fn = chunkBFGA2NUB_cjs.getFalseNegatives(cm, label);
|
|
378
|
+
const support = chunkBFGA2NUB_cjs.getSupport(cm, label);
|
|
379
379
|
const precision = tp + fp > 0 ? tp / (tp + fp) : 0;
|
|
380
380
|
const recall = tp + fn > 0 ? tp / (tp + fn) : 0;
|
|
381
381
|
const f1 = precision + recall > 0 ? 2 * precision * recall / (precision + recall) : 0;
|
|
@@ -404,15 +404,15 @@ function computeMetricsFromMatrix(cm) {
|
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
406
|
function computePrecision(actual, expected, targetClass) {
|
|
407
|
-
const cm =
|
|
408
|
-
const tp =
|
|
409
|
-
const fp =
|
|
407
|
+
const cm = chunkBFGA2NUB_cjs.buildConfusionMatrix(actual, expected);
|
|
408
|
+
const tp = chunkBFGA2NUB_cjs.getTruePositives(cm, targetClass);
|
|
409
|
+
const fp = chunkBFGA2NUB_cjs.getFalsePositives(cm, targetClass);
|
|
410
410
|
return tp + fp > 0 ? tp / (tp + fp) : 0;
|
|
411
411
|
}
|
|
412
412
|
function computeRecall(actual, expected, targetClass) {
|
|
413
|
-
const cm =
|
|
414
|
-
const tp =
|
|
415
|
-
const fn =
|
|
413
|
+
const cm = chunkBFGA2NUB_cjs.buildConfusionMatrix(actual, expected);
|
|
414
|
+
const tp = chunkBFGA2NUB_cjs.getTruePositives(cm, targetClass);
|
|
415
|
+
const fn = chunkBFGA2NUB_cjs.getFalseNegatives(cm, targetClass);
|
|
416
416
|
return tp + fn > 0 ? tp / (tp + fn) : 0;
|
|
417
417
|
}
|
|
418
418
|
function computeF1(actual, expected, targetClass) {
|
|
@@ -567,10 +567,7 @@ var BinarizeSelector = class {
|
|
|
567
567
|
field: this.fieldName
|
|
568
568
|
};
|
|
569
569
|
this.assertions.push(result);
|
|
570
|
-
|
|
571
|
-
if (!passed) {
|
|
572
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, threshold, metrics.accuracy, this.fieldName);
|
|
573
|
-
}
|
|
570
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
574
571
|
return this;
|
|
575
572
|
}
|
|
576
573
|
/**
|
|
@@ -591,7 +588,7 @@ var BinarizeSelector = class {
|
|
|
591
588
|
actualThreshold = threshold;
|
|
592
589
|
const classMetrics = metrics.perClass[targetClass];
|
|
593
590
|
if (!classMetrics) {
|
|
594
|
-
throw new
|
|
591
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
595
592
|
`Class "${targetClass}" not found in binarized predictions`,
|
|
596
593
|
targetClass,
|
|
597
594
|
Object.keys(metrics.perClass),
|
|
@@ -611,10 +608,7 @@ var BinarizeSelector = class {
|
|
|
611
608
|
class: targetClass
|
|
612
609
|
};
|
|
613
610
|
this.assertions.push(result);
|
|
614
|
-
|
|
615
|
-
if (!passed) {
|
|
616
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, actualThreshold, actualPrecision, this.fieldName);
|
|
617
|
-
}
|
|
611
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
618
612
|
return this;
|
|
619
613
|
}
|
|
620
614
|
/**
|
|
@@ -635,7 +629,7 @@ var BinarizeSelector = class {
|
|
|
635
629
|
actualThreshold = threshold;
|
|
636
630
|
const classMetrics = metrics.perClass[targetClass];
|
|
637
631
|
if (!classMetrics) {
|
|
638
|
-
throw new
|
|
632
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
639
633
|
`Class "${targetClass}" not found in binarized predictions`,
|
|
640
634
|
targetClass,
|
|
641
635
|
Object.keys(metrics.perClass),
|
|
@@ -655,10 +649,7 @@ var BinarizeSelector = class {
|
|
|
655
649
|
class: targetClass
|
|
656
650
|
};
|
|
657
651
|
this.assertions.push(result);
|
|
658
|
-
|
|
659
|
-
if (!passed) {
|
|
660
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, actualThreshold, actualRecall, this.fieldName);
|
|
661
|
-
}
|
|
652
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
662
653
|
return this;
|
|
663
654
|
}
|
|
664
655
|
/**
|
|
@@ -677,7 +668,7 @@ var BinarizeSelector = class {
|
|
|
677
668
|
actualThreshold = threshold;
|
|
678
669
|
const classMetrics = metrics.perClass[targetClass];
|
|
679
670
|
if (!classMetrics) {
|
|
680
|
-
throw new
|
|
671
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
681
672
|
`Class "${targetClass}" not found in binarized predictions`,
|
|
682
673
|
targetClass,
|
|
683
674
|
Object.keys(metrics.perClass),
|
|
@@ -697,10 +688,7 @@ var BinarizeSelector = class {
|
|
|
697
688
|
class: targetClass
|
|
698
689
|
};
|
|
699
690
|
this.assertions.push(result);
|
|
700
|
-
|
|
701
|
-
if (!passed) {
|
|
702
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, actualThreshold, actualF1, this.fieldName);
|
|
703
|
-
}
|
|
691
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
704
692
|
return this;
|
|
705
693
|
}
|
|
706
694
|
/**
|
|
@@ -714,7 +702,7 @@ var BinarizeSelector = class {
|
|
|
714
702
|
binarized: true,
|
|
715
703
|
binarizeThreshold: this.threshold
|
|
716
704
|
};
|
|
717
|
-
|
|
705
|
+
chunkBFGA2NUB_cjs.recordFieldMetrics(fieldResult);
|
|
718
706
|
const result = {
|
|
719
707
|
type: "confusionMatrix",
|
|
720
708
|
passed: true,
|
|
@@ -722,7 +710,7 @@ var BinarizeSelector = class {
|
|
|
722
710
|
field: this.fieldName
|
|
723
711
|
};
|
|
724
712
|
this.assertions.push(result);
|
|
725
|
-
|
|
713
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
726
714
|
return this;
|
|
727
715
|
}
|
|
728
716
|
/**
|
|
@@ -766,7 +754,7 @@ var FieldSelector = class {
|
|
|
766
754
|
validateGroundTruth() {
|
|
767
755
|
const hasExpected = this.expectedValues.some((v) => v !== void 0 && v !== null);
|
|
768
756
|
if (!hasExpected) {
|
|
769
|
-
throw new
|
|
757
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
770
758
|
`Classification metric requires ground truth, but field "${this.fieldName}" has no expected values. Use expectStats(predictions, groundTruth) to provide expected values.`,
|
|
771
759
|
void 0,
|
|
772
760
|
void 0,
|
|
@@ -790,10 +778,7 @@ var FieldSelector = class {
|
|
|
790
778
|
field: this.fieldName
|
|
791
779
|
};
|
|
792
780
|
this.assertions.push(result);
|
|
793
|
-
|
|
794
|
-
if (!passed) {
|
|
795
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, threshold, metrics.accuracy, this.fieldName);
|
|
796
|
-
}
|
|
781
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
797
782
|
return this;
|
|
798
783
|
}
|
|
799
784
|
/**
|
|
@@ -815,7 +800,7 @@ var FieldSelector = class {
|
|
|
815
800
|
actualThreshold = threshold;
|
|
816
801
|
const classMetrics = metrics.perClass[targetClass];
|
|
817
802
|
if (!classMetrics) {
|
|
818
|
-
throw new
|
|
803
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
819
804
|
`Class "${targetClass}" not found in predictions`,
|
|
820
805
|
targetClass,
|
|
821
806
|
Object.keys(metrics.perClass),
|
|
@@ -835,10 +820,7 @@ var FieldSelector = class {
|
|
|
835
820
|
class: targetClass
|
|
836
821
|
};
|
|
837
822
|
this.assertions.push(result);
|
|
838
|
-
|
|
839
|
-
if (!passed) {
|
|
840
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, actualThreshold, actualPrecision, this.fieldName);
|
|
841
|
-
}
|
|
823
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
842
824
|
return this;
|
|
843
825
|
}
|
|
844
826
|
/**
|
|
@@ -860,7 +842,7 @@ var FieldSelector = class {
|
|
|
860
842
|
actualThreshold = threshold;
|
|
861
843
|
const classMetrics = metrics.perClass[targetClass];
|
|
862
844
|
if (!classMetrics) {
|
|
863
|
-
throw new
|
|
845
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
864
846
|
`Class "${targetClass}" not found in predictions`,
|
|
865
847
|
targetClass,
|
|
866
848
|
Object.keys(metrics.perClass),
|
|
@@ -880,10 +862,7 @@ var FieldSelector = class {
|
|
|
880
862
|
class: targetClass
|
|
881
863
|
};
|
|
882
864
|
this.assertions.push(result);
|
|
883
|
-
|
|
884
|
-
if (!passed) {
|
|
885
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, actualThreshold, actualRecall, this.fieldName);
|
|
886
|
-
}
|
|
865
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
887
866
|
return this;
|
|
888
867
|
}
|
|
889
868
|
/**
|
|
@@ -905,7 +884,7 @@ var FieldSelector = class {
|
|
|
905
884
|
actualThreshold = threshold;
|
|
906
885
|
const classMetrics = metrics.perClass[targetClass];
|
|
907
886
|
if (!classMetrics) {
|
|
908
|
-
throw new
|
|
887
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
909
888
|
`Class "${targetClass}" not found in predictions`,
|
|
910
889
|
targetClass,
|
|
911
890
|
Object.keys(metrics.perClass),
|
|
@@ -925,10 +904,7 @@ var FieldSelector = class {
|
|
|
925
904
|
class: targetClass
|
|
926
905
|
};
|
|
927
906
|
this.assertions.push(result);
|
|
928
|
-
|
|
929
|
-
if (!passed) {
|
|
930
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, actualThreshold, actualF1, this.fieldName);
|
|
931
|
-
}
|
|
907
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
932
908
|
return this;
|
|
933
909
|
}
|
|
934
910
|
/**
|
|
@@ -941,7 +917,7 @@ var FieldSelector = class {
|
|
|
941
917
|
metrics,
|
|
942
918
|
binarized: false
|
|
943
919
|
};
|
|
944
|
-
|
|
920
|
+
chunkBFGA2NUB_cjs.recordFieldMetrics(fieldResult);
|
|
945
921
|
const result = {
|
|
946
922
|
type: "confusionMatrix",
|
|
947
923
|
passed: true,
|
|
@@ -949,7 +925,7 @@ var FieldSelector = class {
|
|
|
949
925
|
field: this.fieldName
|
|
950
926
|
};
|
|
951
927
|
this.assertions.push(result);
|
|
952
|
-
|
|
928
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
953
929
|
return this;
|
|
954
930
|
}
|
|
955
931
|
/**
|
|
@@ -969,7 +945,7 @@ var FieldSelector = class {
|
|
|
969
945
|
toHavePercentageBelow(valueThreshold, percentageThreshold) {
|
|
970
946
|
const numericActual = filterNumericValues(this.actualValues);
|
|
971
947
|
if (numericActual.length === 0) {
|
|
972
|
-
throw new
|
|
948
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
973
949
|
`Field '${this.fieldName}' contains no numeric values (found 0 numeric out of ${this.actualValues.length} total values)`,
|
|
974
950
|
percentageThreshold,
|
|
975
951
|
void 0,
|
|
@@ -987,15 +963,7 @@ var FieldSelector = class {
|
|
|
987
963
|
field: this.fieldName
|
|
988
964
|
};
|
|
989
965
|
this.assertions.push(result);
|
|
990
|
-
|
|
991
|
-
if (!passed) {
|
|
992
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(
|
|
993
|
-
result.message,
|
|
994
|
-
percentageThreshold,
|
|
995
|
-
actualPercentage,
|
|
996
|
-
this.fieldName
|
|
997
|
-
);
|
|
998
|
-
}
|
|
966
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
999
967
|
return this;
|
|
1000
968
|
}
|
|
1001
969
|
/**
|
|
@@ -1015,7 +983,7 @@ var FieldSelector = class {
|
|
|
1015
983
|
toHavePercentageAbove(valueThreshold, percentageThreshold) {
|
|
1016
984
|
const numericActual = filterNumericValues(this.actualValues);
|
|
1017
985
|
if (numericActual.length === 0) {
|
|
1018
|
-
throw new
|
|
986
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
1019
987
|
`Field '${this.fieldName}' contains no numeric values (found 0 numeric out of ${this.actualValues.length} total values)`,
|
|
1020
988
|
percentageThreshold,
|
|
1021
989
|
void 0,
|
|
@@ -1033,15 +1001,7 @@ var FieldSelector = class {
|
|
|
1033
1001
|
field: this.fieldName
|
|
1034
1002
|
};
|
|
1035
1003
|
this.assertions.push(result);
|
|
1036
|
-
|
|
1037
|
-
if (!passed) {
|
|
1038
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(
|
|
1039
|
-
result.message,
|
|
1040
|
-
percentageThreshold,
|
|
1041
|
-
actualPercentage,
|
|
1042
|
-
this.fieldName
|
|
1043
|
-
);
|
|
1044
|
-
}
|
|
1004
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
1045
1005
|
return this;
|
|
1046
1006
|
}
|
|
1047
1007
|
// ============================================================================
|
|
@@ -1056,7 +1016,7 @@ var FieldSelector = class {
|
|
|
1056
1016
|
const numericActual = filterNumericValues(this.actualValues);
|
|
1057
1017
|
const numericExpected = filterNumericValues(this.expectedValues);
|
|
1058
1018
|
if (numericActual.length === 0) {
|
|
1059
|
-
throw new
|
|
1019
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
1060
1020
|
`Regression metric requires numeric values, but field "${this.fieldName}" has no numeric actual values.`,
|
|
1061
1021
|
void 0,
|
|
1062
1022
|
void 0,
|
|
@@ -1064,7 +1024,7 @@ var FieldSelector = class {
|
|
|
1064
1024
|
);
|
|
1065
1025
|
}
|
|
1066
1026
|
if (numericExpected.length === 0) {
|
|
1067
|
-
throw new
|
|
1027
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
1068
1028
|
`Regression metric requires numeric values, but field "${this.fieldName}" has no numeric expected values.`,
|
|
1069
1029
|
void 0,
|
|
1070
1030
|
void 0,
|
|
@@ -1072,7 +1032,7 @@ var FieldSelector = class {
|
|
|
1072
1032
|
);
|
|
1073
1033
|
}
|
|
1074
1034
|
if (numericActual.length !== numericExpected.length) {
|
|
1075
|
-
throw new
|
|
1035
|
+
throw new chunkBFGA2NUB_cjs.AssertionError(
|
|
1076
1036
|
`Regression metric requires equal-length arrays, but got ${numericActual.length} actual and ${numericExpected.length} expected values.`,
|
|
1077
1037
|
numericExpected.length,
|
|
1078
1038
|
numericActual.length,
|
|
@@ -1106,10 +1066,7 @@ var FieldSelector = class {
|
|
|
1106
1066
|
field: this.fieldName
|
|
1107
1067
|
};
|
|
1108
1068
|
this.assertions.push(result);
|
|
1109
|
-
|
|
1110
|
-
if (!passed) {
|
|
1111
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, threshold, metrics.mae, this.fieldName);
|
|
1112
|
-
}
|
|
1069
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
1113
1070
|
return this;
|
|
1114
1071
|
}
|
|
1115
1072
|
/**
|
|
@@ -1137,10 +1094,7 @@ var FieldSelector = class {
|
|
|
1137
1094
|
field: this.fieldName
|
|
1138
1095
|
};
|
|
1139
1096
|
this.assertions.push(result);
|
|
1140
|
-
|
|
1141
|
-
if (!passed) {
|
|
1142
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, threshold, metrics.rmse, this.fieldName);
|
|
1143
|
-
}
|
|
1097
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
1144
1098
|
return this;
|
|
1145
1099
|
}
|
|
1146
1100
|
/**
|
|
@@ -1170,10 +1124,7 @@ var FieldSelector = class {
|
|
|
1170
1124
|
field: this.fieldName
|
|
1171
1125
|
};
|
|
1172
1126
|
this.assertions.push(result);
|
|
1173
|
-
|
|
1174
|
-
if (!passed) {
|
|
1175
|
-
throw new chunkBE7CB3AM_cjs.AssertionError(result.message, threshold, metrics.r2, this.fieldName);
|
|
1176
|
-
}
|
|
1127
|
+
chunkBFGA2NUB_cjs.recordAssertion(result);
|
|
1177
1128
|
return this;
|
|
1178
1129
|
}
|
|
1179
1130
|
/**
|
|
@@ -1257,63 +1208,63 @@ var ExpectStats = class {
|
|
|
1257
1208
|
|
|
1258
1209
|
Object.defineProperty(exports, "AssertionError", {
|
|
1259
1210
|
enumerable: true,
|
|
1260
|
-
get: function () { return
|
|
1211
|
+
get: function () { return chunkBFGA2NUB_cjs.AssertionError; }
|
|
1261
1212
|
});
|
|
1262
1213
|
Object.defineProperty(exports, "ConfigurationError", {
|
|
1263
1214
|
enumerable: true,
|
|
1264
|
-
get: function () { return
|
|
1215
|
+
get: function () { return chunkBFGA2NUB_cjs.ConfigurationError; }
|
|
1265
1216
|
});
|
|
1266
1217
|
Object.defineProperty(exports, "ConsoleReporter", {
|
|
1267
1218
|
enumerable: true,
|
|
1268
|
-
get: function () { return
|
|
1219
|
+
get: function () { return chunkBFGA2NUB_cjs.ConsoleReporter; }
|
|
1269
1220
|
});
|
|
1270
1221
|
Object.defineProperty(exports, "DatasetError", {
|
|
1271
1222
|
enumerable: true,
|
|
1272
|
-
get: function () { return
|
|
1223
|
+
get: function () { return chunkBFGA2NUB_cjs.DatasetError; }
|
|
1273
1224
|
});
|
|
1274
1225
|
Object.defineProperty(exports, "EvalSenseError", {
|
|
1275
1226
|
enumerable: true,
|
|
1276
|
-
get: function () { return
|
|
1227
|
+
get: function () { return chunkBFGA2NUB_cjs.EvalSenseError; }
|
|
1277
1228
|
});
|
|
1278
1229
|
Object.defineProperty(exports, "ExitCodes", {
|
|
1279
1230
|
enumerable: true,
|
|
1280
|
-
get: function () { return
|
|
1231
|
+
get: function () { return chunkBFGA2NUB_cjs.ExitCodes; }
|
|
1281
1232
|
});
|
|
1282
1233
|
Object.defineProperty(exports, "IntegrityError", {
|
|
1283
1234
|
enumerable: true,
|
|
1284
|
-
get: function () { return
|
|
1235
|
+
get: function () { return chunkBFGA2NUB_cjs.IntegrityError; }
|
|
1285
1236
|
});
|
|
1286
1237
|
Object.defineProperty(exports, "JsonReporter", {
|
|
1287
1238
|
enumerable: true,
|
|
1288
|
-
get: function () { return
|
|
1239
|
+
get: function () { return chunkBFGA2NUB_cjs.JsonReporter; }
|
|
1289
1240
|
});
|
|
1290
1241
|
Object.defineProperty(exports, "TestExecutionError", {
|
|
1291
1242
|
enumerable: true,
|
|
1292
|
-
get: function () { return
|
|
1243
|
+
get: function () { return chunkBFGA2NUB_cjs.TestExecutionError; }
|
|
1293
1244
|
});
|
|
1294
1245
|
Object.defineProperty(exports, "buildConfusionMatrix", {
|
|
1295
1246
|
enumerable: true,
|
|
1296
|
-
get: function () { return
|
|
1247
|
+
get: function () { return chunkBFGA2NUB_cjs.buildConfusionMatrix; }
|
|
1297
1248
|
});
|
|
1298
1249
|
Object.defineProperty(exports, "discoverEvalFiles", {
|
|
1299
1250
|
enumerable: true,
|
|
1300
|
-
get: function () { return
|
|
1251
|
+
get: function () { return chunkBFGA2NUB_cjs.discoverEvalFiles; }
|
|
1301
1252
|
});
|
|
1302
1253
|
Object.defineProperty(exports, "executeEvalFiles", {
|
|
1303
1254
|
enumerable: true,
|
|
1304
|
-
get: function () { return
|
|
1255
|
+
get: function () { return chunkBFGA2NUB_cjs.executeEvalFiles; }
|
|
1305
1256
|
});
|
|
1306
1257
|
Object.defineProperty(exports, "formatConfusionMatrix", {
|
|
1307
1258
|
enumerable: true,
|
|
1308
|
-
get: function () { return
|
|
1259
|
+
get: function () { return chunkBFGA2NUB_cjs.formatConfusionMatrix; }
|
|
1309
1260
|
});
|
|
1310
1261
|
Object.defineProperty(exports, "getExitCode", {
|
|
1311
1262
|
enumerable: true,
|
|
1312
|
-
get: function () { return
|
|
1263
|
+
get: function () { return chunkBFGA2NUB_cjs.getExitCode; }
|
|
1313
1264
|
});
|
|
1314
1265
|
Object.defineProperty(exports, "parseReport", {
|
|
1315
1266
|
enumerable: true,
|
|
1316
|
-
get: function () { return
|
|
1267
|
+
get: function () { return chunkBFGA2NUB_cjs.parseReport; }
|
|
1317
1268
|
});
|
|
1318
1269
|
exports.afterAll = afterAll;
|
|
1319
1270
|
exports.afterEach = afterEach;
|