UNPKG

@arizeai/phoenix-evals

Version:
30 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createFBetaEvaluator = createFBetaEvaluator; const classificationMetrics_1 = require("./classificationMetrics"); const createClassificationMetricEvaluator_1 = require("./createClassificationMetricEvaluator"); /** * Creates a code evaluator that computes the F-beta score: the weighted * harmonic mean of precision and recall, where `beta` controls how much more * weight recall gets relative to precision (`beta = 1` is the standard F1 * score). * * Supports binary classification (via `positiveLabel`, or auto-detected when * `average` is at its default `"macro"` and labels are the numeric set * `{0, 1}`) and multi-class classification (via the `average` strategy). * * @example * ```typescript * const f2 = createFBetaEvaluator({ beta: 2 }); * const result = await f2.evaluate({ * expected: ["cat", "dog", "cat", "bird"], * output: ["cat", "cat", "cat", "bird"], * }); * ``` */ function createFBetaEvaluator(options = {}) { const { beta = 1 } = options; const suffix = (0, classificationMetrics_1.getAverageMetricNameSuffix)(options); return (0, createClassificationMetricEvaluator_1.createClassificationMetricEvaluator)(`${(0, classificationMetrics_1.formatBetaForMetricName)(beta)}${suffix}`, "fScore", options); } //# sourceMappingURL=createFBetaEvaluator.js.map