From 2472fe2db348b97f2bb03332787da83e4b6208a5 Mon Sep 17 00:00:00 2001 From: Angelos Chatzimparmpas Date: Wed, 6 Jan 2021 14:58:39 +0100 Subject: [PATCH] new --- __pycache__/run.cpython-38.pyc | Bin 29696 -> 29739 bytes .../src/components/FeatureSpaceDetail.vue | 38 +++++++++++------- run.py | 25 +++++++----- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/__pycache__/run.cpython-38.pyc b/__pycache__/run.cpython-38.pyc index 7c692633f849b7e9a0d7bbe9a1114f018f09a79e..2d975798387b78b40dbc8f57f1e647c53f416b1d 100644 GIT binary patch delta 2629 zcmb_eTWl0n7(V}*o!QyhoxQcw?H1_Oaup=uB4Qt)ZHPittU#8Ag;u5_TTM0ckx8MH8%3xBz%1>mSArG!q}3plG_y6KY7}Hi#}C^4O?(gE{UitDxbGIUR1-oR=i%#*6bmg&dwylL#2nx=pmUgi{-!slOF+Fwz!asU@JQqNhu%{PZ%XRJ3!J1+Uibb zhb&nHEyW_q)H72`k@U){8K5)PEJbL}0yGLt>V?;{b=5vb*;&@0fz@;NI;?T{bUd>i&{#J4(GCO~i@ zi2$iLSd55}86|l=T@6D-gi2tYc!hax7m4~$Tq{Ty(}q=oJexi+$3s>_qC7c?B-++$ z{Qm>oR|u{%T_R&d zeKkA!uS$^e%2eSxRT@o9LT%mkQ#&PQ9Vvfes#t5G)=-x0uG>T&BVmOJ%mS!Q2%CZ&Mx2%{haZ2bf&|oG-xXJ@O2?5>& z5sp`uHA54|mUmQJcmHxz!$sXXe!I%S64f&^8@VE3A~V2)eg!H%*?kaNG2K((w@A2k z^LjkrWAMIlx3|~e!{hGpUIQL=-|77!5dO}CaT*8)U~F9jUe2oS=eK{vom^Nb*Al!< z_X0(NRT15fs8x}u9|=`OVtz!cio~smP(+Xte~9iM87RA#b^5SLh(tN+*SgNI zAdD~G`3>2_cX@X2de08rP1ar8_nt(zXmZnQ7|ZDR$)*Qro`QheJ(vbM*)8{;hqSwL`}{DpyF(-00FSuGcFzMi1b|sc34*^VBV>!}j6X(ZzoN#`BQ$ delta 2520 zcmb_eZ)_Ar6rVS{cel59d)@0DZ4c<(l~OBz)JCB;SP|Nbh)Piu(jtFay2qcRz4o@# z58#|D9)CUn$%QcnV zyP!(M>+0b}(N^~m92aKYN=Y&=icjj=At|oaJrZ8dpj2(>u1D4B+so(K0JY+3{c(tk z!}C8EYZ~f3CdWA0gAK>Q`@R!0O@tcn3)g@OG6X>f1$#lNh}DhtcDC`91j|Kq(f6=j zTwe4g42TaGkHcPZ;(@oIAeKEi&kCc95Vm$~L)=3MBN;HjphqF^Vf5d=7lYy{K;E~5 z^vKLJ5!#|>^HUSS-G!lJUal}7Qwk6zhE$D-g3q>o^1xxW=tasn5^YPlO&MaX$)0?e93 zHibUphqMTbdGg4hnEAPN*^fpeddwcuk-1V73ZMun-$)#CbbsqoRVk7bbSrF|Q^=60r zx24SmFzVZt?d=;j(k6(?C8FkGe5^NWL+QSBFWYLcJ%i~Xw=9THmo$lAmvli`tXkR< zsq9Sku%3?L{f2Af?b*=}GINNpzYgMYZ4g>Yhqc(-4m(}_ z2h{i3ms3|{bL0?csG_Ne~c^Z#V;U#qS&T z;h7%m?7{l$$b>7C;_c48&?0KO2JnRAUF*bXR|E^}cvl+ouKv!(2)r&n+xTQ)3=e5G zIpQZf@Y2T=E{SuSAC;&siKb_g;`(aEPHst1xFS|`zX^Yc(e7gac7IO{Kof_y{RmZd vx_4m!5_U1$24LA21{MGuu>TtTnO487+^>VGU{e*p(^EDn7TF{I9BTR-3pjdN diff --git a/frontend/src/components/FeatureSpaceDetail.vue b/frontend/src/components/FeatureSpaceDetail.vue index 8f6b4af..ff7315c 100644 --- a/frontend/src/components/FeatureSpaceDetail.vue +++ b/frontend/src/components/FeatureSpaceDetail.vue @@ -59,6 +59,7 @@ export default { featureAddRemCount: [], mode: 0, // this should be 0 KeepIDs: [], + KeepIDTransform: '', keepNumberOfCompareNodes: 0 } }, @@ -99,6 +100,8 @@ export default { }, setLayerCompare() { this.mode = 1 + this.KeepIDTransform = '' + EventBus.$emit('brushLink', -1) this.graphVizualization() }, computeOnce () { @@ -111,13 +114,11 @@ export default { } var featureNames = JSON.parse(this.dataFS[35]) - var pushEach var oldVal var newVal var outcome var countLoc - var pushEachFinalFinal = [] for (let loop=1; loop<=5; loop++) { var corrMatrixCombLoc =[] @@ -137,7 +138,7 @@ export default { pushEach = [] Object.entries(transf1).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var retrieveData = dataLocOnce[loop-1] var search = Object.values(retrieveData[key]) oldVal = Math.abs(search[countLoc]) + oldVal @@ -157,7 +158,7 @@ export default { countLoc = 0 Object.entries(transf2).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var retrieveData = dataLocOnce[loop-1] var search = Object.values(retrieveData[key]) oldVal = Math.abs(search[countLoc]) + oldVal @@ -177,7 +178,7 @@ export default { countLoc = 0 Object.entries(transf3).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var retrieveData = dataLocOnce[loop-1] var search = Object.values(retrieveData[key]) oldVal = Math.abs(search[countLoc]) + oldVal @@ -197,7 +198,7 @@ export default { countLoc = 0 Object.entries(transf4).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var retrieveData = dataLocOnce[loop-1] var search = Object.values(retrieveData[key]) oldVal = Math.abs(search[countLoc]) + oldVal @@ -259,7 +260,7 @@ export default { pushEach = [] Object.entries(transf1).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var search = Object.values(dataLoc[key]) oldVal = Math.abs(search[countLoc]) + oldVal newVal = Math.abs(Object.values(value)[0]) + newVal @@ -282,7 +283,7 @@ export default { countLoc = 0 Object.entries(transf2).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var search = Object.values(dataLoc[key]) oldVal = Math.abs(search[countLoc]) + oldVal newVal = Math.abs(Object.values(value)[0]) + newVal @@ -305,7 +306,7 @@ export default { countLoc = 0 Object.entries(transf3).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var search = Object.values(dataLoc[key]) oldVal = Math.abs(search[countLoc]) + oldVal newVal = Math.abs(Object.values(value)[0]) + newVal @@ -328,7 +329,7 @@ export default { countLoc = 0 Object.entries(transf4).forEach( function ([feature, value]) { - var key = Object.keys(value) + var key = listofNodes[index] var search = Object.values(dataLoc[key]) oldVal = Math.abs(search[countLoc]) + oldVal newVal = Math.abs(Object.values(value)[0]) + newVal @@ -531,6 +532,7 @@ export default { var modeLoc = this.mode var selectionCounter = this.keepNumberOfCompareNodes var IDsGather = this.KeepIDs + var IDsGatherTrans = this.KeepIDTransform var node = svg.append('g') .attr('class', 'nodes') @@ -545,6 +547,7 @@ export default { var clearSendNode = [] clearSendNode.push(id.name) clearSendNode.push(clickedNode-1) + EventBus.$emit('UpdateIDTrans', clickedNode+"_root") EventBus.$emit('transformNodes', clearSendNode) } else { for (let i = 0; i < listofNodes.length; i++) { @@ -710,6 +713,8 @@ export default { node.append('title').text(function (d) { return d.name; }); EventBus.$emit('brushLink', -1) }); + + var chartWidth = 310; var chartHeight = 65; var margin = {left: 8, right: 15, top: 10, bottom: 40}; @@ -738,14 +743,14 @@ export default { .text("Weighted graph readability (%)"); var readabilityCircles = chartSvg.append('g').selectAll('circle'); - // 48 parameters + // 32 parameter combinations var paramGroups = [ {name: 'chargeStrength', values: [-80]}, {name: 'linkDistance', values: [-80]}, {name: 'linkStrength', values: [0.25, 0.5]}, {name: 'gravity', values: [0, 0.5]}, {name: 'iterations', values: [1, 2]}, - {name: 'alphaDecay', values: [0, 0.0228, 0.05]}, + {name: 'alphaDecay', values: [0.0228, 0.05]}, {name: 'velocityDecay', values: [0.4, 0.8]} ]; @@ -822,7 +827,6 @@ export default { dispatch.call('layoutend', forceSim, p, i); ++i; - if (i >= paramList.length) { var widthLoc = 100; @@ -1278,6 +1282,11 @@ export default { .text("MI") } stepper.stop(); + if (IDsGatherTrans != '') { + let ID = document.getElementsByClassName(IDsGatherTrans)[0].parentElement.getAttribute('id') + d3.select('#'+ID).dispatch('click'); + IDsGatherTrans = '' + } } }); @@ -1368,7 +1377,6 @@ export default { } this.legendOnlyOnce = false - }, reset () { var svg = d3.select("#FeatureGraph"); @@ -1382,6 +1390,8 @@ export default { EventBus.$on('Counter', data => { this.keepNumberOfCompareNodes = data }) EventBus.$on('UpdateIDs', data => { this.KeepIDs = data }) + EventBus.$on('UpdateIDTrans', data => { this.KeepIDTransform = data }) + this.InitSlider() EventBus.$on('CorrThres', data => { this.threshold = data }) EventBus.$on('CorrThres', this.initializeNetwork) diff --git a/run.py b/run.py index 28a0884..13bc32c 100644 --- a/run.py +++ b/run.py @@ -461,6 +461,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): global columnsNewGen global columnsNames global listofTransformations + global XDataStoredOriginal columnsNames = [] scores = [] @@ -488,6 +489,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): if (len(exeCall) != 0): if (flagEx == 1): XData = XData.drop(XData.columns[exeCall], axis=1) + XDataStoredOriginal = XDataStoredOriginal.drop(XDataStoredOriginal.columns[exeCall], axis=1) elif (flagEx == 2): columnsKeepNew = [] columns = XDataGen.columns.values.tolist() @@ -498,6 +500,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): XDataTemp = XDataGen[columnsKeepNew] XData[columnsKeepNew] = XDataTemp.values + XDataStoredOriginal[columnsKeepNew] = XDataTemp.values elif (flagEx == 4): splittedCol = nodeTransfName.split('_') XData.rename(columns={ XData.columns[exeCall[0]]: nodeTransfName }, inplace = True) @@ -515,6 +518,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): else: XData[nodeTransfName] = np.log10(XData[nodeTransfName]) XData[nodeTransfName] = XData[nodeTransfName].round() + XDataStored = XData.copy() print(XData) columnsNamesLoc = XData.columns.values.tolist() @@ -651,19 +655,19 @@ def sendFinalResults(): def Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5): - XDataNumericColumn = XDataStored.select_dtypes(include='number') + # XDataNumericColumn = XData.select_dtypes(include='number') XDataNumeric = XDataStoredOriginal.select_dtypes(include='number') - columns = list(XDataNumericColumn) - + columns = list(XDataNumeric) global packCorrTransformed packCorrTransformed = [] - # FIX THAT! + for count, i in enumerate(columns): dicTransf = {} - splittedCol = columnsNames[(count)*len(listofTransformations)+0] + splittedCol = columnsNames[(count)*len(listofTransformations)+0].split('_') if(len(splittedCol) == 1): + d={} XDataNumericCopy = XDataNumeric.copy() for number in range(1,6): @@ -680,7 +684,7 @@ def Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5): illusion = locals()[quadrantVariable] d["DataRows{0}".format(number)] = XDataNumericCopy.iloc[illusion, :] dicTransf["transf1"] = NewComputationTransf(d['DataRows1'], d['DataRows2'], d['DataRows3'], d['DataRows4'], d['DataRows5'], quadrant1, quadrant2, quadrant3, quadrant4, quadrant5, i, count) - splittedCol = columnsNames[(count)*len(listofTransformations)+1] + splittedCol = columnsNames[(count)*len(listofTransformations)+1].split('_') if(len(splittedCol) == 1): d={} XDataNumericCopy = XDataNumeric.copy() @@ -699,7 +703,7 @@ def Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5): illusion = locals()[quadrantVariable] d["DataRows{0}".format(number)] = XDataNumericCopy.iloc[illusion, :] dicTransf["transf2"] = NewComputationTransf(d['DataRows1'], d['DataRows2'], d['DataRows3'], d['DataRows4'], d['DataRows5'], quadrant1, quadrant2, quadrant3, quadrant4, quadrant5, i, count) - splittedCol = columnsNames[(count)*len(listofTransformations)+2] + splittedCol = columnsNames[(count)*len(listofTransformations)+2].split('_') if(len(splittedCol) == 1): d={} XDataNumericCopy = XDataNumeric.copy() @@ -718,7 +722,7 @@ def Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5): illusion = locals()[quadrantVariable] d["DataRows{0}".format(number)] = XDataNumericCopy.iloc[illusion, :] dicTransf["transf3"] = NewComputationTransf(d['DataRows1'], d['DataRows2'], d['DataRows3'], d['DataRows4'], d['DataRows5'], quadrant1, quadrant2, quadrant3, quadrant4, quadrant5, i, count) - splittedCol = columnsNames[(count)*len(listofTransformations)+3] + splittedCol = columnsNames[(count)*len(listofTransformations)+3].split('_') if(len(splittedCol) == 1): d={} XDataNumericCopy = XDataNumeric.copy() @@ -742,7 +746,6 @@ def Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5): return 'Everything Okay' def NewComputationTransf(DataRows1, DataRows2, DataRows3, DataRows4, DataRows5, quadrant1, quadrant2, quadrant3, quadrant4, quadrant5, feature, count): - corrMatrix1 = DataRows1.corr() corrMatrix1 = corrMatrix1.abs() corrMatrix2 = DataRows2.corr() @@ -1023,14 +1026,14 @@ def Seperation(): quadrant5.append(index) probabilityPredictions.append(value) - Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5) - # Main Features DataRows1 = XData.iloc[quadrant1, :] DataRows2 = XData.iloc[quadrant2, :] DataRows3 = XData.iloc[quadrant3, :] DataRows4 = XData.iloc[quadrant4, :] DataRows5 = XData.iloc[quadrant5, :] + + Transformation(quadrant1, quadrant2, quadrant3, quadrant4, quadrant5) corrMatrix1 = DataRows1.corr() corrMatrix1 = corrMatrix1.abs()