AI/ML
Validation Score Card - Model Evaluation
Monitor validation scores and model evaluation metrics. Track model quality and performance on held-out test datasets.
Validation Score Card
The Validation Score Card displays model validation scores across different metrics, helping teams assess model performance on held-out data.
Preview
Installation
npx shadcn@latest add https://vectormotion.vercel.app/registry/validation-score-card.jsonValidation Score Card
'use client'import React from 'react';import { CheckCircle2, Trophy, Target, ShieldCheck } from 'lucide-react';import { motion } from 'motion/react';import { clsx, type ClassValue } from "clsx"import { twMerge } from "tailwind-merge"import { ResponsiveContainer, RadialBarChart, RadialBar, Tooltip } from 'recharts';function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs))}interface ValidationData { name: string; value: number; fill: string; [key: string]: any;}interface ValidationScoreCardProps { className?: string; title?: string; statusLabel?: string; subtitle?: string; data?: ValidationData[]; accuracyValue?: string; precisionValue?: string; recallValue?: string;}const DEFAULT_DATA: ValidationData[] = [ { name: 'Validation', value: 89, fill: '#10b981' },];const DEFAULT_TITLE = "Validation";const DEFAULT_STATUS_LABEL = "PASSED";const DEFAULT_SUBTITLE = "5-Fold Cross Val";const DEFAULT_ACCURACY_VALUE = "89";const DEFAULT_PRECISION_VALUE = "0.92";const DEFAULT_RECALL_VALUE = "0.87";export const ValidationScoreCard: React.FC<ValidationScoreCardProps> = ({ className = "", title = DEFAULT_TITLE, statusLabel = DEFAULT_STATUS_LABEL, subtitle = DEFAULT_SUBTITLE, data = DEFAULT_DATA, accuracyValue = DEFAULT_ACCURACY_VALUE, precisionValue = DEFAULT_PRECISION_VALUE, recallValue = DEFAULT_RECALL_VALUE,}) => { return ( <motion.div initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.5, delay: 0.2 }} className={cn( "relative overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-sm transition-all hover:border-emerald-300 dark:hover:border-emerald-700 hover:shadow-md flex flex-col h-full", className )} > <div className="p-5 flex flex-col h-full relative z-10"> <div className="flex items-start justify-between mb-2"> <div> <h3 className="font-bold text-lg text-foreground"> {title} </h3> <div className="flex items-center gap-2 mt-1"> <div className="px-2 py-0.5 rounded-full bg-emerald-500/10 border border-emerald-100 dark:border-emerald-800 text-[10px] font-bold text-emerald-500"> {statusLabel} </div> <span className="text-xs text-muted-foreground">{subtitle}</span> </div> </div> <div className="rounded-lg border-2 border-emerald-100 dark:border-emerald-800 p-2 text-emerald-500 dark:text-emerald-400 flex items-center justify-center"> <CheckCircle2 className="h-5 w-5" /> </div> </div> <div className="flex-1 w-full min-h-[120px] relative my-2"> <ResponsiveContainer width="100%" height="100%"> <RadialBarChart cx="50%" cy="50%" innerRadius="65%" outerRadius="100%" barSize={12} data={data} startAngle={90} endAngle={-270} > <RadialBar background dataKey="value" cornerRadius={10} /> <Tooltip cursor={false} content={() => null} /> </RadialBarChart> </ResponsiveContainer> <div className="absolute inset-0 flex flex-col items-center justify-center"> <span className="text-3xl font-bold text-foreground tracking-tight">{accuracyValue}<span className="text-sm font-normal text-muted-foreground">%</span></span> <span className="text-[10px] uppercase font-bold text-muted-foreground">Mean Acc</span> </div> </div> <div className="grid grid-cols-2 gap-2 mt-auto"> <div className="flex items-center gap-2 p-2 rounded-lg bg-muted border border-border"> <Target className="w-4 h-4 text-muted-foreground" /> <div> <div className="text-[10px] text-muted-foreground">Precision</div> <div className="text-xs font-bold text-foreground">{precisionValue}</div> </div> </div> <div className="flex items-center gap-2 p-2 rounded-lg bg-muted border border-border"> <ShieldCheck className="w-4 h-4 text-muted-foreground" /> <div> <div className="text-[10px] text-muted-foreground">Recall</div> <div className="text-xs font-bold text-foreground">{recallValue}</div> </div> </div> </div> <div className="absolute -bottom-4 -right-4 z-0 opacity-5 pointer-events-none"> <CheckCircle2 className="w-40 h-40 text-emerald-500" /> </div> </div> </motion.div> );};Props
Prop
Type
Usage
This component is a demo card displaying validation scores with animated visualizations and dark mode support.