Support sparse metric aggregation
This commit is contained in:
1 parent
d4e7cb6e8b
commit
77ba93b94a
4 files changed
+106
-21
No files matched your search
@@ -158,6 +158,33 @@ describe('ProfileBuilderService', () => {
|
||||
expect(profile.rareEventRate).toBeCloseTo(3 / 5);
|
||||
});
|
||||
|
||||
it('aggregates scalar metrics only from features with observed normalized values', () => {
|
||||
const metrics: MetricDefinition[] = [
|
||||
{
|
||||
id: 'observedScalar',
|
||||
label: 'Observed scalar',
|
||||
direction: 'higherIsBetter',
|
||||
kind: 'scalar',
|
||||
includeInVector: true,
|
||||
},
|
||||
];
|
||||
const firstFeature = createFeature({
|
||||
normalized: {},
|
||||
confidence: 1,
|
||||
});
|
||||
const secondFeature = createFeature({
|
||||
normalized: { observedScalar: 0.4 },
|
||||
confidence: 0.5,
|
||||
});
|
||||
|
||||
const profile = buildProfileMetricValues(
|
||||
[firstFeature, secondFeature],
|
||||
metrics,
|
||||
);
|
||||
|
||||
expect(profile.observedScalar).toBe(0.4);
|
||||
});
|
||||
|
||||
it('builds profile vectors from included metrics while retaining insight metrics', () => {
|
||||
const actualShared = jest.requireActual<
|
||||
typeof import('@persona-lenz/shared')
|
||||
|
||||
Reference in new issue
Block a user