import React from 'react' import { motion } from 'framer-motion' import type { PyTorchScore } from '../types' interface Props { scores: PyTorchScore[] } // Convert 0.0 -> 1.0 urgency score into a color. function getHeatmapColor(score: number, isFalseSos: boolean) { if (isFalseSos || score === 0) { return 'bg-purple-900/50 text-purple-300 neon-border-purple' } if (score > 0.75) return 'bg-red-900/50 text-red-300 neon-border-red' if (score > 0.4) return 'bg-orange-900/50 border-orange-500 text-orange-300' if (score > 0.1) return 'bg-yellow-900/50 border-yellow-500 text-yellow-300' return 'bg-green-900/30 text-green-500 neon-border-green' } const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: 0.05 } } } const itemVariants = { hidden: { opacity: 0, scale: 0.8 }, visible: { opacity: 1, scale: 1, transition: { type: 'spring' as any, stiffness: 300, damping: 24 } } } export function ProbabilityMatrix({ scores }: Props) { if (!scores || scores.length === 0) return null // Sort alphabetically const sorted = [...scores].sort((a, b) => a.zone_id.localeCompare(b.zone_id)) return ( // @ts-ignore

PyTorch Probability Matrix

inference_latency ~1ms
// @ts-ignore {sorted.map(s => { const style = getHeatmapColor(s.score, s.is_false_sos_suspect) return ( // @ts-ignore {s.zone_id}
{(s.score * 100).toFixed(0)}%
{s.is_false_sos_suspect && (
)}
) })}
) }