Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
173d49e5
"docs/git@developer.sourcefind.cn:wangsen/mineru.git" did not exist on "7d2dfc8091184908434f04b935752ff9daa01768"
Unverified
Commit
173d49e5
authored
Jun 13, 2022
by
Lijiaoa
Committed by
GitHub
Jun 13, 2022
Browse files
Add optimized_mode dropdown for Default metric chart in detail page (#4926)
parent
11aff9df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
16 deletions
+40
-16
ts/webui/src/components/experiment/trialdetail/chart/DefaultMetricPoint.tsx
...nents/experiment/trialdetail/chart/DefaultMetricPoint.tsx
+26
-4
ts/webui/src/components/experiment/trialdetail/chart/Intermediate.tsx
.../components/experiment/trialdetail/chart/Intermediate.tsx
+8
-6
ts/webui/src/static/style/experiment/trialdetail/para.scss
ts/webui/src/static/style/experiment/trialdetail/para.scss
+0
-4
ts/webui/src/static/style/experiment/trialdetail/trialsDetail.scss
...src/static/style/experiment/trialdetail/trialsDetail.scss
+6
-2
No files found.
ts/webui/src/components/experiment/trialdetail/chart/DefaultMetricPoint.tsx
View file @
173d49e5
import
*
as
React
from
'
react
'
;
import
*
as
React
from
'
react
'
;
import
{
Toggle
,
Stack
}
from
'
@fluentui/react
'
;
import
{
Stack
,
Dropdown
,
Toggle
,
IDropdownOption
}
from
'
@fluentui/react
'
;
import
ReactEcharts
from
'
echarts-for-react
'
;
import
ReactEcharts
from
'
echarts-for-react
'
;
import
{
Trial
}
from
'
@model/trial
'
;
import
{
Trial
}
from
'
@model/trial
'
;
import
{
EXPERIMENT
,
TRIALS
}
from
'
@static/datamodel
'
;
import
{
EXPERIMENT
,
TRIALS
}
from
'
@static/datamodel
'
;
import
{
TooltipForAccuracy
,
EventMap
}
from
'
@static/interface
'
;
import
{
TooltipForAccuracy
,
EventMap
}
from
'
@static/interface
'
;
import
{
reformatRetiariiParameter
}
from
'
@static/function
'
;
import
{
reformatRetiariiParameter
}
from
'
@static/function
'
;
import
{
gap15
}
from
'
@components/fluent/ChildrenGap
'
;
import
'
echarts/lib/chart/scatter
'
;
import
'
echarts/lib/chart/scatter
'
;
import
'
echarts/lib/component/tooltip
'
;
import
'
echarts/lib/component/tooltip
'
;
import
'
echarts/lib/component/title
'
;
import
'
echarts/lib/component/title
'
;
...
@@ -34,6 +35,7 @@ interface DefaultPointState {
...
@@ -34,6 +35,7 @@ interface DefaultPointState {
bestCurveEnabled
?:
boolean
|
undefined
;
bestCurveEnabled
?:
boolean
|
undefined
;
startY
:
number
;
// dataZoomY
startY
:
number
;
// dataZoomY
endY
:
number
;
endY
:
number
;
userSelectOptimizeMode
:
string
;
}
}
class
DefaultPoint
extends
React
.
Component
<
DefaultPointProps
,
DefaultPointState
>
{
class
DefaultPoint
extends
React
.
Component
<
DefaultPointProps
,
DefaultPointState
>
{
...
@@ -42,7 +44,8 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -42,7 +44,8 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
this
.
state
=
{
this
.
state
=
{
bestCurveEnabled
:
false
,
bestCurveEnabled
:
false
,
startY
:
0
,
// dataZoomY
startY
:
0
,
// dataZoomY
endY
:
100
endY
:
100
,
userSelectOptimizeMode
:
EXPERIMENT
.
optimizeMode
||
'
maximize
'
};
};
}
}
...
@@ -124,6 +127,7 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -124,6 +127,7 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
}
}
generateBestCurveSeries
(
trials
:
Trial
[]):
any
{
generateBestCurveSeries
(
trials
:
Trial
[]):
any
{
const
{
userSelectOptimizeMode
}
=
this
.
state
;
let
best
=
trials
[
0
];
let
best
=
trials
[
0
];
const
data
=
[[
best
.
sequenceId
,
best
.
accuracy
,
best
.
id
,
best
.
description
.
parameters
]];
const
data
=
[[
best
.
sequenceId
,
best
.
accuracy
,
best
.
id
,
best
.
description
.
parameters
]];
...
@@ -131,7 +135,7 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -131,7 +135,7 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
const
trial
=
trials
[
i
];
const
trial
=
trials
[
i
];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const
delta
=
trial
.
accuracy
!
-
best
.
accuracy
!
;
const
delta
=
trial
.
accuracy
!
-
best
.
accuracy
!
;
const
better
=
EXPERIMENT
.
o
ptimizeMode
===
'
minimize
'
?
delta
<
0
:
delta
>
0
;
const
better
=
userSelectO
ptimizeMode
===
'
minimize
'
?
delta
<
0
:
delta
>
0
;
if
(
better
)
{
if
(
better
)
{
data
.
push
([
trial
.
sequenceId
,
trial
.
accuracy
,
best
.
id
,
trial
.
description
.
parameters
]);
data
.
push
([
trial
.
sequenceId
,
trial
.
accuracy
,
best
.
id
,
trial
.
description
.
parameters
]);
best
=
trial
;
best
=
trial
;
...
@@ -147,8 +151,16 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -147,8 +151,16 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
};
};
}
}
// get user mode number 'max' or 'min'
updateUserOptimizeMode
=
(
event
:
React
.
FormEvent
<
HTMLDivElement
>
,
item
?:
IDropdownOption
):
void
=>
{
if
(
item
!==
undefined
)
{
this
.
setState
({
userSelectOptimizeMode
:
item
.
key
.
toString
()
});
}
};
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
const
{
hasBestCurve
,
chartHeight
}
=
this
.
props
;
const
{
hasBestCurve
,
chartHeight
}
=
this
.
props
;
const
{
userSelectOptimizeMode
}
=
this
.
state
;
const
graph
=
this
.
generateGraph
();
const
graph
=
this
.
generateGraph
();
const
accNodata
=
graph
===
EmptyGraph
?
'
No data
'
:
''
;
const
accNodata
=
graph
===
EmptyGraph
?
'
No data
'
:
''
;
const
onEvents
=
{
dataZoom
:
this
.
metricDataZoom
,
click
:
this
.
pointClick
};
const
onEvents
=
{
dataZoom
:
this
.
metricDataZoom
,
click
:
this
.
pointClick
};
...
@@ -156,8 +168,18 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -156,8 +168,18 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
return
(
return
(
<
div
>
<
div
>
{
hasBestCurve
&&
(
{
hasBestCurve
&&
(
<
Stack
horizontal
Align
=
'end'
className
=
'default-metric'
>
<
Stack
horizontal
reversed
tokens
=
{
gap15
}
className
=
'default-metric'
>
<
Toggle
label
=
'Optimization curve'
inlineLabel
onChange
=
{
this
.
loadDefault
}
/>
<
Toggle
label
=
'Optimization curve'
inlineLabel
onChange
=
{
this
.
loadDefault
}
/>
<
Dropdown
selectedKey
=
{
userSelectOptimizeMode
}
onChange
=
{
this
.
updateUserOptimizeMode
}
options
=
{
[
{
key
:
'
maximize
'
,
text
:
'
Maximize
'
},
{
key
:
'
minimize
'
,
text
:
'
Minimize
'
}
]
}
styles
=
{
{
dropdown
:
{
width
:
100
}
}
}
className
=
'para-filter-percent'
/>
</
Stack
>
</
Stack
>
)
}
)
}
<
div
className
=
'default-metric-graph graph'
>
<
div
className
=
'default-metric-graph graph'
>
...
...
ts/webui/src/components/experiment/trialdetail/chart/Intermediate.tsx
View file @
173d49e5
...
@@ -261,14 +261,16 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
...
@@ -261,14 +261,16 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
// placeholder="range"
// placeholder="range"
ref
=
{
(
input
):
any
=>
(
this
.
maxValInput
=
input
)
}
ref
=
{
(
input
):
any
=>
(
this
.
maxValInput
=
input
)
}
/>
/>
<
PrimaryButton
text
=
'Confirm'
onClick
=
{
this
.
filterLines
}
disabled
=
{
isLoadconfirmBtn
}
/>
<
PrimaryButton
className
=
'intermeidateconfirm'
text
=
'Confirm'
onClick
=
{
this
.
filterLines
}
disabled
=
{
isLoadconfirmBtn
}
/>
</
div
>
</
div
>
)
:
null
}
)
:
null
}
{
/* filter message */
}
{
/* filter message */
}
<
Stack
horizontal
className
=
'filter-toggle'
>
<
Toggle
label
=
'Filter'
inlineLabel
onChange
=
{
this
.
switchTurn
}
/>
<
span
>
Filter
</
span
>
<
Toggle
onChange
=
{
this
.
switchTurn
}
/>
</
Stack
>
</
Stack
>
</
Stack
>
<
div
className
=
'intermediate-graph graph'
>
<
div
className
=
'intermediate-graph graph'
>
<
ReactEcharts
<
ReactEcharts
...
@@ -277,7 +279,7 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
...
@@ -277,7 +279,7 @@ class Intermediate extends React.Component<IntermediateProps, IntermediateState>
notMerge
=
{
true
}
// update now
notMerge
=
{
true
}
// update now
onEvents
=
{
IntermediateEvents
}
onEvents
=
{
IntermediateEvents
}
/>
/>
<
div
className
=
'fontColor333'
>
# Intermediate result
</
div
>
<
div
className
=
'fontColor333
xAxis
'
>
# Intermediate result
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
ts/webui/src/static/style/experiment/trialdetail/para.scss
View file @
173d49e5
...
@@ -65,10 +65,6 @@
...
@@ -65,10 +65,6 @@
.filter-x
{
.filter-x
{
margin-left
:
15px
;
margin-left
:
15px
;
}
}
.filter-toggle
{
line-height
:
32px
;
}
}
}
.parcoords
{
.parcoords
{
...
...
ts/webui/src/static/style/experiment/trialdetail/trialsDetail.scss
View file @
173d49e5
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
}
}
.default-metric
{
.default-metric
{
width
:
9
0
%
;
width
:
9
3
%
;
text-align
:
right
;
text-align
:
right
;
margin-top
:
15px
;
margin-top
:
15px
;
...
@@ -129,11 +129,15 @@
...
@@ -129,11 +129,15 @@
.xAxis
{
.xAxis
{
position
:
absolute
;
position
:
absolute
;
left
:
50%
;
left
:
50%
;
top
:
8
8
%
;
top
:
8
0
%
;
transform
:
translate
(
-50%
);
transform
:
translate
(
-50%
);
}
}
}
}
.intermeidateconfirm
.ms-Button-textContainer
{
margin-top
:
-1px
;
}
.detail-table
{
.detail-table
{
.ms-Button
{
.ms-Button
{
padding
:
0
;
padding
:
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment