import React from 'react' import { Drawer, Title, Text, Stack, Box, Progress, Table, ScrollArea } from '@mantine/core' import { useXRD } from '../context/XRDContext' const LogitDrawer = () => { const { isLogitDrawerOpen, setIsLogitDrawerOpen, modelResults } = useXRD() if (!modelResults?.predictions?.phase_predictions) { return null } // Get classification predictions (not lattice parameters) const classificationPredictions = modelResults.predictions.phase_predictions .filter(p => !p.is_lattice && p.confidence) const getColorForProbability = (prob) => { if (prob >= 0.8) return 'green' if (prob >= 0.5) return 'yellow' return 'orange' } return ( setIsLogitDrawerOpen(false)} position="right" size="xl" title={ Class Logit Distributions } padding="xl" > Detailed logit scores for each classification task. Note: Logits have been normalized with softmax. {classificationPredictions.map((pred, idx) => ( {pred.phase} Top Prediction: {pred.predicted_class} ({(pred.confidence * 100).toFixed(2)}%) {/* Display all probabilities for Crystal System */} {pred.all_probabilities && ( Rank Class Logits Distribution {pred.all_probabilities.map((item, i) => ( {i + 1} {item.class_name} {(item.probability * 100).toFixed(2)}% ))}
)} {/* Display top 10 probabilities for Space Group */} {pred.top_probabilities && ( Rank Space Group Symbol Logits Distribution {pred.top_probabilities.map((item, i) => ( {i + 1} #{item.space_group_number} {item.space_group_symbol} {(item.probability * 100).toFixed(2)}% ))}
)}
))} Note: The model outputs raw logit scores for each possible class. These scores are normalized using softmax to show relative confidence. For Crystal System, all 7 classes are shown. For Space Group, the top 10 out of 230 possible groups are displayed.
) } export default LogitDrawer