StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
StackGenVis/frontend/src/components/AlgorithmHyperParam.vue

103 lines
3.4 KiB

6 years ago
<template>
6 years ago
<div id="PCP" class="parcoords" style="height:200px"></div>
6 years ago
</template>
<script>
import 'parcoord-es/dist/parcoords.css';
import ParCoords from 'parcoord-es';
import * as d3Base from 'd3'
// attach all d3 plugins to the d3 library
const d3 = Object.assign(d3Base)
import { EventBus } from '../main.js'
export default {
name: 'AlgorithmHyperParam',
data () {
return {
ModelsPerformance: 0,
selAlgorithm: 0,
pc: 0
}
},
methods: {
PCPView () {
6 years ago
d3.selectAll("#PCP > *").remove();
if (this.selAlgorithm != '') {
6 years ago
var colors = ['#8dd3c7','#ffffb3','#bebada','#fb8072','#80b1d3','#fdb462','#b3de69','#fccde5','#d9d9d9','#bc80bd','#ccebc5','#ffed6f']
6 years ago
var colorGiv = 0
var Combined = 0
if (this.selAlgorithm == 'KNN') {
Combined = JSON.parse(this.ModelsPerformance[0])
colorGiv = colors[0]
} else {
Combined = JSON.parse(this.ModelsPerformance[1])
colorGiv = colors[1]
}
var valuesPerf = Object.values(Combined['mean_test_score'])
var ObjectsParams = Combined['params']
6 years ago
var newObjectsParams = []
6 years ago
var ArrayCombined = new Array(valuesPerf.length)
for (let i = 0; i < valuesPerf.length; i++) {
6 years ago
if (this.selAlgorithm == 'KNN') {
newObjectsParams.push({'weights':ObjectsParams[i].weights, 'algorithm':ObjectsParams[i].algorithm,'metric':ObjectsParams[i].metric,'n_neighbors':ObjectsParams[i].n_neighbors})
Object.assign(newObjectsParams[i], {performance: valuesPerf[i]}, {model: i})
ArrayCombined[i] = newObjectsParams[i]
} else {
6 years ago
Object.assign(ObjectsParams[i], {performance: valuesPerf[i]}, {model: i})
ArrayCombined[i] = ObjectsParams[i]
6 years ago
}
6 years ago
}
EventBus.$emit('AllAlModels', ArrayCombined.length)
6 years ago
this.pc = ParCoords()("#PCP")
.data(ArrayCombined)
.color(colorGiv)
6 years ago
.hideAxis(['model','performance'])
6 years ago
.bundlingStrength(0) // set bundling strength
.smoothness(0)
.showControlPoints(false)
.render()
.brushMode('1D-axes')
6 years ago
.reorderable()
6 years ago
.interactive();
this.pc.on("brush", function(d) {
EventBus.$emit('AllSelModels', d.length)
6 years ago
EventBus.$emit('UpdateBoxPlot', d)
});
6 years ago
}
6 years ago
},
sliders () {
6 years ago
},
brushed () {
if (this.pc.brushed()) {
EventBus.$emit('ReturningBrushedPoints', this.pc.brushed())
6 years ago
} else {
EventBus.$emit('ReturningBrushedPoints', this.pc.data())
6 years ago
}
},
clear () {
d3.selectAll("#PCP > *").remove();
6 years ago
},
None () {
document.getElementById('PCP').style.cssText='display:none';
},
Reveal () {
document.getElementById('PCP').style.cssText='height:200px;display:""';
6 years ago
}
},
mounted() {
EventBus.$on('emittedEventCallingModelBrushed', this.brushed)
EventBus.$on('emittedEventCallingModelSelect', data => { this.selAlgorithm = data })
EventBus.$on('emittedEventCallingModel', data => { this.ModelsPerformance = data })
EventBus.$on('emittedEventCallingModel', this.PCPView)
6 years ago
EventBus.$on('ResponsiveandChange', this.PCPView)
6 years ago
EventBus.$on('emittedEventCallingModelClear', this.clear)
6 years ago
EventBus.$on('slidersOn', this.None)
EventBus.$on('PCPCall', this.Reveal)
6 years ago
}
}
</script>