Browse Source

UI add tip of irrelevant measurrement method

tags/v1.1.0
xiayifan 5 years ago
parent
commit
9dd3e3bd2d
4 changed files with 80 additions and 14 deletions
  1. +45
    -11
      mindinsight/ui/src/components/select-group.vue
  2. +3
    -1
      mindinsight/ui/src/locales/en-us.json
  3. +3
    -1
      mindinsight/ui/src/locales/zh-cn.json
  4. +29
    -1
      mindinsight/ui/src/views/explain/xai-metric.vue

+ 45
- 11
mindinsight/ui/src/components/select-group.vue View File

@@ -18,24 +18,41 @@ limitations under the License.
<!-- Title --> <!-- Title -->
<div class="checkboxes-title left" <div class="checkboxes-title left"
v-if="typeof title !== 'undefined'"> v-if="typeof title !== 'undefined'">
{{title}}
{{ title }}
</div> </div>
<!-- Group --> <!-- Group -->
<div class="right"> <div class="right">
<el-tooltip v-for="checkbox in checkboxes" <el-tooltip v-for="checkbox in checkboxes"
:key="checkbox.label" :key="checkbox.label"
effect="dark" effect="dark"
:content="checkbox.label"
:content="
checkbox.label + (typeof checkbox.title === 'string' && checkbox.title !== ''
? ($t('symbols.comma') + checkbox.title)
: '')
"
placement="top"> placement="top">
<div class="checkboxes-item item"
@click="checkedChange(checkbox)">
<div class="checkbox"
:class="{'is-checked': checkbox.checked, 'is-unchecked': !checkbox.checked}">
<template v-if="typeof checkbox.disabled === 'boolean' && checkbox.disabled">
<div class="checkboxes-item item item-disabled">
<div class="checkbox is-disabled"></div>
<div class="label label-disabled">
{{ checkbox.label }}
</div>
</div> </div>
<div class="label">
{{checkbox.label}}
</template>
<template v-else>
<div class="checkboxes-item item"
@click="checkedChange(checkbox)">
<div class="checkbox"
:class="{
'is-checked': checkbox.checked,
'is-unchecked': !checkbox.checked,
}"></div>
<div class="label"
:title="typeof checkbox.title === 'string' ? checkbox.title : ''">
{{ checkbox.label }}
</div>
</div> </div>
</div>
</template>
</el-tooltip> </el-tooltip>
<!-- Slot --> <!-- Slot -->
<div class="checkboxes-last item"> <div class="checkboxes-last item">
@@ -48,8 +65,15 @@ limitations under the License.
<script> <script>
export default { export default {
props: { props: {
// Array<Checkbox>
// Class Checkbox {checked: boolean, label: string}
/** The structure of checkboxes should be Array<Checkbox>
* The structure of Checkbox should as follow
* Class Checkbox {
* checked: boolean,
* label: string,
* title?: string,
* disabled?: Boolean,
* }
*/
checkboxes: Array, checkboxes: Array,
title: String, // The title of group title: String, // The title of group
}, },
@@ -135,12 +159,19 @@ export default {
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
} }
.label-disabled {
color: #c0c4cc;
}
.is-checked { .is-checked {
background-image: url('../assets/images/mult-select.png'); background-image: url('../assets/images/mult-select.png');
} }
.is-unchecked { .is-unchecked {
background-image: url('../assets/images/mult-unselect.png'); background-image: url('../assets/images/mult-unselect.png');
} }
.is-disabled {
border: 1px solid #dbdbdb;
background-color: #e7e7e7;
}
} }
} }
.item { .item {
@@ -148,6 +179,9 @@ export default {
margin-right: 20px; margin-right: 20px;
height: 32px; height: 32px;
} }
.item-disabled {
cursor: not-allowed !important;
}
.checkboxes-last { .checkboxes-last {
display: flex; display: flex;
align-items: center; align-items: center;


+ 3
- 1
mindinsight/ui/src/locales/en-us.json View File

@@ -30,7 +30,8 @@
"point": "·", "point": "·",
"slashes": "/", "slashes": "/",
"colon": ":", "colon": ":",
"fullStop": "."
"fullStop": ".",
"comma": ","
}, },
"header": { "header": {
"refreshData": "Refresh Data", "refreshData": "Refresh Data",
@@ -767,6 +768,7 @@
"multiMethod": "Single indicator and multiple methods", "multiMethod": "Single indicator and multiple methods",
"interpretation": "Explanation", "interpretation": "Explanation",
"measurement": "Measurement", "measurement": "Measurement",
"disableMetricTip": "The result of this measurement method is irrelevant to the tag, the classification assessment result cannot be viewed.",
"seeInterpretation": "You are viewing scores of the explanation method ", "seeInterpretation": "You are viewing scores of the explanation method ",
"seeMeasurement": "You are viewing scores of the measurement method ", "seeMeasurement": "You are viewing scores of the measurement method ",
"showGrade": " of different tag types", "showGrade": " of different tag types",


+ 3
- 1
mindinsight/ui/src/locales/zh-cn.json View File

@@ -30,7 +30,8 @@
"point": "·", "point": "·",
"slashes": "/", "slashes": "/",
"colon": ":", "colon": ":",
"fullStop": "。"
"fullStop": "。",
"comma": ","
}, },
"header": { "header": {
"refreshData": "刷新数据", "refreshData": "刷新数据",
@@ -762,6 +763,7 @@
"multiMethod": "单指标多方法", "multiMethod": "单指标多方法",
"interpretation": "解释方法", "interpretation": "解释方法",
"measurement": "度量方法", "measurement": "度量方法",
"disableMetricTip": "该度量方法的结果与标签无关,不支持查看分类评估结果",
"seeInterpretation": "您正在查看解释方法 ", "seeInterpretation": "您正在查看解释方法 ",
"seeMeasurement": "您正在查看度量方法 ", "seeMeasurement": "您正在查看度量方法 ",
"showGrade": " 在不同标签类型上的分数", "showGrade": " 在不同标签类型上的分数",


+ 29
- 1
mindinsight/ui/src/views/explain/xai-metric.vue View File

@@ -194,7 +194,9 @@ limitations under the License.
<el-option v-for="(item, index) in classifyAllMetrics" <el-option v-for="(item, index) in classifyAllMetrics"
:key="index" :key="index"
:value="item.label" :value="item.label"
:label="item.label"></el-option>
:label="item.label"
:disabled="item.disabled"
:title="item.title"></el-option>
</el-select> </el-select>
</span> </span>
</div> </div>
@@ -581,6 +583,7 @@ export default {
const metricsDic = {}; const metricsDic = {};
const labelDic = {}; const labelDic = {};
const allLabels = []; const allLabels = [];
const compareMetric = {};
// Simplify data to dictionary // Simplify data to dictionary
oriData.explainer_scores.forEach((explainerScore) => { oriData.explainer_scores.forEach((explainerScore) => {
const curMethod = explainerScore.explainer; const curMethod = explainerScore.explainer;
@@ -588,6 +591,8 @@ export default {
classifyAllMethods.push({ classifyAllMethods.push({
label: curMethod, label: curMethod,
checked: true, checked: true,
disabled: false,
title: '',
}); });
fullDataDict[curMethod] = {}; fullDataDict[curMethod] = {};
explainerScore.class_scores.forEach((classScore) => { explainerScore.class_scores.forEach((classScore) => {
@@ -606,13 +611,31 @@ export default {
classifyAllMetrics.push({ classifyAllMetrics.push({
label: evaluation.metric, label: evaluation.metric,
checked: true, checked: true,
disabled: false,
title: '',
}); });
} }
}); });
} }
}); });
explainerScore.evaluations.forEach((evaluation) => {
compareMetric[evaluation.metric] = true;
});
}
});

const compareArr = Object.keys(compareMetric);
compareArr.forEach((metricName) => {
if (!metricsDic[metricName]) {
classifyAllMetrics.push({
label: metricName,
checked: false,
disabled: true,
title: this.$t('metric.disableMetricTip'),
});
} }
}); });

this.fullDict = fullDataDict; this.fullDict = fullDataDict;
this.classifyAllMethods = classifyAllMethods; this.classifyAllMethods = classifyAllMethods;
this.classifyAllMetrics = classifyAllMetrics; this.classifyAllMetrics = classifyAllMetrics;
@@ -864,6 +887,11 @@ export default {
flex-shrink: 0; flex-shrink: 0;
border: 1px solid #e6ebf5; border: 1px solid #e6ebf5;
margin-left: 20px; margin-left: 20px;
overflow-y: auto;
overflow-x: hidden;
&::-webkit-scrollbar {
width: 0;
}
} }
} }




Loading…
Cancel
Save