parent 60212d21d3
commit efa69bb9f7
  1. BIN
      __pycache__/run.cpython-38.pyc
  2. 17
      frontend/src/components/FeatureSpaceDetail.vue
  3. 8
      frontend/src/components/FeatureSpaceOverview.vue
  4. 73
      frontend/src/components/Heatmap.vue
  5. 38
      frontend/src/components/Main.vue
  6. 442
      frontend/src/components/Results.vue
  7. 39
      run.py

Binary file not shown.

@ -1,7 +1,7 @@
<template>
<div class="column">
<div id="FeatureGraph" style="border-style: solid; border-width: 2px; border-color: yellow; min-height: 504px; max-height: 504px; min-width: 1230px"></div>
<div id="toolbar" style="min-height: 67px; max-height: 67px; margin-top: 20px">
<div id="FeatureGraph" style="border-style: solid; border-width: 2px; border-color: yellow; min-height: 819px; max-height: 819px; min-width: 819px"></div>
<div id="toolbar" style="min-height: 67px; max-height: 67px; margin-top: 25px">
<div class="panel panel-default" data-placement="center">
<div class="panel-body" id="resetAllFilters" data-placement="center" style="margin-top: 3px">
<table class="table table-borderless centerTable" >
@ -10,7 +10,7 @@
<td scope="row"><button class="btn btn-primary active" id="initButton" v-on:click="setLayerExplore" style="margin-left: -1px !important" ><font-awesome-icon icon="search" style="margin-right: 5px"/>Feature exploration</button></td>
<td><button class="btn btn-primary" v-on:click="setLayerCompare" style="margin-left: -1.4px"><font-awesome-icon icon="balance-scale-left" style="margin-right: 5px" />Feature generation</button></td>
<td scope="row"><button class="btn btn-primary" v-on:click="setLayerEngineer" style="margin-left: -2px !important"><font-awesome-icon icon="wrench" style="margin-right: 5px" />Feature transformation</button></td>
<td scope="row"><p style="margin-left: -2px !important; color: #007bff;">Warning: pick between 2 to 3 features for detailed comparison of features.</p></td>
<!--<td scope="row"><p style="margin-left: -2px !important; color: #007bff;">Warning: pick between 2 to 3 features for detailed comparison of features.</p></td>-->
</tr>
</tbody>
</table>
@ -432,12 +432,12 @@ export default {
var colorsScaleNodes = d3.scaleOrdinal()
.domain(d3.ticks([MIMin, MIMax, 5]))
.range(['#6baed6','#4292c6','#2171b5','#08519c','#08306b']);
var svg = d3.select("#FeatureGraph");
svg.selectAll("*").remove();
var width = 1230;
var height = 504;
var width = 819;
var height = 819;
var numTicks = 200;
@ -909,4 +909,9 @@ table td {
cursor: pointer;
}
.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto {
padding-right: 6px !important;
padding-left: 6px !important;
}
</style>

@ -1,6 +1,6 @@
<template>
<div>
<div id="tree-container" style="min-height: 500px"></div>
<div id="tree-container" style="min-height: 820px"></div>
<div id="toolbar">
<div class="tool">
<div class="tlabel">Zoom</div>
@ -196,13 +196,13 @@ export default {
var curPath; // array of nodes in the path to the currently selected node
// size of the diagram
var width = 1250;
var height = 500;
var width = 820;
var height = 820;
// current pan, zoom, and rotation
var curX = width / 2;
var curY = height / 2;
var curZ = 1.25; // current zoom
var curZ = 1.14; // current zoom
var curR = 270; // current rotation
// keyboard key codes

@ -1,7 +1,7 @@
<template>
<div>
<div id="Heatmap"></div>
<div id="LegendHeat" style="margin-left: 280px"></div>
<div id="LegendHeat"></div>
</div>
</template>
@ -24,7 +24,7 @@ export default {
limitation: 0,
flag: false,
classesNumber: 10,
cellSize: 20,
cellSize: 16,
ModelsIDHeatStack: [],
highlighted: [],
responsiveWidthHeight: [],
@ -80,44 +80,43 @@ export default {
var FeaturesAccuracy = JSON.parse(this.dataFI[2])
var Features = this.featureData[0]
var len2 = Features.length
let arr = Object.values(featureUni.Score);
let minUni = Math.min(...arr);
let maxUni = Math.max(...arr);
let len = algorithms.length
let len = Features.length
let indicesYAxis = []
for (let i = 0; i < len+1; i++) {
indicesYAxis[i] = [algorithms[i]]
for (let i = 0; i < len; i++) {
indicesYAxis[i] = [Features[i]]
}
let indicesXAxis = []
var temp = []
var len2 = algorithms.length
for (let i = 0; i < len2; i++) {
temp = []
temp.push("R")
var loop = i+1
temp.push(Features[i].toString()+" (F"+loop+")")
temp.push(algorithms[i].toString())
indicesXAxis[i] = temp
}
var values = []
var modelData = []
for (let j = 0; j < len2; j++) {
for (let j = 0; j <len2; j++) {
var data = []
for (let i = 0; i <len; i++) {
if (algorithms[i] == "Univariate FS") {
values[i] = ((Object.values(featureUni.Score)[j]-minUni)/(maxUni-minUni))
} else if (algorithms[i] == "Permutation FI") {
values[i] = PermImpEli[j][0]
} else if (algorithms[i] == "Accuracy-based FI") {
values[i] = FeaturesAccuracy[j][0]
} else if (algorithms[i] == "Average") {
values[i] = ((((Object.values(featureUni.Score)[j]-minUni)/(maxUni-minUni)))+(PermImpEli[j][0])+(FeaturesAccuracy[j][0]))/(len-2)
for (let i = 0; i < len; i++) {
if (algorithms[j] == "Univariate FS") {
values[j] = ((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni))
} else if (algorithms[j] == "Permutation FI") {
values[j] = PermImpEli[i][0]
} else if (algorithms[j] == "Accuracy-based FI") {
values[j] = FeaturesAccuracy[i][0]
} else if (algorithms[j] == "Average") {
values[j] = ((((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni)))+(PermImpEli[i][0])+(FeaturesAccuracy[i][0]))/(len-2)
} else {
values[i] = -2
values[j] = -2
}
data.push(values[i])
data.push(values[j])
}
modelData.push(data)
}
@ -159,16 +158,14 @@ export default {
//==================================================
var viewerHeight = 820
var widthHeatmap = 392
var viewerWidth = 1225
var viewerHeight = 180
var widthHeatmap = 1225
var viewerPosTop = viewerHeight * 0.05;
var viewerPosTopHeat = viewerHeight * 0.42;
var viewerPosLeft = viewerWidth*0.1;
var viewerPosTop = 70;
var viewerPosTopHeat = 110;
var viewerPosLeft = 100;
var legendElementWidth = cellSize * 3;
var legendElementWidth = cellSize * 2.5;
// http://bl.ocks.org/mbostock/5577023
var colors = colorbrewer.RdYlGn[this.classesNumber];
@ -186,7 +183,7 @@ export default {
.range(colors);
svg = d3.select(heatmapId).append("svg")
.attr("width", viewerWidth)
.attr("width", widthHeatmap)
.attr("height", viewerHeight)
.call(zoom)
//.call(zoom.transform, d3.zoomIdentity.translate(200, 20).scale(0.25)) //initial size
@ -290,8 +287,8 @@ export default {
return d.idx;
})
.attr("class", "row");
svg.append("text").attr("x", 15).attr("y", -60).text("Feature").style("font-size", "16px").attr("alignment-baseline","top")
svg.append("text").attr("transform", "rotate(-90)").attr("x", -52).attr("y", -90).style("text-anchor", "middle").style("font-size", "16px").text("Technique"); // -130 before for HeartC
svg.append("text").attr("x", 10).attr("y", -65).text("Technique").style("font-size", "16px").attr("alignment-baseline","top")
svg.append("text").attr("transform", "rotate(-90)").attr("x", -33).attr("y", -50).style("text-anchor", "middle").style("font-size", "16px").text("Feature"); // -130 before for HeartC
var heatMap = row.selectAll(".cell")
.data(function(d) {
return d;
@ -343,7 +340,7 @@ export default {
if (d3.select(this).style("fill") === "yellow" || d3.select(this).style("fill") === "url(\"#diagonalHatch\")") {
if (d3.select(this).style("fill") === "url(\"#diagonalHatch\")"){
if (d == -2) {
const index = featuresAddRem.indexOf(i);
const index = featuresAddRem.indexOf(k);
if (index > -1) {
featuresAddRem.splice(index, 1);
}
@ -353,7 +350,7 @@ export default {
return colorScale(d)
}
} else {
featuresAddRem.push(i)
featuresAddRem.push(k)
EventBus.$emit('removeFeatures', featuresAddRem)
return "url(#diagonalHatch)"
}
@ -368,7 +365,7 @@ export default {
var svgLeg = d3.select("#LegendHeat").append("svg")
.attr("width", widthHeatmap)
.attr("height", viewerHeight*0.3)
.attr("height", viewerHeight*0.12)
var legend = svgLeg.append('g')
.attr("class", "legend")
@ -400,7 +397,7 @@ export default {
})
.attr("y", viewerPosTop + cellSize);
svgLeg.append("text").attr("x", 200).attr("y", 50).text("Normalized feature importance (FI)").style("font-size", "16px").attr("alignment-baseline","top")
svgLeg.append("text").attr("x", 75).attr("y", 55).text("Normalized feature importance (FI)").style("font-size", "16px").attr("alignment-baseline","top")
//==================================================
// Change ordering of cells
@ -567,7 +564,7 @@ export default {
<style>
.heatmap {
font-size: 8px;
font-size: 9px;
font-family: monospace;
}
rect.bordered {
@ -575,7 +572,7 @@ rect.bordered {
stroke-width:2px;
}
text.mono {
font-size: 8px;
font-size: 9px;
font-family: monospace;
fill: #000;
}

@ -17,52 +17,50 @@
</b-col>
</b-row>
<b-row class="md-3">
<b-col cols="6">
<b-col>
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Feature Selection (FS) Techniques
</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 920px">
<Heatmap/>
</mdb-card-text>
</mdb-card-body>
</mdb-card>
</b-col>
<b-col cols="4">
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Feature Space Overview
</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 600px">
<mdb-card-text class="text-center" style="min-height: 920px">
<FeatureSpaceOverview/>
</mdb-card-text>
</mdb-card-body>
</mdb-card>
</b-col>
<b-col cols="6">
<b-col cols="4">
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Feature Space Detail
</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 600px">
<mdb-card-text class="text-center" style="min-height: 920px">
<FeatureSpaceDetail/>
</mdb-card-text>
</mdb-card-body>
</mdb-card>
</b-col>
</b-row>
<b-row class="md-3">
<b-col cols="6">
<b-col cols="2">
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Final Predictive Results
<mdb-card-header color="primary-color" tag="h5" class="text-center">Process Tracker and Predictive Results
</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 234px">
<mdb-card-text class="text-center" style="min-height: 920px">
<Results/>
</mdb-card-text>
</mdb-card-body>
</mdb-card>
</b-col>
<b-col cols="6">
<mdb-card style="margin-top: 15px;">
<mdb-card-header color="primary-color" tag="h5" class="text-center">Feature Selection (FS) Techniques
</mdb-card-header>
<mdb-card-body>
<mdb-card-text class="text-center" style="min-height: 234px">
<Heatmap/>
</mdb-card-text>
</mdb-card-body>
</mdb-card>
</b-col>
</b-row>
</b-container>
</body>

@ -1,5 +1,8 @@
<template>
<div>
<div id="HistoryPlot"></div>
<div id="LinePlot"></div>
</div>
</template>
<script>
@ -11,148 +14,333 @@ export default {
name: 'Results',
data () {
return {
dataInstances: '',
NumberofExecutions: 0,
PositiveValue: 75,
NegativeValue: 25,
ValidResultsVar: [],
globalStep: 0,
featuresReceived: [],
scoresMean: [],
scoresSTD: [],
scoresPositive: [],
scoresNegative: [],
scoresMean2: [],
scoresSTD2: [],
scoresPositive2: [],
scoresNegative2: [],
scoresMean3: [],
scoresSTD3: [],
scoresPositive3: [],
scoresNegative3: [],
scoresMeanBest: [],
scoresSTDBest: [],
xaxis: [],
valuesGlobal: [1, 0, 0, 0], // initial
previousState: [],
flag: true
}
},
methods: {
initializeLinePLot () {
this.NumberofExecutions ++
this.xaxis.push(this.NumberofExecutions)
HistoryPun() {
var state = this.globalStep + 1
var svg = d3.select("#HistoryPlot");
svg.selectAll("*").remove();
// Under Exploration = Current
this.scoresMean.push((JSON.parse(this.ValidResultsVar[0])*100).toFixed(2))
this.scoresSTD.push((JSON.parse(this.ValidResultsVar[1])*100).toFixed(2))
var margin = {top: 0, right: 0, bottom: 0, left: 0}
var width = 390 - margin.left - margin.right
var height = 570 - margin.top - margin.bottom
var padding = 3
var xLabelHeight = 30
var yLabelWidth = 80
var borderWidth = 2
var duration = 50
this.scoresPositive.push(parseFloat(this.scoresMean[this.scoresMean.length - 1]) + parseFloat(this.scoresSTD[this.scoresSTD.length - 1]))
this.scoresNegative.push(parseFloat(this.scoresMean[this.scoresMean.length - 1]) - parseFloat(this.scoresSTD[this.scoresSTD.length - 1]))
var chart = d3.select('#HistoryPlot').append('svg')
.attr('width', width + margin.left + margin.right)
.attr('height', height + margin.top + margin.bottom)
.append('g')
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
this.scoresMean2.push((JSON.parse(this.ValidResultsVar[2])*100).toFixed(2))
this.scoresSTD2.push((JSON.parse(this.ValidResultsVar[3])*100).toFixed(2))
var border = chart.append('rect')
.attr('x', yLabelWidth)
.attr('y', xLabelHeight)
.style('fill-opacity', 0)
.style('stroke', '#000')
.style('stroke-width', borderWidth)
.style('shape-rendering', 'crispEdges')
this.scoresPositive2.push(parseFloat(this.scoresMean2[this.scoresMean2.length - 1]) + parseFloat(this.scoresSTD2[this.scoresSTD2.length - 1]))
this.scoresNegative2.push(parseFloat(this.scoresMean2[this.scoresMean2.length - 1]) - parseFloat(this.scoresSTD2[this.scoresSTD2.length - 1]))
var color = JSON.parse(this.ValidResultsVar[12])
this.scoresMean3.push((JSON.parse(this.ValidResultsVar[4])*100).toFixed(2))
this.scoresSTD3.push((JSON.parse(this.ValidResultsVar[5])*100).toFixed(2))
var data = []
var features = this.featuresReceived[0]
var labelsX = ['Add', 'Remove', 'Combine', 'Round']
for (let i=0; i< features.length; i++) {
data.push({
label: features[i],
values: this.valuesGlobal
})
}
this.scoresPositive3.push(parseFloat(this.scoresMean3[this.scoresMean3.length - 1]) + parseFloat(this.scoresSTD3[this.scoresSTD3.length - 1]))
this.scoresNegative3.push(parseFloat(this.scoresMean3[this.scoresMean3.length - 1]) - parseFloat(this.scoresSTD3[this.scoresSTD3.length - 1]))
var allValues = Array.prototype.concat.apply([], data.map(function(d) { return d.values }))
var maxWidth = d3.max(data.map(function(d) { return d.values.length }))
var maxR = d3.min([(width - yLabelWidth) / maxWidth, (height - xLabelHeight) / data.length]) / 2
var xaxisReversed = []
xaxisReversed = this.xaxis.slice().reverse()
xaxisReversed = this.xaxis.concat(xaxisReversed)
var r = function(d) {
// fill in 'text' array for hover
var text = this.scoresSTD.map (function(value, i) {
return `STD: +/-${value}`
})
var f = d3.scale.sqrt()
.domain([d3.min(allValues), d3.max(allValues)])
.rangeRound([0, maxR - padding])
var trace1 = {
x: this.xaxis,
y: this.scoresMean,
text: text,
line: {color: "rgb(139,69,19)"},
mode: "lines+markers",
marker : {
symbol: 'circle' },
name: "Accuracy",
type: "scatter"
return f(d)
}
var trace2 = {
x: xaxisReversed,
y: this.scoresPositive.concat(this.scoresNegative),
text: '',
hoverinfo: 'text',
fill: "tozerox",
fillcolor: "rgba(139,69,19,0.1)",
line: {color: "transparent"},
name: "Accuracy",
showlegend: false,
type: "scatter"
}
var c = d3.scale.ordinal()
.domain([0, 1])
.range(["#D3D3D3", "#e76bf3"]);
var text = this.scoresSTD2.map (function(value, i) {
return `STD: +/-${value}`
})
var rows = chart.selectAll('.row')
.data(data, function(d){ return d.label })
var trace3 = {
x: this.xaxis,
y: this.scoresMean2,
text: text,
line: {color: "rgb(0,176,246)"},
mode: "lines+markers",
marker : {
symbol: 'square' },
name: "Precision",
type: "scatter"
}
rows.enter().append('g')
.attr('class', 'row')
var trace4 = {
x: xaxisReversed,
y: this.scoresPositive2.concat(this.scoresNegative2),
text: '',
hoverinfo: 'text',
fill: "tozerox",
fillcolor: "rgba(0,176,246,0.1)",
line: {color: "transparent"},
name: "Precision",
showlegend: false,
type: "scatter"
}
var text = this.scoresSTD3.map (function(value, i) {
return `STD: +/-${value}`
})
var trace5 = {
rows.exit()
.transition()
.duration(duration)
.style('fill-opacity', 0)
.remove()
rows.transition()
.duration(duration)
.attr('transform', function(d, i){ return 'translate(' + yLabelWidth + ',' + (maxR * i * 2 + maxR + xLabelHeight) + ')' })
var dots = rows.selectAll('circle')
.data(function(d){ return d.values })
dots.enter().append('circle')
.attr('cy', 0)
.attr('r', 0)
.style('fill', '#ffffff')
.text(function(d){ return d })
dots.exit()
.transition()
.duration(duration)
.attr('r', 0)
.remove()
var previously = this.previousState
var testLoc = this.flag
dots.transition()
.duration(duration)
.attr('r', function(d){ return r(d) })
.attr('cx', function(d, i){ return i * maxR * 2 + maxR })
.style('fill', function(d){
if (testLoc) {
if (d == state) {
previously.push(c(color))
return c(color);
} else {
previously.push(c(0))
return c(0)
}
} else {
return c(0)
}
})
this.flag = false
this.previousState = previously
var dotLabels = rows.selectAll('.dot-label')
.data(function(d){ return d.values })
var dotLabelEnter = dotLabels.enter().append('g')
.attr('class', 'dot-label')
.on('mouseover', function(d){
var selection = d3.select(this)
selection.select('rect').transition().duration(100).style('opacity', 1)
selection.select("text").transition().duration(100).style('opacity', 1)
})
.on('mouseout', function(d){
var selection = d3.select(this)
selection.select('rect').transition().style('opacity', 0)
selection.select("text").transition().style('opacity', 0)
})
dotLabelEnter.append('rect')
.style('fill', '#000000')
.style('opacity', 0)
dotLabelEnter.append('text')
.style('text-anchor', 'middle')
.style('fill', '#ffffff')
.style('opacity', 0)
dotLabels.exit().remove()
dotLabels
.attr('transform', function(d, i){ return 'translate(' + (i * maxR * 2) + ',' + (-maxR) + ')' })
.select('text')
.text(function(d){ return d })
.attr('y', maxR + 4)
.attr('x', maxR)
dotLabels
.select('rect')
.attr('width', maxR * 2)
.attr('height', maxR * 2)
var xLabels = chart.selectAll('.xLabel')
.data(labelsX)
xLabels.enter().append('text')
.attr('y', xLabelHeight)
.attr('transform', 'translate(0,-6)')
.attr('class', 'xLabel')
.style('text-anchor', 'middle')
.style('fill-opacity', 0)
xLabels.exit()
.transition()
.duration(duration)
.style('fill-opacity', 0)
.remove()
xLabels.transition()
.text(function (d) { return d })
.duration(duration)
.attr('x', function(d, i){ return maxR * i * 2 + maxR + yLabelWidth })
.style('fill-opacity', 1)
var yLabels = chart.selectAll('.yLabel')
.data(data, function(d){ return d.label })
yLabels.enter().append('text')
.text(function (d) { return d.label })
.attr('x', yLabelWidth)
.attr('class', 'yLabel')
.style('text-anchor', 'end')
.style('fill-opacity', 0)
yLabels.exit()
.transition()
.duration(duration)
.style('fill-opacity', 0)
.remove()
yLabels.transition()
.duration(duration)
.attr('y', function(d, i){ return maxR * i * 2 + maxR + xLabelHeight })
.attr('transform', 'translate(-6,' + maxR / 2.5 + ')')
.style('fill-opacity', 1)
var vert = chart.selectAll('.vert')
.data(labelsX)
vert.enter().append('line')
.attr('class', 'vert')
.attr('y1', xLabelHeight + borderWidth / 2)
.attr('stroke', '#888')
.attr('stroke-width', 1)
.style('shape-rendering', 'crispEdges')
.style('stroke-opacity', 0)
vert.exit()
.transition()
.duration(duration)
.style('stroke-opacity', 0)
.remove()
vert.transition()
.duration(duration)
.attr('x1', function(d, i){ return maxR * i * 2 + yLabelWidth })
.attr('x2', function(d, i){ return maxR * i * 2 + yLabelWidth })
.attr('y2', maxR * 2 * data.length + xLabelHeight - borderWidth / 2)
.style('stroke-opacity', function(d, i){ return i ? 1 : 0 })
var horiz = chart.selectAll('.horiz').
data(data, function(d){ return d.label })
horiz.enter().append('line')
.attr('class', 'horiz')
.attr('x1', yLabelWidth + borderWidth / 2)
.attr('stroke', '#888')
.attr('stroke-width', 1)
.style('shape-rendering', 'crispEdges')
.style('stroke-opacity', 0)
horiz.exit()
.transition()
.duration(duration)
.style('stroke-opacity', 0)
.remove()
horiz.transition()
.duration(duration)
.attr('x2', maxR * 2 * labelsX.length + yLabelWidth - borderWidth / 2)
.attr('y1', function(d, i){ return i * maxR * 2 + xLabelHeight })
.attr('y2', function(d, i){ return i * maxR * 2 + xLabelHeight })
.style('stroke-opacity', function(d, i){ return i ? 1 : 0 })
border.transition()
.duration(duration)
.attr('width', maxR * 2 * labelsX.length)
.attr('height', maxR * 2 * data.length)
},
initializeLinePLot () {
Plotly.purge('LinePlot')
this.scoresMean = []
this.scoresSTD = []
this.scoresMeanBest = []
this.scoresSTDBest = []
this.xaxis.push('Accuracy')
this.xaxis.push('Precision')
this.xaxis.push('Recall')
this.scoresMean.push((JSON.parse(this.ValidResultsVar[0])*100).toFixed(2))
this.scoresSTD.push((JSON.parse(this.ValidResultsVar[1])*100).toFixed(2))
this.scoresMean.push((JSON.parse(this.ValidResultsVar[2])*100).toFixed(2))
this.scoresSTD.push((JSON.parse(this.ValidResultsVar[3])*100).toFixed(2))
this.scoresMean.push((JSON.parse(this.ValidResultsVar[4])*100).toFixed(2))
this.scoresSTD.push((JSON.parse(this.ValidResultsVar[5])*100).toFixed(2))
this.scoresMeanBest.push((JSON.parse(this.ValidResultsVar[6])*100).toFixed(2))
this.scoresSTDBest.push((JSON.parse(this.ValidResultsVar[7])*100).toFixed(2))
this.scoresMeanBest.push((JSON.parse(this.ValidResultsVar[8])*100).toFixed(2))
this.scoresSTDBest.push((JSON.parse(this.ValidResultsVar[9])*100).toFixed(2))
this.scoresMeanBest.push((JSON.parse(this.ValidResultsVar[10])*100).toFixed(2))
this.scoresSTDBest.push((JSON.parse(this.ValidResultsVar[11])*100).toFixed(2))
var trace1 = {
x: this.xaxis,
y: this.scoresMean3,
text: text,
line: {color: "rgb(231,107,243)"},
mode: "lines+markers",
marker : {
symbol: 'triangle-up' },
name: "Recall",
type: "scatter"
y: this.scoresMean,
error_y: {
type: 'data',
array: this.scoresSTD,
visible: true
},
marker: {
color: "rgb(0,255,255)"
},
name: "Current",
type: "bar"
}
var trace6 = {
x: xaxisReversed,
y: this.scoresPositive3.concat(this.scoresNegative3),
text: '',
hoverinfo: 'text',
fill: "tozerox",
fillcolor: "rgba(231,107,243,0.1)",
line: {color: "transparent"},
name: "Recall",
showlegend: false,
type: "scatter"
var trace2 = {
x: this.xaxis,
y: this.scoresMeanBest,
error_y: {
type: 'data',
array: this.scoresSTDBest,
visible: true
},
marker: {
color: "rgb(231,107,243)"
},
name: "Best",
type: "bar"
}
var DataforLinePlot = [trace1, trace2, trace3, trace4, trace5, trace6];
var DataforLinePlot = [trace1, trace2];
var layout = {
xaxis: {
gridcolor: "rgb(230,230,230)",
title: 'Step of the feature engineering',
title: 'Validation metric',
tickformat: '.0f',
range: [0, this.scoresMean.length + 5],
showgrid: true,
showline: false,
showticklabels: true,
@ -170,22 +358,32 @@ export default {
ticks: "outside",
zeroline: false
},
barmode: 'group',
autosize: false,
width: '1230',
height: '232',
width: '400',
height: '350',
margin: {
l: 55,
r: 20,
b: 45,
r: 5,
b: 50,
t: 5,
pad: 5
},
legend:{
xanchor:"center",
yanchor:"top",
y:-0.2, // play with it
x:0.5, // play with it
orientation: "h"
}
}
var config = {displayModeBar: false, scrollZoom: true, displaylogo: false, showLink: false, showSendToCloud: false, modeBarButtonsToRemove: ['toImage'], responsive: true}
Plotly.newPlot('LinePlot', DataforLinePlot, layout, config)
},
reset () {
var svg = d3.select("#HistoryPlot");
svg.selectAll("*").remove();
Plotly.purge('LinePlot')
},
},
@ -193,6 +391,9 @@ export default {
EventBus.$on('finalResults', data => { this.ValidResultsVar = data })
EventBus.$on('finalResults', this.initializeLinePLot)
EventBus.$on('quad', data => { this.featuresReceived = data })
EventBus.$on('finalResults', this.HistoryPun)
EventBus.$on('reset', this.reset)
}
}
@ -202,6 +403,9 @@ export default {
text {
font-family: sans-serif;
fill: black;
font: 16px sans-serif;
cursor: default;
}
svg {
@ -216,4 +420,12 @@ svg {
display: none !important;
}
body {
background-color: #fff;
}
.dot-label text {
font-size: 12px;
}
</style>

@ -144,9 +144,6 @@ def retrieveFileName():
global previousState
previousState = []
global previousStateActive
previousStateActive = []
global yData
yData = []
@ -405,6 +402,8 @@ def executeModel(exeCall):
global featureImportanceData
global XData
global XDataStored
global previousState
scores = []
if (keyFirstTime):
create_global_function()
@ -414,7 +413,7 @@ def executeModel(exeCall):
bestParams = svc_bayesopt.max['params']
estimator = SVC(C=bestParams.get('C'), gamma=bestParams.get('gamma'), probability=True, random_state=RANDOM_SEED)
featureImportanceData = estimatorFeatureSelection(estimator)
keyFirstTime = False
XData = XDataStored.copy()
if (len(exeCall) != 0):
XData = XData.drop(XData.columns[exeCall], axis=1)
@ -427,8 +426,36 @@ def executeModel(exeCall):
inputsSc = ['accuracy','precision_macro','recall_macro']
flat_results = Parallel(n_jobs=num_cores)(delayed(solve)(estimator,XData,yData,crossValidation,item,index) for index, item in enumerate(inputsSc))
scores = [item for sublist in flat_results for item in sublist]
scoresAct = [item for sublist in flat_results for item in sublist]
howMany = 0
if (keyFirstTime):
previousState = scoresAct
keyFirstTime = False
howMany = 3
else:
if ((scoresAct[0]-scoresAct[1]) > (previousState[0]-previousState[1])):
previousState[0] = scoresAct[0]
previousState[1] = scoresAct[1]
howMany = howMany + 1
elif ((scoresAct[2]-scoresAct[3]) > (previousState[2]-previousState[3])):
previousState[2] = scoresAct[2]
previousState[3] = scoresAct[3]
howMany = howMany + 1
elif ((scoresAct[4]-scoresAct[5]) > (previousState[4]-previousState[5])):
previousState[4] = scoresAct[4]
previousState[5] = scoresAct[5]
howMany = howMany + 1
else:
pass
scores = scoresAct + previousState
if (howMany == 3):
scores.append(1)
else:
scores.append(0)
return 'Everything Okay'
def estimatorFeatureSelection(clf):

Loading…
Cancel
Save