Skip to content

feat: extract shared model name formatter and apply to evaluation results #1

Description

@baranylcn

What and why

Model type strings like random_forest, logistic_regression, xgboost currently appear as-is in the evaluation results UI. TrainingPanel and CrossValidationPanel each define their own local label map independently, and the evaluation views (EvaluationPage, EvaluationPanel) display raw API values directly.

What to do

Create frontend/src/lib/modelTypes.ts with a shared formatter:

export const MODEL_LABELS: Record<string, string> = {
  xgboost: 'XGBoost',
  random_forest: 'Random Forest',
  logistic_regression: 'Logistic Regression',
  linear_regression: 'Linear Regression',
}

export function formatModelName(raw: string): string {
  return MODEL_LABELS[raw] ?? raw
}

Replace the local MODEL_OPTIONS label arrays in TrainingPanel.tsx and CrossValidationPanel.tsx with imports from this file.

Apply formatModelName() wherever best_model or r.model is rendered in EvaluationPage.tsx and EvaluationPanel.tsx.

Acceptance criteria

  • Evaluation results show "Random Forest" not "random_forest"
  • No duplicate label maps remain in the codebase
  • npm run lint and npm run typecheck pass

Good for

Anyone comfortable with TypeScript and React. No backend knowledge needed. Touches ~5 files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions