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
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>
...
@@ -37,8 +37,8 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
defaultMetric
=
(
succeedSource
:
Array
<
TableObj
>
,
isCurve
:
boolean
)
=>
{
defaultMetric
=
(
succeedSource
:
Array
<
TableObj
>
,
isCurve
:
boolean
)
=>
{
const
{
optimize
}
=
this
.
props
;
const
{
optimize
}
=
this
.
props
;
const
accSource
:
Array
<
DetailAccurPoint
>
=
[];
const
accSource
:
Array
<
DetailAccurPoint
>
=
[];
const
sho
wSource
:
Array
<
TableObj
>
=
succeedSource
.
filter
(
filterByStatus
);
const
dra
wSource
:
Array
<
TableObj
>
=
succeedSource
.
filter
(
filterByStatus
);
const
lengthOfSource
=
sho
wSource
.
length
;
const
lengthOfSource
=
dra
wSource
.
length
;
const
tooltipDefault
=
lengthOfSource
===
0
?
'
No data
'
:
''
;
const
tooltipDefault
=
lengthOfSource
===
0
?
'
No data
'
:
''
;
if
(
this
.
_isDefaultMounted
===
true
)
{
if
(
this
.
_isDefaultMounted
===
true
)
{
this
.
setState
(()
=>
({
this
.
setState
(()
=>
({
...
@@ -67,13 +67,14 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -67,13 +67,14 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
}
}
}
else
{
}
else
{
const
resultList
:
Array
<
number
|
object
>
[]
=
[];
const
resultList
:
Array
<
number
|
object
>
[]
=
[];
const
lineListDefault
:
Array
<
number
>
=
[];
// lineListDefault: [[sequenceId, default metric], []]
Object
.
keys
(
showSource
).
map
(
item
=>
{
const
lineListDefault
:
Array
<
number
>
[]
=
[];
const
temp
=
showSource
[
item
];
Object
.
keys
(
drawSource
).
map
(
item
=>
{
const
temp
=
drawSource
[
item
];
if
(
temp
.
acc
!==
undefined
)
{
if
(
temp
.
acc
!==
undefined
)
{
if
(
temp
.
acc
.
default
!==
undefined
)
{
if
(
temp
.
acc
.
default
!==
undefined
)
{
const
searchSpace
=
temp
.
description
.
parameters
;
const
searchSpace
=
temp
.
description
.
parameters
;
lineListDefault
.
push
(
temp
.
acc
.
default
);
lineListDefault
.
push
(
[
temp
.
sequenceId
,
temp
.
acc
.
default
]
);
accSource
.
push
({
accSource
.
push
({
acc
:
temp
.
acc
.
default
,
acc
:
temp
.
acc
.
default
,
index
:
temp
.
sequenceId
,
index
:
temp
.
sequenceId
,
...
@@ -84,25 +85,25 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
...
@@ -84,25 +85,25 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
});
});
// deal with best metric line
// deal with best metric line
const
bestCurve
:
Array
<
number
|
object
>
[]
=
[];
// best curve data source
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
'
)
{
if
(
optimize
===
'
maximize
'
)
{
for
(
let
i
=
1
;
i
<
lineListDefault
.
length
;
i
++
)
{
for
(
let
i
=
1
;
i
<
lineListDefault
.
length
;
i
++
)
{
const
val
=
lineListDefault
[
i
];
const
val
=
lineListDefault
[
i
]
[
1
]
;
const
latest
=
bestCurve
[
bestCurve
.
length
-
1
][
1
];
const
latest
=
bestCurve
[
bestCurve
.
length
-
1
][
1
];
if
(
val
>=
latest
)
{
if
(
val
>=
latest
)
{
bestCurve
.
push
([
i
,
val
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
val
,
accSource
[
i
].
searchSpace
]);
}
else
{
}
else
{
bestCurve
.
push
([
i
,
latest
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
latest
,
accSource
[
i
].
searchSpace
]);
}
}
}
}
}
else
{
}
else
{
for
(
let
i
=
1
;
i
<
lineListDefault
.
length
;
i
++
)
{
for
(
let
i
=
1
;
i
<
lineListDefault
.
length
;
i
++
)
{
const
val
=
lineListDefault
[
i
];
const
val
=
lineListDefault
[
i
]
[
1
]
;
const
latest
=
bestCurve
[
bestCurve
.
length
-
1
][
1
];
const
latest
=
bestCurve
[
bestCurve
.
length
-
1
][
1
];
if
(
val
<=
latest
)
{
if
(
val
<=
latest
)
{
bestCurve
.
push
([
i
,
val
,
accSource
[
i
].
searchSpace
]);
bestCurve
.
push
([
lineListDefault
[
i
][
0
]
,
val
,
accSource
[
i
].
searchSpace
]);
}
else
{
}
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>
...
@@ -165,14 +166,16 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState>
type
:
'
value
'
,
type
:
'
value
'
,
scale
:
true
scale
:
true
},
},
series
:
[{
series
:
[
symbolSize
:
6
,
{
type
:
'
scatter
'
,
data
:
resultList
},
{
type
:
'
line
'
,
type
:
'
line
'
,
lineStyle
:
{
color
:
'
#FF6600
'
},
lineStyle
:
{
color
:
'
#FF6600
'
},
data
:
realDefault
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