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

Support hyper-band #358

Merged
merged 1 commit into from
Nov 15, 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
Binary file modified src/webui/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/webui/src/components/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Overview extends React.Component<{}, OverviewState> {
const clusterMetaData = sessionData.params.clusterMetaData;
const endTimenum = sessionData.endTime;
const assessor = sessionData.params.assessor;
const advisor = sessionData.params.advisor;
trialPro.push({
id: sessionData.id,
author: sessionData.params.authorName,
Expand All @@ -118,6 +119,7 @@ class Overview extends React.Component<{}, OverviewState> {
trainingServicePlatform: trainingPlatform,
tuner: sessionData.params.tuner,
assessor: assessor ? assessor : undefined,
advisor: advisor ? advisor : undefined,
clusterMetaData: clusterMetaData ? clusterMetaData : undefined
});
// search space format loguniform max and min
Expand Down
1 change: 1 addition & 0 deletions src/webui/src/components/overview/TrialProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TrialInfo extends React.Component<TrialInfoProps, {}> {
trialConcurrency: tiralProInfo.runConcurren,
tuner: tiralProInfo.tuner,
assessor: tiralProInfo.assessor ? tiralProInfo.assessor : undefined,
advisor: tiralProInfo.advisor ? tiralProInfo.advisor : undefined,
clusterMetaData: tiralProInfo.clusterMetaData ? tiralProInfo.clusterMetaData : undefined
});
return (
Expand Down
204 changes: 106 additions & 98 deletions src/webui/src/components/trial-detail/Para.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ interface ParaState {
visualValue: VisualMapValue;
}

interface SearchSpace {
_value: Array<number | string>;
_type: string;
}

message.config({
top: 250,
duration: 2,
Expand Down Expand Up @@ -54,6 +59,82 @@ class Para extends React.Component<{}, ParaState> {
};
}

getParallelAxis =
( dimName: Array<string>, searchRange: SearchSpace,
parallelAxis: Array<Dimobj>, accPara: Array<number>,
eachTrialParams: Array<string>, paraYdata: number[][]
) => {
if (this._isMounted) {
this.setState(() => ({
dimName: dimName,
visualValue: {
minAccuracy: accPara.length !== 0 ? Math.min(...accPara) : 0,
maxAccuracy: accPara.length !== 0 ? Math.max(...accPara) : 1
}
}));
}
// search space range and specific value [only number]
for (let i = 0; i < dimName.length; i++) {
const searchKey = searchRange[dimName[i]];
switch (searchKey._type) {
case 'uniform':
case 'quniform':
parallelAxis.push({
dim: i,
name: dimName[i],
max: searchKey._value[1],
min: searchKey._value[0]
});
break;

case 'randint':
parallelAxis.push({
dim: i,
name: dimName[i],
max: searchKey._value[0],
min: 0
});
break;

case 'choice':
const data: Array<string> = [];
for (let j = 0; j < searchKey._value.length; j++) {
data.push(searchKey._value[j].toString());
}
parallelAxis.push({
dim: i,
name: dimName[i],
type: 'category',
data: data
});
break;

default:
parallelAxis.push({
dim: i,
name: dimName[i]
});

}
}
// get data for every lines. if dim is choice type, number -> toString()
Object.keys(eachTrialParams).map(item => {
let temp: Array<number> = [];
for (let i = 0; i < dimName.length; i++) {
if ('type' in parallelAxis[i]) {
temp.push(
eachTrialParams[item][dimName[i]].toString()
);
} else {
temp.push(
eachTrialParams[item][dimName[i]]
);
}
}
paraYdata.push(temp);
});
}

hyperParaPic = () => {
axios
.all([
Expand All @@ -66,17 +147,14 @@ class Para extends React.Component<{}, ParaState> {
const accParaData = res.data;
const accPara: Array<number> = [];
// specific value array
const speValue: Array<string> = [];
// yAxis specific name
const speDimName: Array<string> = [];
const eachTrialParams: Array<string> = [];
const parallelAxis: Array<Dimobj> = [];
const paraYdata: number[][] = [];
// experiment interface search space obj
const searchRange = JSON.parse(res1.data.params.searchSpace);
const reallySearchKeys = Object.keys(searchRange);
// trial-jobs interface list
Object.keys(accParaData).map(item => {
if (accParaData[item].hyperParameters !== undefined) {
const tem = JSON.parse(accParaData[item].hyperParameters).parameters;
// get dim and every line specific number
speDimName.push(tem);
}
if (accParaData[item].status === 'SUCCEEDED') {
if (accParaData[item].finalMetricData && accParaData[item].hyperParameters) {
// get acc array
Expand All @@ -93,101 +171,32 @@ class Para extends React.Component<{}, ParaState> {
accPara.push(accReal);
// get dim and every line specific number
const temp = JSON.parse(accParaData[item].hyperParameters).parameters;
speValue.push(temp);
eachTrialParams.push(temp);
}
}
});
// get [batch_size...] name, default each trial is same
// if (speValue.length !== 0) {
const dimName = Object.keys(speDimName[0]);
if (this._isMounted) {
this.setState(() => ({
dimName: dimName,
visualValue: {
minAccuracy: accPara.length !== 0 ? Math.min(...accPara) : 0,
maxAccuracy: accPara.length !== 0 ? Math.max(...accPara) : 1
}
}));
}
// search space range and specific value [only number]
const searchRange = JSON.parse(res1.data.params.searchSpace);
for (let i = 0; i < dimName.length; i++) {
const searchKey = searchRange[dimName[i]];
switch (searchKey._type) {
case 'uniform':
case 'quniform':
parallelAxis.push({
dim: i,
name: dimName[i],
max: searchKey._value[1],
min: searchKey._value[0]
});
break;

case 'randint':
parallelAxis.push({
dim: i,
name: dimName[i],
max: searchKey._value[0],
min: 0
});
break;

case 'choice':
const data: Array<string> = [];
for (let j = 0; j < searchKey._value.length; j++) {
data.push(searchKey._value[j].toString());
}
parallelAxis.push({
dim: i,
name: dimName[i],
type: 'category',
data: data
});
break;

default:
parallelAxis.push({
dim: i,
name: dimName[i]
});
const dimName = reallySearchKeys;
this.getParallelAxis(dimName, searchRange, parallelAxis, accPara, eachTrialParams, paraYdata);

}
}
// get data for every lines. if dim is choice type
// number -> toString()
Object.keys(speValue).map(item => {
let temp: Array<number> = [];
for (let i = 0; i < dimName.length; i++) {
if ('type' in parallelAxis[i]) {
temp.push(
speValue[item][dimName[i]].toString()
);
} else {
temp.push(
speValue[item][dimName[i]]
);
}
}
paraYdata.push(temp);
});
// add acc
Object.keys(paraYdata).map(item => {
paraYdata[item].push(accPara[item]);
});

// according acc to sort ydata
if (paraYdata.length !== 0) {
const len = paraYdata[0].length - 1;
paraYdata.sort((a, b) => b[len] - a[len]);
}
this.setState(() => ({
paraBack: {
parallelAxis: parallelAxis,
data: paraYdata
}
}));
const { percent, swapAxisArr } = this.state;
const { paraBack } = this.state;
if (this._isMounted) {
this.setState(() => ({
paraBack: {
parallelAxis: parallelAxis,
data: paraYdata
}
}));
}
const { percent, swapAxisArr, paraBack } = this.state;
// need to cut down the data
if (percent !== 0) {
const linesNum = paraBack.data.length;
Expand All @@ -198,13 +207,7 @@ class Para extends React.Component<{}, ParaState> {
if (swapAxisArr.length >= 2) {
this.swapGraph(paraBack, swapAxisArr);
}
// draw search space graph
if (this._isMounted) {
this.setState({
option: this.getOption(paraBack)
});
}
// }
this.getOption(paraBack);
}
}
}));
Expand Down Expand Up @@ -297,7 +300,12 @@ class Para extends React.Component<{}, ParaState> {
});
}
}
return optionown;
// draw search space graph
if (this._isMounted) {
this.setState(() => ({
option: optionown
}));
}
}

// get swap parallel axis
Expand Down
1 change: 1 addition & 0 deletions src/webui/src/static/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface Experiment {
trainingServicePlatform: string;
tuner: object;
Copy link
Contributor

Choose a reason for hiding this comment

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

tuner is also optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but, 不影响我这边显示。

assessor?: object;
advisor?: object;
clusterMetaData?: object;
}

Expand Down