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

141 lines
8.0 KiB

6 years ago
<template>
5 years ago
<div id="PCP" class="parcoords" style="min-height: 307px;"></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,
6 years ago
pc: 0,
5 years ago
factors: [1,1,1,0,0
,1,0,0,1,0
,0,1,0,0,0
,0,0,1,0,0
,0,1,1,1
],
6 years ago
KNNModels: 576 //KNN models
6 years ago
}
},
methods: {
5 years ago
reset () {
d3.selectAll("#PCP > *").remove();
},
6 years ago
PCPView () {
6 years ago
d3.selectAll("#PCP > *").remove();
if (this.selAlgorithm != '') {
5 years ago
var colors = ['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928']
6 years ago
var colorGiv = 0
5 years ago
var factorsLocal = this.factors
var divide = 0
factorsLocal.forEach(element => {
divide = element + divide
});
var Mc1 = []
const performanceAlg1 = JSON.parse(this.ModelsPerformance[6])
5 years ago
5 years ago
for (let j = 0; j < Object.values(performanceAlg1['mean_test_accuracy']).length; j++) {
let sum
5 years ago
sum = (factorsLocal[0] * Object.values(performanceAlg1['mean_test_accuracy'])[j]) + (factorsLocal[1] * (Object.values(performanceAlg1['mean_test_neg_mean_absolute_error'])[j]) + 1) + (factorsLocal[2] * (Object.values(performanceAlg1['mean_test_neg_root_mean_squared_error'])[j]) + 1) + (factorsLocal[3] * Object.values(performanceAlg1['geometric_mean_score_micro'])[j]) + (factorsLocal[4] * Object.values(performanceAlg1['geometric_mean_score_macro'])[j])
+ (factorsLocal[5] * Object.values(performanceAlg1['geometric_mean_score_weighted'])[j]) + (factorsLocal[6] * Object.values(performanceAlg1['mean_test_precision_micro'])[j]) + (factorsLocal[7] * Object.values(performanceAlg1['mean_test_precision_macro'])[j]) + (factorsLocal[8] * Object.values(performanceAlg1['mean_test_precision_weighted'])[j]) + (factorsLocal[9] * Object.values(performanceAlg1['mean_test_recall_micro'])[j])
+ (factorsLocal[10] * Object.values(performanceAlg1['mean_test_recall_macro'])[j]) + (factorsLocal[11] * Object.values(performanceAlg1['mean_test_recall_weighted'])[j]) + (factorsLocal[12] * Object.values(performanceAlg1['f5_micro'])[j]) + (factorsLocal[13] * Object.values(performanceAlg1['f5_macro'])[j]) + (factorsLocal[14] * Object.values(performanceAlg1['f5_weighted'])[j]) + (factorsLocal[15] * Object.values(performanceAlg1['f1_micro'])[j])
+ (factorsLocal[16] * Object.values(performanceAlg1['f1_macro'])[j]) + (factorsLocal[17] * Object.values(performanceAlg1['f1_weighted'])[j]) + (factorsLocal[18] * Object.values(performanceAlg1['f2_micro'])[j]) + (factorsLocal[19] * Object.values(performanceAlg1['f2_macro'])[j]) + (factorsLocal[20] * Object.values(performanceAlg1['f2_weighted'])[j]) + (factorsLocal[21] * Object.values(performanceAlg1['matthews_corrcoef'])[j])
5 years ago
+ (factorsLocal[22] * Object.values(performanceAlg1['mean_test_roc_auc_ovo_weighted'])[j]) + (factorsLocal[23] * (1 - Object.values(performanceAlg1['log_loss'])[j]))
5 years ago
Mc1.push((sum/divide)*100)
}
var Mc2 = []
const performanceAlg2 = JSON.parse(this.ModelsPerformance[14])
for (let j = 0; j < Object.values(performanceAlg2['mean_test_accuracy']).length; j++) {
let sum2
5 years ago
sum2 = (factorsLocal[0] * Object.values(performanceAlg2['mean_test_accuracy'])[j]) + (factorsLocal[1] * (Object.values(performanceAlg2['mean_test_neg_mean_absolute_error'])[j]) + 1) + (factorsLocal[2] * (Object.values(performanceAlg2['mean_test_neg_root_mean_squared_error'])[j]) + 1) + (factorsLocal[3] * Object.values(performanceAlg2['geometric_mean_score_micro'])[j]) + (factorsLocal[4] * Object.values(performanceAlg2['geometric_mean_score_macro'])[j])
+ (factorsLocal[5] * Object.values(performanceAlg2['geometric_mean_score_weighted'])[j]) + (factorsLocal[6] * Object.values(performanceAlg2['mean_test_precision_micro'])[j]) + (factorsLocal[7] * Object.values(performanceAlg2['mean_test_precision_macro'])[j]) + (factorsLocal[8] * Object.values(performanceAlg2['mean_test_precision_weighted'])[j]) + (factorsLocal[9] * Object.values(performanceAlg2['mean_test_recall_micro'])[j])
+ (factorsLocal[10] * Object.values(performanceAlg2['mean_test_recall_macro'])[j]) + (factorsLocal[11] * Object.values(performanceAlg2['mean_test_recall_weighted'])[j]) + (factorsLocal[12] * Object.values(performanceAlg2['f5_micro'])[j]) + (factorsLocal[13] * Object.values(performanceAlg2['f5_macro'])[j]) + (factorsLocal[14] * Object.values(performanceAlg2['f5_weighted'])[j]) + (factorsLocal[15] * Object.values(performanceAlg2['f1_micro'])[j])
+ (factorsLocal[16] * Object.values(performanceAlg2['f1_macro'])[j]) + (factorsLocal[17] * Object.values(performanceAlg2['f1_weighted'])[j]) + (factorsLocal[18] * Object.values(performanceAlg2['f2_micro'])[j]) + (factorsLocal[19] * Object.values(performanceAlg2['f2_macro'])[j]) + (factorsLocal[20] * Object.values(performanceAlg2['f2_weighted'])[j]) + (factorsLocal[21] * Object.values(performanceAlg2['matthews_corrcoef'])[j])
5 years ago
+ (factorsLocal[22] * Object.values(performanceAlg2['mean_test_roc_auc_ovo_weighted'])[j]) + (factorsLocal[23] * (1 - Object.values(performanceAlg2['log_loss'])[j]))
5 years ago
Mc2.push((sum2/divide)*100)
}
6 years ago
var Combined = 0
if (this.selAlgorithm == 'KNN') {
6 years ago
Combined = JSON.parse(this.ModelsPerformance[1])
6 years ago
colorGiv = colors[0]
} else {
6 years ago
Combined = JSON.parse(this.ModelsPerformance[9])
6 years ago
colorGiv = colors[1]
}
5 years ago
var valuesPerf = Object.values(Combined['params'])
6 years ago
var ObjectsParams = Combined['params']
6 years ago
var newObjectsParams = []
6 years ago
var newObjectsParams2 = []
6 years ago
var ArrayCombined = []
var temp
for (var i = 0; i < valuesPerf.length; i++) {
if (this.selAlgorithm === 'KNN') {
// There is a problem here!
5 years ago
newObjectsParams.push({model: i,'performance (%)': Mc1[i],'n_neighbors':ObjectsParams[i].n_neighbors,'metric':ObjectsParams[i].metric,'algorithm':ObjectsParams[i].algorithm,'weights':ObjectsParams[i].weights})
6 years ago
ArrayCombined[i] = newObjectsParams[i]
} else {
5 years ago
newObjectsParams2.push({model: this.KNNModels + i,'performance (%)': Mc2[i],'n_estimators':ObjectsParams[i].n_estimators,'criterion':ObjectsParams[i].criterion})
6 years ago
ArrayCombined[i] = newObjectsParams2[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'])
6 years ago
.bundlingStrength(0) // set bundling strength
.smoothness(0)
.showControlPoints(false)
.render()
.brushMode('1D-axes')
6 years ago
.reorderable()
6 years ago
.interactive();
6 years ago
this.pc.on("brushend", function(d) {
EventBus.$emit('AllSelModels', d.length)
6 years ago
EventBus.$emit('UpdateBoxPlot', d)
});
6 years ago
}
6 years ago
},
sliders () {
6 years ago
},
6 years ago
6 years ago
clear () {
d3.selectAll("#PCP > *").remove();
6 years ago
},
6 years ago
},
mounted() {
6 years ago
EventBus.$on('ReturningBrushedPointsModels', this.brushed)
6 years ago
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)
5 years ago
5 years ago
EventBus.$on('CallFactorsView', data => { this.factors = data })
EventBus.$on('CallFactorsView', this.PCPView)
5 years ago
// reset view
EventBus.$on('resetViews', this.reset)
5 years ago
EventBus.$on('clearPCP', this.reset)
6 years ago
}
}
</script>