"test/ref/prelu.cpp" did not exist on "9473e3a2233df90c6fc8b6a6faedb59140171f33"
Commit 52b4478d authored by Lijiao's avatar Lijiao Committed by fishyds
Browse files

Fix bug of hyper graph and add down experiment parameters (#185)

* Fix bug of hyper graph and add down experiment parameters

* Show loguniform elegantly

* Change hyper graph color and numbers in bar show three decimal places
parent fd8ee22e
...@@ -124,15 +124,18 @@ class Para extends React.Component<{}, ParaState> { ...@@ -124,15 +124,18 @@ class Para extends React.Component<{}, ParaState> {
const searchRange = JSON.parse(res1.data.params.searchSpace); const searchRange = JSON.parse(res1.data.params.searchSpace);
for (let i = 0; i < dimName.length; i++) { for (let i = 0; i < dimName.length; i++) {
const searchKey = searchRange[dimName[i]]; const searchKey = searchRange[dimName[i]];
if (searchKey._type === 'uniform') { switch (searchKey._type) {
case 'uniform':
case 'quniform':
parallelAxis.push({ parallelAxis.push({
dim: i, dim: i,
name: dimName[i], name: dimName[i],
max: searchKey._value[1], max: searchKey._value[1],
min: searchKey._value[0] min: searchKey._value[0]
}); });
} else { // choice break;
// data number ['0.2', '0.4', '0.6']
case 'choice':
const data: Array<string> = []; const data: Array<string> = [];
for (let j = 0; j < searchKey._value.length; j++) { for (let j = 0; j < searchKey._value.length; j++) {
data.push(searchKey._value[j].toString()); data.push(searchKey._value[j].toString());
...@@ -143,6 +146,16 @@ class Para extends React.Component<{}, ParaState> { ...@@ -143,6 +146,16 @@ class Para extends React.Component<{}, ParaState> {
type: 'category', type: 'category',
data: data data: data
}); });
break;
case 'loguniform':
parallelAxis.push({
dim: i,
name: dimName[i]
});
break;
default:
} }
} }
// get data for every lines. if dim is choice type // get data for every lines. if dim is choice type
...@@ -226,14 +239,16 @@ class Para extends React.Component<{}, ParaState> { ...@@ -226,14 +239,16 @@ class Para extends React.Component<{}, ParaState> {
if (maxAccuracy === minAccuracy) { if (maxAccuracy === minAccuracy) {
visualMapObj = { visualMapObj = {
type: 'continuous', type: 'continuous',
color: ['#fb7c7c', 'yellow', 'lightblue'] precision: 3,
color: ['#CA0000', '#FFC400', '#90EE90']
}; };
} else { } else {
visualMapObj = { visualMapObj = {
type: 'continuous', type: 'continuous',
precision: 3,
min: visualValue.minAccuracy, min: visualValue.minAccuracy,
max: visualValue.maxAccuracy, max: visualValue.maxAccuracy,
color: ['#fb7c7c', 'yellow', 'lightblue'] color: ['#CA0000', '#FFC400', '#90EE90']
}; };
} }
let optionown = { let optionown = {
......
import * as React from 'react'; import * as React from 'react';
import axios from 'axios'; import axios from 'axios';
import { Table, Select, Row, Col, Icon } from 'antd'; import { Table, Select, Row, Col, Icon, Button } from 'antd';
import { MANAGER_IP, overviewItem } from '../const'; import { MANAGER_IP, overviewItem } from '../const';
const Option = Select.Option; const Option = Select.Option;
import JSONTree from 'react-json-tree'; import JSONTree from 'react-json-tree';
...@@ -120,10 +120,26 @@ class Sessionpro extends React.Component<{}, SessionState> { ...@@ -120,10 +120,26 @@ class Sessionpro extends React.Component<{}, SessionState> {
tuner: sessionData.params.tuner, tuner: sessionData.params.tuner,
assessor: sessionData.params.assessor assessor: sessionData.params.assessor
}); });
// search space format loguniform max and min
const searchSpace = JSON.parse(sessionData.params.searchSpace);
Object.keys(searchSpace).map(item => {
const key = searchSpace[item]._type;
if (key === 'loguniform') {
let value = searchSpace[item]._value;
const a = Math.pow(10, value[0]);
const b = Math.pow(10, value[1]);
if (a < b) {
value = [a, b];
} else {
value = [b, a];
}
searchSpace[item]._value = value;
}
});
if (this._isMounted) { if (this._isMounted) {
this.setState({ this.setState({
trialProfile: trialPro[0], trialProfile: trialPro[0],
searchSpace: JSON.parse(sessionData.params.searchSpace), searchSpace: searchSpace,
tunerAssessor: tunerAsstemp[0] tunerAssessor: tunerAsstemp[0]
}); });
} }
...@@ -211,6 +227,43 @@ class Sessionpro extends React.Component<{}, SessionState> { ...@@ -211,6 +227,43 @@ class Sessionpro extends React.Component<{}, SessionState> {
} }
} }
downExperimentContent = () => {
axios
.all([
axios.get(`${MANAGER_IP}/experiment`),
axios.get(`${MANAGER_IP}/trial-jobs`)
])
.then(axios.spread((res, res1) => {
if (res.status === 200 && res1.status === 200) {
if (res.data.params.searchSpace) {
res.data.params.searchSpace = JSON.parse(res.data.params.searchSpace);
}
const contentOfExperiment = JSON.stringify(res.data, null, 2);
let trialMessagesArr = res1.data;
Object.keys(trialMessagesArr).map(item => {
trialMessagesArr[item].hyperParameters = JSON.parse(trialMessagesArr[item].hyperParameters);
});
const trialMessages = JSON.stringify(trialMessagesArr, null, 2);
const aTag = document.createElement('a');
const file = new Blob([contentOfExperiment, trialMessages], { type: 'application/json' });
aTag.download = 'experiment.txt';
aTag.href = URL.createObjectURL(file);
aTag.click();
URL.revokeObjectURL(aTag.href);
if (navigator.userAgent.indexOf('Firefox') > -1) {
const downTag = document.createElement('a');
downTag.addEventListener('click', function () {
downTag.download = 'experiment.txt';
downTag.href = URL.createObjectURL(file);
});
let eventMouse = document.createEvent('MouseEvents');
eventMouse.initEvent('click', false, false);
downTag.dispatchEvent(eventMouse);
}
}
}));
}
componentDidMount() { componentDidMount() {
this.showSessionPro(); this.showSessionPro();
this.showTrials(); this.showTrials();
...@@ -433,6 +486,15 @@ class Sessionpro extends React.Component<{}, SessionState> { ...@@ -433,6 +486,15 @@ class Sessionpro extends React.Component<{}, SessionState> {
bordered={true} bordered={true}
/> />
</div> </div>
<div className="downExp">
<Button
type="primary"
className="tableButton"
onClick={this.downExperimentContent}
>
Down Experiment
</Button>
</div>
</div> </div>
); );
} }
......
...@@ -11,7 +11,7 @@ class SlideBar extends React.Component<{}, {}> { ...@@ -11,7 +11,7 @@ class SlideBar extends React.Component<{}, {}> {
<ul className="nav"> <ul className="nav">
<li> <li>
<IndexLink to={'/oview'} activeClassName="high"> <IndexLink to={'/oview'} activeClassName="high">
<Icon className="icon" type="rocket" />Overview <Icon className="icon" type="home" />Overview
<Icon className="floicon" type="right" /> <Icon className="floicon" type="right" />
</IndexLink> </IndexLink>
</li> </li>
......
...@@ -183,3 +183,7 @@ ...@@ -183,3 +183,7 @@
.experStatus{ .experStatus{
line-height: 12px; line-height: 12px;
} }
.downExp{
width: 154px;
margin: 0 auto;
}
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