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
330e1e18
"src/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "6bc12de061a371145a25e16b51d61f837b9e2a12"
Commit
330e1e18
authored
Sep 11, 2019
by
Lijiao
Committed by
liuzhe-lz
Sep 11, 2019
Browse files
Support netst search space (#1535)
parent
7be3c5c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
144 additions
and
66 deletions
+144
-66
src/webui/src/components/trial-detail/Para.tsx
src/webui/src/components/trial-detail/Para.tsx
+144
-66
No files found.
src/webui/src/components/trial-detail/Para.tsx
View file @
330e1e18
...
@@ -128,13 +128,22 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -128,13 +128,22 @@ class Para extends React.Component<ParaProps, ParaState> {
hyperParaPic
=
(
source
:
Array
<
TableObj
>
,
searchSpace
:
string
)
=>
{
hyperParaPic
=
(
source
:
Array
<
TableObj
>
,
searchSpace
:
string
)
=>
{
// filter succeed trials [{}, {}, {}]
// filter succeed trials [{}, {}, {}]
const
dataSource
:
Array
<
TableObj
>
=
source
.
filter
(
filterByStatus
);
const
origin
=
source
.
filter
(
filterByStatus
);
const
dataSource
:
Array
<
TableObj
>
=
JSON
.
parse
(
JSON
.
stringify
(
origin
));
const
lenOfDataSource
:
number
=
dataSource
.
length
;
const
lenOfDataSource
:
number
=
dataSource
.
length
;
const
accPara
:
Array
<
number
>
=
[];
const
accPara
:
Array
<
number
>
=
[];
// specific value array
// specific value array
const
eachTrialParams
:
Array
<
string
>
=
[];
const
eachTrialParams
:
Array
<
string
>
=
[];
// experiment interface search space obj
// experiment interface search space obj
const
searchRange
=
searchSpace
!==
undefined
?
JSON
.
parse
(
searchSpace
)
:
''
;
const
searchRange
=
searchSpace
!==
undefined
?
JSON
.
parse
(
searchSpace
)
:
''
;
// nest search space
let
isNested
:
boolean
=
false
;
Object
.
keys
(
searchRange
).
map
(
item
=>
{
if
(
typeof
searchRange
[
item
].
_value
[
0
]
===
'
object
'
)
{
isNested
=
true
;
return
;
}
});
const
dimName
=
Object
.
keys
(
searchRange
);
const
dimName
=
Object
.
keys
(
searchRange
);
if
(
this
.
_isMounted
===
true
)
{
if
(
this
.
_isMounted
===
true
)
{
this
.
setState
(()
=>
({
dimName
:
dimName
}));
this
.
setState
(()
=>
({
dimName
:
dimName
}));
...
@@ -143,79 +152,131 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -143,79 +152,131 @@ class Para extends React.Component<ParaProps, ParaState> {
const
parallelAxis
:
Array
<
Dimobj
>
=
[];
const
parallelAxis
:
Array
<
Dimobj
>
=
[];
// search space range and specific value [only number]
// search space range and specific value [only number]
let
i
=
0
;
let
i
=
0
;
for
(
i
;
i
<
dimName
.
length
;
i
++
)
{
if
(
isNested
===
false
)
{
const
searchKey
=
searchRange
[
dimName
[
i
]];
for
(
i
;
i
<
dimName
.
length
;
i
++
)
{
switch
(
searchKey
.
_type
)
{
const
searchKey
=
searchRange
[
dimName
[
i
]];
case
'
uniform
'
:
switch
(
searchKey
.
_type
)
{
case
'
quniform
'
:
case
'
uniform
'
:
parallelAxis
.
push
({
case
'
quniform
'
:
dim
:
i
,
name
:
dimName
[
i
],
max
:
searchKey
.
_value
[
1
],
min
:
searchKey
.
_value
[
0
]
});
break
;
case
'
randint
'
:
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
],
min
:
searchKey
.
_value
[
0
],
max
:
searchKey
.
_value
[
1
],
});
break
;
case
'
choice
'
:
const
data
:
Array
<
string
>
=
[];
for
(
let
j
=
0
;
j
<
searchKey
.
_value
.
length
;
j
++
)
{
data
.
push
(
searchKey
.
_value
[
j
].
toString
());
}
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
],
type
:
'
category
'
,
data
:
data
,
boundaryGap
:
true
,
axisLine
:
{
lineStyle
:
{
type
:
'
dotted
'
,
// axis type,solid,dashed,dotted
width
:
1
}
},
axisTick
:
{
show
:
true
,
interval
:
0
,
alignWithLabel
:
true
,
},
axisLabel
:
{
show
:
true
,
interval
:
0
,
// rotate: 30
},
});
break
;
// support log distribute
case
'
loguniform
'
:
if
(
lenOfDataSource
>
1
)
{
parallelAxis
.
push
({
parallelAxis
.
push
({
dim
:
i
,
dim
:
i
,
name
:
dimName
[
i
],
name
:
dimName
[
i
],
type
:
'
log
'
,
max
:
searchKey
.
_value
[
1
],
min
:
searchKey
.
_value
[
0
]
});
});
}
else
{
break
;
case
'
randint
'
:
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
],
min
:
searchKey
.
_value
[
0
],
max
:
searchKey
.
_value
[
1
],
});
break
;
case
'
choice
'
:
const
data
:
Array
<
string
>
=
[];
for
(
let
j
=
0
;
j
<
searchKey
.
_value
.
length
;
j
++
)
{
data
.
push
(
searchKey
.
_value
[
j
].
toString
());
}
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
],
type
:
'
category
'
,
data
:
data
,
boundaryGap
:
true
,
axisLine
:
{
lineStyle
:
{
type
:
'
dotted
'
,
// axis type,solid,dashed,dotted
width
:
1
}
},
axisTick
:
{
show
:
true
,
interval
:
0
,
alignWithLabel
:
true
,
},
axisLabel
:
{
show
:
true
,
interval
:
0
,
// rotate: 30
},
});
break
;
// support log distribute
case
'
loguniform
'
:
if
(
lenOfDataSource
>
1
)
{
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
],
type
:
'
log
'
,
});
}
else
{
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
]
});
}
break
;
default
:
parallelAxis
.
push
({
parallelAxis
.
push
({
dim
:
i
,
dim
:
i
,
name
:
dimName
[
i
]
name
:
dimName
[
i
]
});
});
}
}
break
;
}
}
else
{
default
:
for
(
i
;
i
<
dimName
.
length
;
i
++
)
{
parallelAxis
.
push
({
const
searchKey
=
searchRange
[
dimName
[
i
]];
dim
:
i
,
switch
(
searchKey
.
_type
)
{
name
:
dimName
[
i
]
case
'
choice
'
:
});
const
data
:
Array
<
string
>
=
[];
let
j
=
0
;
for
(
j
;
j
<
searchKey
.
_value
.
length
;
j
++
)
{
const
item
=
searchKey
.
_value
[
j
];
Object
.
keys
(
item
).
map
(
key
=>
{
if
(
key
!==
'
_name
'
&&
key
!==
'
_type
'
)
{
Object
.
keys
(
item
[
key
]).
map
(
index
=>
{
if
(
index
!==
'
_type
'
)
{
const
realChoice
=
item
[
key
][
index
];
Object
.
keys
(
realChoice
).
map
(
m
=>
{
data
.
push
(
`
${
item
.
_name
}
_
${
realChoice
[
m
]}
`
);
});
}
});
}
});
}
data
.
push
(
'
null
'
);
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
],
type
:
'
category
'
,
data
:
data
,
boundaryGap
:
true
,
axisLine
:
{
lineStyle
:
{
type
:
'
dotted
'
,
// axis type,solid dashed dotted
width
:
1
}
},
axisTick
:
{
show
:
true
,
interval
:
0
,
alignWithLabel
:
true
,
},
axisLabel
:
{
show
:
true
,
interval
:
0
,
// rotate: 30
},
});
break
;
default
:
parallelAxis
.
push
({
dim
:
i
,
name
:
dimName
[
i
]
});
}
}
}
}
}
parallelAxis
.
push
({
parallelAxis
.
push
({
...
@@ -283,6 +344,23 @@ class Para extends React.Component<ParaProps, ParaState> {
...
@@ -283,6 +344,23 @@ class Para extends React.Component<ParaProps, ParaState> {
}
}
}
}
});
});
// nested search space, deal data
if
(
isNested
!==
false
)
{
eachTrialParams
.
forEach
(
element
=>
{
Object
.
keys
(
element
).
forEach
(
key
=>
{
let
item
=
element
[
key
];
if
(
typeof
item
===
'
object
'
)
{
Object
.
keys
(
item
).
forEach
(
index
=>
{
if
(
index
!==
'
_name
'
)
{
element
[
key
]
=
`
${
item
.
_name
}
_
${
item
[
index
]}
`
;
}
else
{
element
[
key
]
=
'
null
'
;
}
});
}
});
});
}
if
(
this
.
_isMounted
)
{
if
(
this
.
_isMounted
)
{
// if not return final result
// if not return final result
const
maxVal
=
accPara
.
length
===
0
?
1
:
Math
.
max
(...
accPara
);
const
maxVal
=
accPara
.
length
===
0
?
1
:
Math
.
max
(...
accPara
);
...
...
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