diff --git a/__pycache__/run.cpython-38.pyc b/__pycache__/run.cpython-38.pyc index d770e6c..1032ef9 100644 Binary files a/__pycache__/run.cpython-38.pyc and b/__pycache__/run.cpython-38.pyc differ diff --git a/frontend/src/components/FeatureSpaceDetail.vue b/frontend/src/components/FeatureSpaceDetail.vue index ff7315c..8b596ac 100644 --- a/frontend/src/components/FeatureSpaceDetail.vue +++ b/frontend/src/components/FeatureSpaceDetail.vue @@ -547,6 +547,8 @@ export default { var clearSendNode = [] clearSendNode.push(id.name) clearSendNode.push(clickedNode-1) + EventBus.$emit('updateHistoryKey', 2) + EventBus.$emit('updateValuesofHistory', clickedNode-1) EventBus.$emit('UpdateIDTrans', clickedNode+"_root") EventBus.$emit('transformNodes', clearSendNode) } else { @@ -643,9 +645,11 @@ export default { EventBus.$emit('Counter', selectionCounter) IDsGather.push(idLocal); if (selectionCounter == 2) { + EventBus.$emit('updateValuesofHistory', IDsGather) EventBus.$emit('UpdateIDs', IDsGather) EventBus.$emit('CompareTwo', IDsGather) } else if (selectionCounter == 3) { + EventBus.$emit('updateValuesofHistory', IDsGather) EventBus.$emit('UpdateIDs', IDsGather) EventBus.$emit('CompareThree', IDsGather) } else { @@ -750,7 +754,7 @@ export default { {name: 'linkStrength', values: [0.25, 0.5]}, {name: 'gravity', values: [0, 0.5]}, {name: 'iterations', values: [1, 2]}, - {name: 'alphaDecay', values: [0.0228, 0.05]}, + {name: 'alphaDecay', values: [0, 0.0228, 0.05]}, {name: 'velocityDecay', values: [0.4, 0.8]} ]; diff --git a/frontend/src/components/Heatmap.vue b/frontend/src/components/Heatmap.vue index a1afd31..ea83b36 100644 --- a/frontend/src/components/Heatmap.vue +++ b/frontend/src/components/Heatmap.vue @@ -391,6 +391,8 @@ export default { if (index > -1) { featuresAddRem.splice(index, 1); } + EventBus.$emit('updateHistoryKey', 0) + EventBus.$emit('updateValuesofHistory', k) EventBus.$emit('addFeature', featuresAddRem) return 'yellow' } else if (d == -3) { @@ -402,6 +404,7 @@ export default { // } // }) featuresGen.push(k) + EventBus.$emit('updateHistoryKey', 3) EventBus.$emit('addFeatureGen', featuresGen) return 'yellow' } else { @@ -414,10 +417,13 @@ export default { if (index > -1) { featuresGen.splice(index, 1); } + EventBus.$emit('updateHistoryKey', 4) EventBus.$emit('removeFeaturesGen', featuresGen) return "url(#diagonalHatch)" } else { featuresAddRem.push(k) + EventBus.$emit('updateHistoryKey', 1) + EventBus.$emit('updateValuesofHistory', k) EventBus.$emit('removeFeatures', featuresAddRem) return "url(#diagonalHatch)" } diff --git a/frontend/src/components/Main.vue b/frontend/src/components/Main.vue index dbc714f..5412455 100755 --- a/frontend/src/components/Main.vue +++ b/frontend/src/components/Main.vue @@ -464,7 +464,11 @@ export default Vue.extend({ this.featureNames = [] EventBus.$emit('Generation', this.featureNames) EventBus.$emit('HeatmapCall', this.Importance) - this.returnResults() + if (!this.transformNodesFlag) { + this.returnResults() + } else { + this.transformNodesFlag = false + } }) .catch(error => { console.log(error) @@ -487,9 +491,7 @@ export default Vue.extend({ this.ValidResults = response.data.ValidResults EventBus.$emit('finalResults', this.ValidResults) if (this.transformNodesFlag) { - console.log('mpikeMesa') EventBus.$emit('Default') - this.transformNodesFlag = false } }) .catch(error => { @@ -555,6 +557,7 @@ export default Vue.extend({ axios.post(path, postData, axiosConfig) .then(response => { console.log('Store newly generated features!') + EventBus.$emit('updateHistoryKey', 5) this.threshold() EventBus.$emit('Default') }) diff --git a/frontend/src/components/Results.vue b/frontend/src/components/Results.vue index 91d5e2e..bd3a635 100644 --- a/frontend/src/components/Results.vue +++ b/frontend/src/components/Results.vue @@ -22,15 +22,23 @@ export default { scoresMeanBest: [], scoresSTDBest: [], xaxis: [], - valuesGlobal: [1, 0, 0, 0], // initial + valuesGlobal: [], + historyKey: -1, + whereIsChange: -1, previousState: [], + storeBestSoFarAV: [], flag: true } }, methods: { HistoryPun() { - var state = this.globalStep + 1 - + + this.globalStep = this.globalStep + 1 + var state = this.globalStep + if (state == 1) { + this.storeBestSoFarAV = ((parseFloat(this.scoresMeanBest[0]) + parseFloat(this.scoresMeanBest[1]) + parseFloat(this.scoresMeanBest[2])) / 3) + } + var svg = d3.select("#HistoryPlot"); svg.selectAll("*").remove(); @@ -62,11 +70,40 @@ export default { var data = [] var features = this.featuresReceived[33] + if (this.historyKey == -1) { + for (let i = 0; i < features.length; i++) { + this.valuesGlobal.push([state,0,0,0]) + } + } else if (this.historyKey == 0) { + this.valuesGlobal[this.whereIsChange][this.historyKey] = state + } else if (this.historyKey == 1) { + this.valuesGlobal[this.whereIsChange][this.historyKey] = state + } else if (this.historyKey == 2) { + this.valuesGlobal[this.whereIsChange][this.historyKey] = state + } else if (this.historyKey == 3) { + for (let j = 0; j < this.whereIsChange.length; j++) { + this.valuesGlobal[this.whereIsChange[j]][this.historyKey] = state + } + } else if (this.historyKey == 4) { + for (let j = 0; j < this.whereIsChange.length; j++) { + this.valuesGlobal[this.whereIsChange[j]][0] = state + } + } else if (this.historyKey == 5) { + this.valuesGlobal.push([state,0,0,0]) + } else { + + } + + var toWhichFeature = this.historyKey + var toWhichPosition = this.whereIsChange + var counterSet = 0 + var labelsX = ['Include', 'Exclude', 'Transform', 'Generate'] + console.log(this.valuesGlobal) for (let i=0; i< features.length; i++) { data.push({ label: features[i], - values: this.valuesGlobal + values: this.valuesGlobal[i] }) } @@ -118,6 +155,11 @@ export default { .attr('r', 0) .remove() + + if (this.storeBestSoFarAV > ((this.scoresMeanBest[0] + this.scoresMeanBest[1] + this.scoresMeanBest[2]) / 3)) { + this.flag = true + } + var previously = this.previousState var testLoc = this.flag @@ -128,21 +170,25 @@ export default { .attr('cx', function(d, i){ return i * maxR * 2 + maxR }) .style('fill', function(d){ if (testLoc) { + if (toWhichFeature == -1) { + previously.push('#B15928') + return previously[counterSet] + } + } else { if (d == state) { - previously.push(c(color)) - return '#B15928' + previously[counterSet] = 'rgb(' + c(d) + ',' + c(d) + ',' + c(d) + ')' } else { - previously.push(c(0)) - return 'rgb(' + c(d) + ',' + c(d) + ',' + c(d) + ')' + return previously[counterSet] } - } else { - return 'rgb(' + c(d) + ',' + c(d) + ',' + c(d) + ')' } + counterSet = counterSet + 1 }) this.flag = false this.previousState = previously + console.log(this.previousState) + var dotLabels = rows.selectAll('.dot-label') .data(function(d){ return d.values }) @@ -389,6 +435,10 @@ export default { }, }, mounted () { + + EventBus.$on('updateHistoryKey', data => { this.historyKey = data }) + EventBus.$on('updateValuesofHistory', data => { this.whereIsChange = data }) + EventBus.$on('finalResults', data => { this.ValidResultsVar = data }) EventBus.$on('finalResults', this.initializeLinePLot) diff --git a/run.py b/run.py index 3f76ae7..eb34c44 100644 --- a/run.py +++ b/run.py @@ -470,6 +470,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): XDataStored = XData.copy() else: XData = XDataStored.copy() + XDataStoredOriginal = XDataStored.copy() else: if (flagEx == 4): XDataStored = XData.copy() @@ -661,7 +662,8 @@ def Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5): # XDataNumericColumn = XData.select_dtypes(include='number') XDataNumeric = XDataStoredOriginal.select_dtypes(include='number') - columns = list(XDataNumeric) + columns = list(XDataNumeric) + print(columns) global packCorrTransformed packCorrTransformed = [] @@ -1412,12 +1414,14 @@ def CompareFunPy(): @cross_origin(origin='localhost',headers=['Content-Type','Authorization']) @app.route('/data/storeGeneratedFeatures', methods=["GET", "POST"]) def storeGeneratedFeat(): + print('Generate') executeModel([], 3, '') return 'Okay' @cross_origin(origin='localhost',headers=['Content-Type','Authorization']) @app.route('/data/transformation', methods=["GET", "POST"]) def transformFeatures(): + print('transform') retrieveTransform = request.get_data().decode('utf8').replace("'", '"') retrieveTransform = json.loads(retrieveTransform) clickedNodeName = retrieveTransform['nameClicked']