From 530d38e7fd9258600ab1f4b79dd3dad7f9bb5c88 Mon Sep 17 00:00:00 2001 From: Angelos Chatzimparmpas Date: Fri, 8 Jan 2021 15:27:33 +0100 Subject: [PATCH] new --- __pycache__/run.cpython-38.pyc | Bin 29872 -> 29980 bytes .../src/components/FeatureSpaceDetail.vue | 6 +- frontend/src/components/Heatmap.vue | 6 ++ frontend/src/components/Main.vue | 9 ++- frontend/src/components/Results.vue | 70 +++++++++++++++--- run.py | 6 +- 6 files changed, 82 insertions(+), 15 deletions(-) diff --git a/__pycache__/run.cpython-38.pyc b/__pycache__/run.cpython-38.pyc index d770e6c3fc7c7e6c40be58e51ebb77f3414703b5..1032ef958ff38c9a9f2b62a3351eee58112f096e 100644 GIT binary patch delta 7177 zcmb_geRNz$b$|1|w4eI6zHEI&vL&r;eOUfT>IgZqEG3Q;$&utlUfW2|`<~>rcHgdM zpAyMDRU{?}0TgsR`2+(iARLrK(*)5#$VUmBv}t<^$?1X9z7lBqPn$wZLTMVzDe1lQ z1OYC7y^N(FJ2eycnwss~^UJ;0vuJV1Jus=e*vjyi0qMc9l$0311P zXeQkPWX~Y2$L0ovMuZUijQ=HdJCfU2Z=md06OzpcEeNd$TM>33v?1&S2?QAHxKyG6fg17r!6JTFA>(BiP(U;!OeUQ}Mj4ihy z90YIzlgU^@(+wTvr4`tIh^6zJDscEBamW;a3SDD{MfsH7?BDWf<0x|S?=hsJna^&d z#sNZLVj5%j7VN3Yh_Wa;VsooQV8^lp*pCZtA$6>(uyMm3*xHXUfN%uiPIj!YqV_0| zj+{zR%kg!_VuM_u6g`d{+&p3ScwyCczALLY#3>p=-3F`#HS|92Dq1WQpay%pu#6mI z7YZwh$;yguaV^FL>t^Fc5pw_1kBa_9B!}3uC0m=Wtndg|7z8>~%YIe5$*aXr>RQJj zjpO*XE05PMj;Fn-RUewJI%7JT#Ksk7!_O3ZtF#?#2Mb)qjy&M*$kj1FnAyI~SC9b& zd6=-j94ce2<=w4#&MuJ9BB3XMT9oJn{5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CE9r{{SYJj->zq 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']