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
9644cf69
Unverified
Commit
9644cf69
authored
May 13, 2022
by
Lijiaoa
Committed by
GitHub
May 13, 2022
Browse files
[fix issue] add dropdown:`maximize` and `minimize` for hyper-parameter top trials (#4850)
parent
afe00e46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
7 deletions
+34
-7
ts/webui/src/components/experiment/trialdetail/chart/Para.tsx
...ebui/src/components/experiment/trialdetail/chart/Para.tsx
+31
-4
ts/webui/src/static/style/loading.scss
ts/webui/src/static/style/loading.scss
+3
-3
No files found.
ts/webui/src/components/experiment/trialdetail/chart/Para.tsx
View file @
9644cf69
...
@@ -15,6 +15,7 @@ import '@style/experiment/trialdetail/para.scss';
...
@@ -15,6 +15,7 @@ import '@style/experiment/trialdetail/para.scss';
interface
ParaState
{
interface
ParaState
{
dimName
:
string
[];
dimName
:
string
[];
selectedPercent
:
string
;
selectedPercent
:
string
;
userSelectOptimizeMode
:
string
;
primaryMetricKey
:
string
;
primaryMetricKey
:
string
;
noChart
:
boolean
;
noChart
:
boolean
;
customizeColumnsDialogVisible
:
boolean
;
customizeColumnsDialogVisible
:
boolean
;
...
@@ -49,6 +50,7 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -49,6 +50,7 @@ class Para extends React.Component<ParaProps, ParaState> {
dimName
:
[],
dimName
:
[],
primaryMetricKey
:
'
default
'
,
primaryMetricKey
:
'
default
'
,
selectedPercent
:
'
1
'
,
selectedPercent
:
'
1
'
,
userSelectOptimizeMode
:
EXPERIMENT
.
optimizeMode
||
'
maximize
'
,
noChart
:
true
,
noChart
:
true
,
customizeColumnsDialogVisible
:
false
,
customizeColumnsDialogVisible
:
false
,
availableDimensions
:
[],
availableDimensions
:
[],
...
@@ -69,6 +71,15 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -69,6 +71,15 @@ class Para extends React.Component<ParaProps, ParaState> {
}
}
};
};
// get user mode number 'max' or 'min'
updateUserOptimizeMode
=
(
event
:
React
.
FormEvent
<
HTMLDivElement
>
,
item
?:
IDropdownOption
):
void
=>
{
if
(
item
!==
undefined
)
{
this
.
setState
({
userSelectOptimizeMode
:
item
.
key
.
toString
()
},
()
=>
{
this
.
renderParallelCoordinates
();
});
}
};
// select all final keys
// select all final keys
updateEntries
=
(
event
:
React
.
FormEvent
<
HTMLDivElement
>
,
item
:
any
):
void
=>
{
updateEntries
=
(
event
:
React
.
FormEvent
<
HTMLDivElement
>
,
item
:
any
):
void
=>
{
if
(
item
!==
undefined
)
{
if
(
item
!==
undefined
)
{
...
@@ -90,8 +101,14 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -90,8 +101,14 @@ class Para extends React.Component<ParaProps, ParaState> {
}
}
render
():
React
.
ReactNode
{
render
():
React
.
ReactNode
{
const
{
selectedPercent
,
noChart
,
customizeColumnsDialogVisible
,
availableDimensions
,
chosenDimensions
}
=
const
{
this
.
state
;
selectedPercent
,
noChart
,
customizeColumnsDialogVisible
,
availableDimensions
,
chosenDimensions
,
userSelectOptimizeMode
}
=
this
.
state
;
return
(
return
(
<
div
className
=
'parameter'
>
<
div
className
=
'parameter'
>
...
@@ -103,6 +120,16 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -103,6 +120,16 @@ class Para extends React.Component<ParaProps, ParaState> {
}
}
}
}
styles
=
{
{
root
:
{
marginRight
:
10
}
}
}
styles
=
{
{
root
:
{
marginRight
:
10
}
}
}
/>
/>
<
Dropdown
selectedKey
=
{
userSelectOptimizeMode
}
onChange
=
{
this
.
updateUserOptimizeMode
}
options
=
{
[
{
key
:
'
maximize
'
,
text
:
'
Maximize
'
},
{
key
:
'
minimize
'
,
text
:
'
Minimize
'
}
]
}
styles
=
{
{
dropdown
:
{
width
:
100
}
}
}
className
=
'para-filter-percent'
/>
<
Dropdown
<
Dropdown
selectedKey
=
{
selectedPercent
}
selectedKey
=
{
selectedPercent
}
onChange
=
{
this
.
percentNum
}
onChange
=
{
this
.
percentNum
}
...
@@ -175,7 +202,7 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -175,7 +202,7 @@ class Para extends React.Component<ParaProps, ParaState> {
private
renderParallelCoordinates
():
void
{
private
renderParallelCoordinates
():
void
{
const
{
searchSpace
}
=
this
.
props
;
const
{
searchSpace
}
=
this
.
props
;
const
percent
=
parseFloat
(
this
.
state
.
selectedPercent
);
const
percent
=
parseFloat
(
this
.
state
.
selectedPercent
);
const
{
primaryMetricKey
,
chosenDimensions
}
=
this
.
state
;
const
{
primaryMetricKey
,
chosenDimensions
,
userSelectOptimizeMode
}
=
this
.
state
;
const
inferredSearchSpace
=
TRIALS
.
inferredSearchSpace
(
searchSpace
);
const
inferredSearchSpace
=
TRIALS
.
inferredSearchSpace
(
searchSpace
);
const
inferredMetricSpace
=
TRIALS
.
inferredMetricSpace
();
const
inferredMetricSpace
=
TRIALS
.
inferredMetricSpace
();
...
@@ -200,7 +227,7 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -200,7 +227,7 @@ class Para extends React.Component<ParaProps, ParaState> {
// set color for primary metrics
// set color for primary metrics
// `colorScale` is used to produce a color range, while `scale` is to produce a pixel range
// `colorScale` is used to produce a color range, while `scale` is to produce a pixel range
colorScale
=
this
.
convertToD3Scale
(
v
,
false
);
colorScale
=
this
.
convertToD3Scale
(
v
,
false
);
convertedTrials
.
sort
((
a
,
b
)
=>
(
EXPERIMENT
.
o
ptimizeMode
===
'
minimize
'
?
a
[
k
]
-
b
[
k
]
:
b
[
k
]
-
a
[
k
]));
convertedTrials
.
sort
((
a
,
b
)
=>
(
userSelectO
ptimizeMode
===
'
minimize
'
?
a
[
k
]
-
b
[
k
]
:
b
[
k
]
-
a
[
k
]));
// filter top trials
// filter top trials
if
(
percent
!=
1
)
{
if
(
percent
!=
1
)
{
const
keptTrialNum
=
Math
.
max
(
Math
.
ceil
(
convertedTrials
.
length
*
percent
),
1
);
const
keptTrialNum
=
Math
.
max
(
Math
.
ceil
(
convertedTrials
.
length
*
percent
),
1
);
...
...
ts/webui/src/static/style/loading.scss
View file @
9644cf69
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
margin
:
0
auto
;
margin
:
0
auto
;
img
{
img
{
width
:
4
0%
;
width
:
2
0%
;
position
:
fixed
;
position
:
fixed
;
top
:
3
0%
;
top
:
4
0%
;
left
:
3
0%
;
left
:
4
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