未验证 提交 92eb7c1d 编写于 作者: P Peter Pan 提交者: GitHub

minor hyper-parameter page improvements (#963)

* feat: change hyper-parameters text orientation

* feat: hide hyper-parameter importance button
上级 52031c1c
...@@ -27,6 +27,8 @@ import type {WithStyled} from '~/utils/style'; ...@@ -27,6 +27,8 @@ import type {WithStyled} from '~/utils/style';
import {rem} from '~/utils/style'; import {rem} from '~/utils/style';
import styled from 'styled-components'; import styled from 'styled-components';
const CHART_SIZE = 150;
type ScatterPlotMatrixProps = ViewData & { type ScatterPlotMatrixProps = ViewData & {
colors: string[]; colors: string[];
onHover?: (index: number | null) => unknown; onHover?: (index: number | null) => unknown;
...@@ -39,6 +41,8 @@ const Container = styled.div` ...@@ -39,6 +41,8 @@ const Container = styled.div`
/* overflow-y: visible; */ /* overflow-y: visible; */
display: flex; display: flex;
flex-direction: column; flex-direction: column;
--label-size: 1em;
--chart-size: ${rem(CHART_SIZE + ChartClass.MARGIN_WITHOUT_LABEL * 2)};
.row { .row {
display: flex; display: flex;
...@@ -47,26 +51,39 @@ const Container = styled.div` ...@@ -47,26 +51,39 @@ const Container = styled.div`
.metrics { .metrics {
display: block; display: block;
writing-mode: vertical-rl;
text-align: center; text-align: center;
font-weight: 700; font-weight: 700;
width: ${rem(14)}; width: var(--label-size);
line-height: ${rem(14)}; height: var(--chart-size);
line-height: var(--label-size);
> span {
display: inline-block;
width: var(--chart-size);
height: var(--label-size);
transform: rotate(270deg) translate(calc(-1 * var(--chart-size)), 0);
transform-origin: left top;
}
} }
.hparams { .hparams {
display: block; display: block;
width: ${150 + ChartClass.MARGIN_WITHOUT_LABEL * 2}px; width: var(--chart-size);
text-align: center; text-align: center;
flex: none; flex: none;
> span {
height: var(--label-size);
line-height: var(--label-size);
}
} }
.metrics.hparams { .metrics-hparams {
width: calc(${rem(14)} + ${ChartClass.MARGIN_LEFT_WITH_LABEL - ChartClass.MARGIN_WITHOUT_LABEL}px); width: calc(${rem(14)} + ${ChartClass.MARGIN_LEFT_WITH_LABEL - ChartClass.MARGIN_WITHOUT_LABEL}px);
} }
.row-scale-method-selector { .row-scale-method-selector {
margin: ${rem(10)} 0 ${rem(10)} ${rem(24)}; margin: ${rem(10)} 0 ${rem(10)} calc(${rem(10)} + var(--label-size));
height: 1em; height: 1em;
} }
...@@ -191,7 +208,9 @@ const ScatterPlotMatrix: FunctionComponent<ScatterPlotMatrixProps & WithStyled> ...@@ -191,7 +208,9 @@ const ScatterPlotMatrix: FunctionComponent<ScatterPlotMatrixProps & WithStyled>
) : null} ) : null}
</div> </div>
<div className="row"> <div className="row">
<span className="metrics">{metricsIndicators[ri].name}</span> <div className="metrics">
<span>{metricsIndicators[ri].name}</span>
</div>
{row.map((cell, ci) => ( {row.map((cell, ci) => (
<div className="cell" key={ci}> <div className="cell" key={ci}>
<ScatterChart <ScatterChart
...@@ -210,7 +229,7 @@ const ScatterPlotMatrix: FunctionComponent<ScatterPlotMatrixProps & WithStyled> ...@@ -210,7 +229,7 @@ const ScatterPlotMatrix: FunctionComponent<ScatterPlotMatrixProps & WithStyled>
</React.Fragment> </React.Fragment>
))} ))}
<div className="row"> <div className="row">
<span className="metrics hparams"></span> <span className="metrics-hparams"></span>
{hparamsIndicators.map((hi, hii) => ( {hparamsIndicators.map((hi, hii) => (
<div className="hparams" key={hii}> <div className="hparams" key={hii}>
<span>{hi.name}</span> <span>{hi.name}</span>
......
...@@ -37,9 +37,9 @@ import styled from 'styled-components'; ...@@ -37,9 +37,9 @@ import styled from 'styled-components';
import useRequest from '~/hooks/useRequest'; import useRequest from '~/hooks/useRequest';
import {useTranslation} from 'react-i18next'; import {useTranslation} from 'react-i18next';
const ImportanceButton = styled(Button)` // const ImportanceButton = styled(Button)`
width: 100%; // width: 100%;
`; // `;
const HParamsImportanceDialog = styled(ImportanceDialog)` const HParamsImportanceDialog = styled(ImportanceDialog)`
position: fixed; position: fixed;
...@@ -149,7 +149,7 @@ const HyperParameter: FunctionComponent = () => { ...@@ -149,7 +149,7 @@ const HyperParameter: FunctionComponent = () => {
<Aside <Aside
bottom={ bottom={
<> <>
<AsideSection> {/* <AsideSection>
<ImportanceButton <ImportanceButton
rounded rounded
outline outline
...@@ -158,7 +158,7 @@ const HyperParameter: FunctionComponent = () => { ...@@ -158,7 +158,7 @@ const HyperParameter: FunctionComponent = () => {
> >
{t('hyper-parameter:show-parameter-importance')} {t('hyper-parameter:show-parameter-importance')}
</ImportanceButton> </ImportanceButton>
</AsideSection> </AsideSection> */}
<AsideSection> <AsideSection>
<Field label={t('common:download-data')}> <Field label={t('common:download-data')}>
<DownloadButtons> <DownloadButtons>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册