Commit b190a8bb authored by Lijiao's avatar Lijiao Committed by chicm-ms
Browse files

Remove the gap in search space value array (#226)

* Remove the gap in search space value array

* Update duration

* Fix comments of Chengmin
parent f37292ae
...@@ -98,7 +98,7 @@ class Sessionpro extends React.Component<{}, SessionState> { ...@@ -98,7 +98,7 @@ class Sessionpro extends React.Component<{}, SessionState> {
} else { } else {
const hour = Math.floor(num / 3600); const hour = Math.floor(num / 3600);
const min = Math.floor(num / 60 % 60); 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`;
} }
} }
...@@ -138,16 +138,24 @@ class Sessionpro extends React.Component<{}, SessionState> { ...@@ -138,16 +138,24 @@ class Sessionpro extends React.Component<{}, SessionState> {
const searchSpace = JSON.parse(sessionData.params.searchSpace); const searchSpace = JSON.parse(sessionData.params.searchSpace);
Object.keys(searchSpace).map(item => { Object.keys(searchSpace).map(item => {
const key = searchSpace[item]._type; const key = searchSpace[item]._type;
if (key === 'loguniform' || key === 'qloguniform') {
let value = searchSpace[item]._value; let value = searchSpace[item]._value;
switch (key) {
case 'loguniform':
case 'qloguniform':
const a = Math.pow(10, value[0]); const a = Math.pow(10, value[0]);
const b = Math.pow(10, value[1]); const b = Math.pow(10, value[1]);
if (a < b) {
value = [a, b]; 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]];
break;
default:
} }
}); });
if (this._isMounted) { if (this._isMounted) {
...@@ -335,7 +343,7 @@ class Sessionpro extends React.Component<{}, SessionState> { ...@@ -335,7 +343,7 @@ class Sessionpro extends React.Component<{}, SessionState> {
width: 150, width: 150,
className: 'tableHead', className: 'tableHead',
}, { }, {
title: 'Duration/s', title: 'Duration',
dataIndex: 'duration', dataIndex: 'duration',
key: 'duration', key: 'duration',
width: '9%', width: '9%',
......
...@@ -428,7 +428,7 @@ class TrialStatus extends React.Component<{}, TabState> { ...@@ -428,7 +428,7 @@ class TrialStatus extends React.Component<{}, TabState> {
// the sort of string // the sort of string
sorter: (a: TableObj, b: TableObj): number => a.id.localeCompare(b.id) sorter: (a: TableObj, b: TableObj): number => a.id.localeCompare(b.id)
}, { }, {
title: 'Duration/s', title: 'Duration',
dataIndex: 'duration', dataIndex: 'duration',
key: 'duration', key: 'duration',
width: '10%', width: '10%',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment