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
9cc234b2
Commit
9cc234b2
authored
Nov 19, 2018
by
Lijiao
Committed by
chicm-ms
Nov 19, 2018
Browse files
Add more tooltips in default metric graph (#370)
* Add more tooltip in default metric graph and fix bug * update
parent
8f716170
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
23 deletions
+78
-23
src/webui/src/components/Overview.tsx
src/webui/src/components/Overview.tsx
+8
-5
src/webui/src/components/TrialsDetail.tsx
src/webui/src/components/TrialsDetail.tsx
+36
-14
src/webui/src/components/overview/SuccessTable.tsx
src/webui/src/components/overview/SuccessTable.tsx
+2
-0
src/webui/src/components/trial-detail/TableList.tsx
src/webui/src/components/trial-detail/TableList.tsx
+5
-1
src/webui/src/static/interface.ts
src/webui/src/static/interface.ts
+11
-0
src/webui/src/static/style/trialsDetail.scss
src/webui/src/static/style/trialsDetail.scss
+16
-3
No files found.
src/webui/src/components/Overview.tsx
View file @
9cc234b2
...
@@ -296,6 +296,7 @@ class Overview extends React.Component<{}, OverviewState> {
...
@@ -296,6 +296,7 @@ class Overview extends React.Component<{}, OverviewState> {
if
(
res
.
data
.
params
.
searchSpace
)
{
if
(
res
.
data
.
params
.
searchSpace
)
{
res
.
data
.
params
.
searchSpace
=
JSON
.
parse
(
res
.
data
.
params
.
searchSpace
);
res
.
data
.
params
.
searchSpace
=
JSON
.
parse
(
res
.
data
.
params
.
searchSpace
);
}
}
const
isEdge
=
navigator
.
userAgent
.
indexOf
(
'
Edge
'
)
!==
-
1
?
true
:
false
;
const
interResultList
=
res2
.
data
;
const
interResultList
=
res2
.
data
;
const
contentOfExperiment
=
JSON
.
stringify
(
res
.
data
,
null
,
2
);
const
contentOfExperiment
=
JSON
.
stringify
(
res
.
data
,
null
,
2
);
let
trialMessagesArr
=
res1
.
data
;
let
trialMessagesArr
=
res1
.
data
;
...
@@ -315,14 +316,16 @@ class Overview extends React.Component<{}, OverviewState> {
...
@@ -315,14 +316,16 @@ class Overview extends React.Component<{}, OverviewState> {
const
trialMessages
=
JSON
.
stringify
(
trialMessagesArr
,
null
,
2
);
const
trialMessages
=
JSON
.
stringify
(
trialMessagesArr
,
null
,
2
);
const
aTag
=
document
.
createElement
(
'
a
'
);
const
aTag
=
document
.
createElement
(
'
a
'
);
const
file
=
new
Blob
([
contentOfExperiment
,
trialMessages
],
{
type
:
'
application/json
'
});
const
file
=
new
Blob
([
contentOfExperiment
,
trialMessages
],
{
type
:
'
application/json
'
});
aTag
.
download
=
'
experiment.
txt
'
;
aTag
.
download
=
'
experiment.
json
'
;
aTag
.
href
=
URL
.
createObjectURL
(
file
);
aTag
.
href
=
URL
.
createObjectURL
(
file
);
aTag
.
click
();
aTag
.
click
();
if
(
!
isEdge
)
{
URL
.
revokeObjectURL
(
aTag
.
href
);
URL
.
revokeObjectURL
(
aTag
.
href
);
}
if
(
navigator
.
userAgent
.
indexOf
(
'
Firefox
'
)
>
-
1
)
{
if
(
navigator
.
userAgent
.
indexOf
(
'
Firefox
'
)
>
-
1
)
{
const
downTag
=
document
.
createElement
(
'
a
'
);
const
downTag
=
document
.
createElement
(
'
a
'
);
downTag
.
addEventListener
(
'
click
'
,
function
()
{
downTag
.
addEventListener
(
'
click
'
,
function
()
{
downTag
.
download
=
'
experiment.
txt
'
;
downTag
.
download
=
'
experiment.
json
'
;
downTag
.
href
=
URL
.
createObjectURL
(
file
);
downTag
.
href
=
URL
.
createObjectURL
(
file
);
});
});
let
eventMouse
=
document
.
createEvent
(
'
MouseEvents
'
);
let
eventMouse
=
document
.
createEvent
(
'
MouseEvents
'
);
...
@@ -336,7 +339,7 @@ class Overview extends React.Component<{}, OverviewState> {
...
@@ -336,7 +339,7 @@ class Overview extends React.Component<{}, OverviewState> {
}));
}));
}
}
// trial accuracy graph
// trial accuracy graph
Default Metric
drawPointGraph
=
()
=>
{
drawPointGraph
=
()
=>
{
const
{
tableData
}
=
this
.
state
;
const
{
tableData
}
=
this
.
state
;
...
@@ -366,7 +369,7 @@ class Overview extends React.Component<{}, OverviewState> {
...
@@ -366,7 +369,7 @@ class Overview extends React.Component<{}, OverviewState> {
data
:
indexarr
data
:
indexarr
},
},
yAxis
:
{
yAxis
:
{
name
:
'
Accuracy
'
,
name
:
'
Default Metric
'
,
type
:
'
value
'
,
type
:
'
value
'
,
data
:
accarr
data
:
accarr
},
},
...
...
src/webui/src/components/TrialsDetail.tsx
View file @
9cc234b2
...
@@ -3,7 +3,7 @@ import axios from 'axios';
...
@@ -3,7 +3,7 @@ import axios from 'axios';
import
{
MANAGER_IP
}
from
'
../static/const
'
;
import
{
MANAGER_IP
}
from
'
../static/const
'
;
import
{
Row
,
Col
,
Button
,
Tabs
,
Input
}
from
'
antd
'
;
import
{
Row
,
Col
,
Button
,
Tabs
,
Input
}
from
'
antd
'
;
const
Search
=
Input
.
Search
;
const
Search
=
Input
.
Search
;
import
{
TableObj
,
Parameters
,
AccurPoint
}
from
'
../static/interface
'
;
import
{
TableObj
,
Parameters
,
Detail
AccurPoint
,
TooltipForAccuracy
,
}
from
'
../static/interface
'
;
import
Accuracy
from
'
./overview/Accuracy
'
;
import
Accuracy
from
'
./overview/Accuracy
'
;
import
Duration
from
'
./trial-detail/Duration
'
;
import
Duration
from
'
./trial-detail/Duration
'
;
import
Title1
from
'
./overview/Title1
'
;
import
Title1
from
'
./overview/Title1
'
;
...
@@ -42,11 +42,12 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
...
@@ -42,11 +42,12 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
status
===
200
&&
this
.
_isMounted
)
{
if
(
res
.
status
===
200
&&
this
.
_isMounted
)
{
const
accData
=
res
.
data
;
const
accData
=
res
.
data
;
const
accSource
:
Array
<
AccurPoint
>
=
[];
const
accSource
:
Array
<
Detail
AccurPoint
>
=
[];
Object
.
keys
(
accData
).
map
(
item
=>
{
Object
.
keys
(
accData
).
map
(
item
=>
{
if
(
accData
[
item
].
status
===
'
SUCCEEDED
'
&&
accData
[
item
].
finalMetricData
)
{
if
(
accData
[
item
].
status
===
'
SUCCEEDED
'
&&
accData
[
item
].
finalMetricData
)
{
let
acc
;
let
acc
;
let
tableAcc
;
let
tableAcc
;
let
searchSpace
:
object
=
{};
if
(
accData
[
item
].
finalMetricData
)
{
if
(
accData
[
item
].
finalMetricData
)
{
acc
=
JSON
.
parse
(
accData
[
item
].
finalMetricData
.
data
);
acc
=
JSON
.
parse
(
accData
[
item
].
finalMetricData
.
data
);
if
(
typeof
(
acc
)
===
'
object
'
)
{
if
(
typeof
(
acc
)
===
'
object
'
)
{
...
@@ -57,42 +58,62 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
...
@@ -57,42 +58,62 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
tableAcc
=
acc
;
tableAcc
=
acc
;
}
}
}
}
if
(
accData
[
item
].
hyperParameters
)
{
searchSpace
=
JSON
.
parse
(
accData
[
item
].
hyperParameters
).
parameters
;
}
accSource
.
push
({
accSource
.
push
({
acc
:
tableAcc
,
acc
:
tableAcc
,
index
:
accData
[
item
].
sequenceId
index
:
accData
[
item
].
sequenceId
,
searchSpace
:
JSON
.
stringify
(
searchSpace
)
});
});
}
}
});
});
const
accarr
:
Array
<
number
>
=
[];
const
resultList
:
Array
<
number
|
string
>
[]
=
[];
const
indexarr
:
Array
<
number
>
=
[];
Object
.
keys
(
accSource
).
map
(
item
=>
{
Object
.
keys
(
accSource
).
map
(
item
=>
{
const
items
=
accSource
[
item
];
const
items
=
accSource
[
item
];
accarr
.
push
(
items
.
acc
);
let
temp
:
Array
<
number
|
string
>
;
indexarr
.
push
(
items
.
index
);
temp
=
[
items
.
index
,
items
.
acc
,
JSON
.
parse
(
items
.
searchSpace
)];
resultList
.
push
(
temp
);
});
});
const
allAcuracy
=
{
const
allAcuracy
=
{
tooltip
:
{
tooltip
:
{
trigger
:
'
item
'
trigger
:
'
item
'
,
enterable
:
true
,
position
:
function
(
point
:
Array
<
number
>
,
data
:
TooltipForAccuracy
)
{
if
(
data
.
data
[
0
]
<
resultList
.
length
/
2
)
{
return
[
point
[
0
],
10
];
}
else
{
return
[
point
[
0
]
-
300
,
10
];
}
},
formatter
:
function
(
data
:
TooltipForAccuracy
)
{
const
result
=
'
<div class="tooldetailAccuracy">
'
+
'
<div>Trial No:
'
+
data
.
data
[
0
]
+
'
</div>
'
+
'
<div>Default Metrc:
'
+
data
.
data
[
1
]
+
'
</div>
'
+
'
<div>Parameters:
'
+
'
<pre>
'
+
JSON
.
stringify
(
data
.
data
[
2
],
null
,
4
)
+
'
</pre>
'
+
'
</div>
'
+
'
</div>
'
;
return
result
;
}
},
},
xAxis
:
{
xAxis
:
{
name
:
'
Trial
'
,
name
:
'
Trial
'
,
type
:
'
category
'
,
type
:
'
category
'
,
data
:
indexarr
},
},
yAxis
:
{
yAxis
:
{
name
:
'
Accuracy
'
,
name
:
'
Default Metric
'
,
type
:
'
value
'
,
type
:
'
value
'
,
data
:
accarr
},
},
series
:
[{
series
:
[{
symbolSize
:
6
,
symbolSize
:
6
,
type
:
'
scatter
'
,
type
:
'
scatter
'
,
data
:
accarr
data
:
resultList
}]
}]
};
};
this
.
setState
({
accSource
:
allAcuracy
},
()
=>
{
this
.
setState
({
accSource
:
allAcuracy
},
()
=>
{
if
(
accarr
.
length
===
0
)
{
if
(
resultList
.
length
===
0
)
{
this
.
setState
({
this
.
setState
({
accNodata
:
'
No data
'
accNodata
:
'
No data
'
});
});
...
@@ -250,8 +271,9 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
...
@@ -250,8 +271,9 @@ class TrialsDetail extends React.Component<{}, TrialDetailState> {
accSource
,
accNodata
,
accSource
,
accNodata
,
tableListSource
tableListSource
}
=
this
.
state
;
}
=
this
.
state
;
const
titleOfacc
=
(
const
titleOfacc
=
(
<
Title1
text
=
"
Trial Accuracy
"
icon
=
"3.png"
/>
<
Title1
text
=
"
Default Metric
"
icon
=
"3.png"
/>
);
);
const
titleOfhyper
=
(
const
titleOfhyper
=
(
<
Title1
text
=
"Hyper Parameter"
icon
=
"1.png"
/>
<
Title1
text
=
"Hyper Parameter"
icon
=
"1.png"
/>
...
...
src/webui/src/components/overview/SuccessTable.tsx
View file @
9cc234b2
...
@@ -42,6 +42,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
...
@@ -42,6 +42,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
dataIndex
:
'
duration
'
,
dataIndex
:
'
duration
'
,
key
:
'
duration
'
,
key
:
'
duration
'
,
width
:
140
,
width
:
140
,
sorter
:
(
a
:
TableObj
,
b
:
TableObj
)
=>
(
a
.
duration
as
number
)
-
(
b
.
duration
as
number
),
render
:
(
text
:
string
,
record
:
TableObj
)
=>
{
render
:
(
text
:
string
,
record
:
TableObj
)
=>
{
let
duration
;
let
duration
;
if
(
record
.
duration
)
{
if
(
record
.
duration
)
{
...
@@ -69,6 +70,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
...
@@ -69,6 +70,7 @@ class SuccessTable extends React.Component<SuccessTableProps, {}> {
title
:
'
Default Metric
'
,
title
:
'
Default Metric
'
,
dataIndex
:
'
acc
'
,
dataIndex
:
'
acc
'
,
key
:
'
acc
'
,
key
:
'
acc
'
,
sorter
:
(
a
:
TableObj
,
b
:
TableObj
)
=>
(
a
.
acc
as
number
)
-
(
b
.
acc
as
number
),
render
:
(
text
:
string
,
record
:
TableObj
)
=>
{
render
:
(
text
:
string
,
record
:
TableObj
)
=>
{
const
accuracy
=
record
.
acc
;
const
accuracy
=
record
.
acc
;
let
wei
=
0
;
let
wei
=
0
;
...
...
src/webui/src/components/trial-detail/TableList.tsx
View file @
9cc234b2
...
@@ -130,8 +130,12 @@ class TableList extends React.Component<TableListProps, TableListState> {
...
@@ -130,8 +130,12 @@ class TableList extends React.Component<TableListProps, TableListState> {
})
})
.
catch
(
error
=>
{
.
catch
(
error
=>
{
if
(
error
.
response
.
status
===
500
)
{
if
(
error
.
response
.
status
===
500
)
{
if
(
error
.
response
.
data
.
error
)
{
message
.
error
(
error
.
response
.
data
.
error
);
}
else
{
message
.
error
(
'
500 error, fail to cancel the job
'
);
message
.
error
(
'
500 error, fail to cancel the job
'
);
}
}
}
});
});
}
}
...
...
src/webui/src/static/interface.ts
View file @
9cc234b2
...
@@ -42,6 +42,16 @@ interface AccurPoint {
...
@@ -42,6 +42,16 @@ interface AccurPoint {
index
:
number
;
index
:
number
;
}
}
interface
DetailAccurPoint
{
acc
:
number
;
index
:
number
;
searchSpace
:
string
;
}
interface
TooltipForAccuracy
{
data
:
Array
<
number
|
object
>
;
}
interface
TrialNumber
{
interface
TrialNumber
{
succTrial
:
number
;
succTrial
:
number
;
failTrial
:
number
;
failTrial
:
number
;
...
@@ -82,5 +92,6 @@ interface VisualMapValue {
...
@@ -82,5 +92,6 @@ interface VisualMapValue {
export
{
TableObj
,
Parameters
,
Experiment
,
export
{
TableObj
,
Parameters
,
Experiment
,
AccurPoint
,
TrialNumber
,
TrialJob
,
AccurPoint
,
TrialNumber
,
TrialJob
,
DetailAccurPoint
,
TooltipForAccuracy
,
HoverName
,
ParaObj
,
VisualMapValue
,
Dimobj
HoverName
,
ParaObj
,
VisualMapValue
,
Dimobj
};
};
\ No newline at end of file
src/webui/src/static/style/trialsDetail.scss
View file @
9cc234b2
...
@@ -17,8 +17,7 @@
...
@@ -17,8 +17,7 @@
background-color
:
#999
;
background-color
:
#999
;
span
{
span
{
color
:
#fff
;
color
:
#fff
;
font-size
:
18px
;
font-weight
:
normal
;
font-family
:
'Segoe'
;
}
}
}
}
}
}
...
@@ -53,3 +52,17 @@
...
@@ -53,3 +52,17 @@
overflow
:
hidden
;
overflow
:
hidden
;
}
}
}
}
.tooldetailAccuracy
{
user-select
:
text
;
min-width
:
245px
;
max-width
:
350px
;
max-height
:
350px
;
padding
:
10px
10px
;
white-space
:
normal
;
overflow
:
auto
;
pre
{
overflow
:
inherit
;
margin-bottom
:
10px
;
}
}
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