From a94fca70472531482770192790f319ca35d80550 Mon Sep 17 00:00:00 2001 From: hjwilli Date: Wed, 24 Feb 2021 14:21:50 -0500 Subject: [PATCH] R2 score UI changes * R2 -> R^2 label update on datasets and results pages * best results bar on datasets page for regression changed to max at 1 Ref #319 --- .../components/BestResult/index.jsx | 50 +++++++++++++------ lab/webapp/src/components/Results/index.jsx | 2 +- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/lab/webapp/src/components/Datasets/components/DatasetCard/components/BestResult/index.jsx b/lab/webapp/src/components/Datasets/components/DatasetCard/components/BestResult/index.jsx index dfe018582..08b052c8c 100644 --- a/lab/webapp/src/components/Datasets/components/DatasetCard/components/BestResult/index.jsx +++ b/lab/webapp/src/components/Datasets/components/DatasetCard/components/BestResult/index.jsx @@ -29,6 +29,8 @@ import React from 'react'; import { Segment, Header, Progress } from 'semantic-ui-react'; import { formatAlgorithm } from '../../../../../../utils/formatter'; + + function BestResult({ result, hasMetadata }) { const getNoResultMessage = () => { if(!hasMetadata) { @@ -41,6 +43,37 @@ function BestResult({ result, hasMetadata }) { const getResultLink = () => `/#/results/${result._id}`; const getPercent = () => (result.score * 100).toFixed(2); + + const getValue = () => (result.score).toFixed(2); + + const renderProgressBar = (result) => { + switch(result.prediction_type) { + case 'classification': + return ( + + ); + case 'regression': + return ( + + ); + default: + return; + } + } + if(!result) { return ( @@ -50,13 +83,6 @@ function BestResult({ result, hasMetadata }) { ); } - // add label for best results - var label = ""; - if (result.prediction_type == "classification") { - label = "Balanced Accuracy"; - } else if (result.prediction_type == "regression") { - label = "R2"; - } return ( {`#${result._id}`} - + { renderProgressBar(result) } ); } -export default BestResult; +export default BestResult; \ No newline at end of file diff --git a/lab/webapp/src/components/Results/index.jsx b/lab/webapp/src/components/Results/index.jsx index ef2b7f25e..9608a888b 100644 --- a/lab/webapp/src/components/Results/index.jsx +++ b/lab/webapp/src/components/Results/index.jsx @@ -364,7 +364,7 @@ class Results extends Component { scores={experiment.data.scores} />