Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Remove the gap in search space value array #226

Merged
merged 3 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions src/webui/src/components/Sessionpro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Sessionpro extends React.Component<{}, SessionState> {
} else {
const hour = Math.floor(num / 3600);
const min = Math.floor(num / 60 % 60);
return hour > 0 ? `${hour} h ${min} min` : `${min} min`;
return hour > 0 ? `${hour}h ${min}min` : `${min}min`;
}
}

Expand Down Expand Up @@ -138,16 +138,24 @@ class Sessionpro extends React.Component<{}, SessionState> {
const searchSpace = JSON.parse(sessionData.params.searchSpace);
Object.keys(searchSpace).map(item => {
const key = searchSpace[item]._type;
if (key === 'loguniform' || key === 'qloguniform') {
let value = searchSpace[item]._value;
const a = Math.pow(10, value[0]);
const b = Math.pow(10, value[1]);
if (a < b) {
let value = searchSpace[item]._value;
switch (key) {
case 'loguniform':
case 'qloguniform':
const a = Math.pow(10, value[0]);
const b = Math.pow(10, value[1]);
value = [a, b];
} else {
value = [b, a];
}
searchSpace[item]._value = value;
searchSpace[item]._value = value;
break;

case 'quniform':
case 'qnormal':
case 'qlognormal':
searchSpace[item]._value = [value[0], value[1]];
Copy link
Contributor

@chicm-ms chicm-ms Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line (154) seems only keep the first two values of list and remove the rest? is this your intention?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quniform,qnormal,qlognormal这三种格式传回来的value数组length=3,前两项是最值,最后一项是gap,比如说[2,10, 2], 这种格式的取值是2,4,6,8,10

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, got it.

break;

default:

}
});
if (this._isMounted) {
Expand Down Expand Up @@ -335,7 +343,7 @@ class Sessionpro extends React.Component<{}, SessionState> {
width: 150,
className: 'tableHead',
}, {
title: 'Duration/s',
title: 'Duration',
dataIndex: 'duration',
key: 'duration',
width: '9%',
Expand Down
2 changes: 1 addition & 1 deletion src/webui/src/components/TrialStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class TrialStatus extends React.Component<{}, TabState> {
// the sort of string
sorter: (a: TableObj, b: TableObj): number => a.id.localeCompare(b.id)
}, {
title: 'Duration/s',
title: 'Duration',
dataIndex: 'duration',
key: 'duration',
width: '10%',
Expand Down