fix: handle test_ prefixed metric keys from training runs API
This commit is contained in:
parent
12a9603fce
commit
a9bfe36e47
2 changed files with 9 additions and 5 deletions
|
|
@ -10,6 +10,8 @@ interface TrainingRun {
|
||||||
metrics_summary?: {
|
metrics_summary?: {
|
||||||
f1_macro?: number;
|
f1_macro?: number;
|
||||||
accuracy?: number;
|
accuracy?: number;
|
||||||
|
test_f1_macro?: number;
|
||||||
|
test_accuracy?: number;
|
||||||
[key: string]: number | undefined;
|
[key: string]: number | undefined;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +120,7 @@ export default function ModelSelector({
|
||||||
{isLoadingModel ? 'Loading...' : '— select a model —'}
|
{isLoadingModel ? 'Loading...' : '— select a model —'}
|
||||||
</option>
|
</option>
|
||||||
{runs.map((run) => {
|
{runs.map((run) => {
|
||||||
const f1 = run.metrics_summary?.f1_macro;
|
const f1 = run.metrics_summary?.f1_macro ?? run.metrics_summary?.test_f1_macro;
|
||||||
const label = [
|
const label = [
|
||||||
run.model_type.replace('_', ' '),
|
run.model_type.replace('_', ' '),
|
||||||
formatDate(run.created_at),
|
formatDate(run.created_at),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ interface TrainingRun {
|
||||||
metrics_summary?: {
|
metrics_summary?: {
|
||||||
accuracy?: number;
|
accuracy?: number;
|
||||||
f1_macro?: number;
|
f1_macro?: number;
|
||||||
|
test_accuracy?: number;
|
||||||
|
test_f1_macro?: number;
|
||||||
[key: string]: number | undefined;
|
[key: string]: number | undefined;
|
||||||
};
|
};
|
||||||
error?: string;
|
error?: string;
|
||||||
|
|
@ -304,11 +306,11 @@ export default function TrainingPanel() {
|
||||||
<div className="text-muted-foreground">{formatDate(run.created_at)}</div>
|
<div className="text-muted-foreground">{formatDate(run.created_at)}</div>
|
||||||
{run.status === 'completed' && run.metrics_summary && (
|
{run.status === 'completed' && run.metrics_summary && (
|
||||||
<div className="flex flex-wrap gap-x-2 text-muted-foreground">
|
<div className="flex flex-wrap gap-x-2 text-muted-foreground">
|
||||||
{run.metrics_summary.accuracy !== undefined && (
|
{(run.metrics_summary.accuracy ?? run.metrics_summary.test_accuracy) !== undefined && (
|
||||||
<span>Acc: {(run.metrics_summary.accuracy * 100).toFixed(1)}%</span>
|
<span>Acc: {((run.metrics_summary.accuracy ?? run.metrics_summary.test_accuracy)! * 100).toFixed(1)}%</span>
|
||||||
)}
|
)}
|
||||||
{run.metrics_summary.f1_macro !== undefined && (
|
{(run.metrics_summary.f1_macro ?? run.metrics_summary.test_f1_macro) !== undefined && (
|
||||||
<span>F1: {(run.metrics_summary.f1_macro * 100).toFixed(1)}%</span>
|
<span>F1: {((run.metrics_summary.f1_macro ?? run.metrics_summary.test_f1_macro)! * 100).toFixed(1)}%</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue