Download testbed/fairlearn__fairlearn/visualization/FairnessDashboard/src/FormatMetrics.ts from hc99/FEA-Bench: direct link, hf CLI and curl.
- Browser
- Download file 497 Bytes
-
https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/fairlearn__fairlearn/visualization/FairnessDashboard/src/FormatMetrics.ts
- Command line
-
hf download hf://datasets/hc99/FEA-Bench/testbed/fairlearn__fairlearn/visualization/FairnessDashboard/src/FormatMetrics.ts
-
curl -L -o FormatMetrics.ts https://huggingface.co/datasets/hc99/FEA-Bench/resolve/main/testbed/fairlearn__fairlearn/visualization/FairnessDashboard/src/FormatMetrics.ts
497 Bytes
| import { AccuracyOptions } from "./AccuracyMetrics"; | |
| export class FormatMetrics { | |
| public static formatNumbers = (value: number, key: string, isRatio: boolean = false): string => { | |
| if (value === null || value === undefined) { | |
| return NaN.toString(); | |
| } | |
| const styleObject = {maximumSignificantDigits: 3}; | |
| if (AccuracyOptions[key].isPercentage && !isRatio) { | |
| (styleObject as any).style = "percent"; | |
| } | |
| return value.toLocaleString(undefined, styleObject); | |
| } | |
| } |