Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
07bc2ac8
Unverified
Commit
07bc2ac8
authored
Aug 05, 2019
by
Guoxin
Committed by
GitHub
Aug 05, 2019
Browse files
Merge pull request #1413 from lvybriage/cai
Fix bug of optimization curve when trial sequenceId is not continuous
parents
9b154484
22a99826
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
src/webui/src/components/trial-detail/DefaultMetricPoint.tsx
src/webui/src/components/trial-detail/DefaultMetricPoint.tsx
+25
-22
No files found.
src/webui/src/components/trial-detail/DefaultMetricPoint.tsx
View file @
07bc2ac8
...
...
@@ -37,8 +37,8 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
defaultMetric
=
(
succeedSource
:
Array
<
TableObj
>
,
isCurve
:
boolean
)
=>
{
const
{
optimize
}
=
this
.
props
;
const
accSource
:
Array
<
DetailAccurPoint
>
=
[];
const
sho
wSource
:
Array
<
TableObj
>
=
succeedSource
.
filter
(
filterByStatus
);
const
lengthOfSource
=
sho
wSource
.
length
;
const
dra
wSource
:
Array
<
TableObj
>
=
succeedSource
.
filter
(
filterByStatus
);
const
lengthOfSource
=
dra
wSource
.
length
;
const
tooltipDefault
=
lengthOfSource
===
0
?
'
No data
'
:
''
;
if
(
this
.
_isDefaultMounted
===
true
)
{
this
.
setState
(()
=>
({
...
...
@@ -67,13 +67,14 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
}
}
else
{
const
resultList
:
Array
<
number
|
object
>
[]
=
[];
const
lineListDefault
:
Array
<
number
>
=
[];
Object
.
keys
(
showSource
).
map
(
item
=>
{
const
temp
=
showSource
[
item
];
// lineListDefault: [[sequenceId, default metric], []]
const
lineListDefault
:
Array
<
number
>
[]
=
[];
Object
.
keys
(
drawSource
).
map
(
item
=>
{
const
temp
=
drawSource
[
item
];
if
(
temp
.
acc
!==
undefined
)
{
if
(
temp
.
acc
.
default
!==
undefined
)
{
const
searchSpace
=
temp
.
description
.
parameters
;
lineListDefault
.
push
(
temp
.
acc
.
default
);
lineListDefault
.
push
(
[
temp
.
sequenceId
,
temp
.
acc
.
default
]
);
accSource
.
push
({
acc
:
temp
.
acc
.
default
,
index
:
temp
.
sequenceId
,
...
...
@@ -84,25 +85,25 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
});
// deal with best metric line
const
bestCurve
:
Array
<
number
|
object
>
[]
=
[];
// best curve data source
bestCurve
.
push
([
0
,
lineListDefault
[
0
],
accSource
[
0
].
searchSpace
]);
// push the first value
bestCurve
.
push
([
lineListDefault
[
0
][
0
]
,
lineListDefault
[
0
]
[
1
]
,
accSource
[
0
].
searchSpace
]);
if
(
optimize
===
'
maximize
'
)
{
for
(
let
i
=
1
;
i
<
lineListDefault
.
length
;
i
++
)
{
const
val
=
lineListDefault
[
i
];
const
val
=
lineListDefault
[
i
]
[
1
]
;
const
latest
=
bestCurve
[
bestCurve
.
length
-
1
][
1
];
if
(
val
>=
latest
)
{
bestCurve
.
push
([
i
,
val
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
val
,
accSource
[
i
].
searchSpace
]);
}
else
{
bestCurve
.
push
([
i
,
latest
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
latest
,
accSource
[
i
].
searchSpace
]);
}
}
}
else
{
for
(
let
i
=
1
;
i
<
lineListDefault
.
length
;
i
++
)
{
const
val
=
lineListDefault
[
i
];
const
val
=
lineListDefault
[
i
]
[
1
]
;
const
latest
=
bestCurve
[
bestCurve
.
length
-
1
][
1
];
if
(
val
<=
latest
)
{
bestCurve
.
push
([
i
,
val
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
val
,
accSource
[
i
].
searchSpace
]);
}
else
{
bestCurve
.
push
([
i
,
latest
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
latest
,
accSource
[
i
].
searchSpace
]);
}
}
}
...
...
@@ -165,14 +166,16 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
type
:
'
value
'
,
scale
:
true
},
series
:
[{
symbolSize
:
6
,
type
:
'
scatter
'
,
data
:
resultList
},
{
series
:
[
{
type
:
'
line
'
,
lineStyle
:
{
color
:
'
#FF6600
'
},
data
:
realDefault
},
{
symbolSize
:
6
,
type
:
'
scatter
'
,
data
:
resultList
}]
};
}
...
...
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