From 26cdbf3f849740ad72a439a58fb6d9bba576af8e Mon Sep 17 00:00:00 2001 From: Angelos Chatzimparmpas Date: Mon, 25 Jan 2021 13:57:30 +0100 Subject: [PATCH] new --- __pycache__/run.cpython-38.pyc | Bin 38708 -> 38598 bytes .../src/components/FeatureSpaceDetail.vue | 3 +- .../src/components/FeatureSpaceOverview.vue | 8 +-- run.py | 63 ++++++++++-------- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/__pycache__/run.cpython-38.pyc b/__pycache__/run.cpython-38.pyc index 6780fee0aadc8e6b00feeabe85f15a8f0c4aa128..91acbed9098838b2c9a636ad20e3210fc3aff819 100644 GIT binary patch delta 4378 zcmbtX3vgS-6@B~k^dwpGC${zRUv|EVoj8f}j}!56Q=pjui3#9=NffW-SazQ6)w+E0 zp4GvDw17cm8OkRGiGSLJOb`@GOIkup!=FG)sgstFh89Di&=we`6ngJUHV(9%&h%w` z-rc)r&)&UvclGkn1L{+I)xz@%3kwu@Vh4&g9p7Jg)JuZdx4n<39`1|#taWB9hoNXtG?Me>N=Zs zcNuF$Yt8#)mzYz#UDuq%M?BewYx{^h1M{*w5$+Pr!KUg@h@vE9G^&$0NkA=C*?#B_ z5w>4k5^Qe#7zrwP6qP*)*l9yM|1`iG2cHgqi3Q?taK_iJFbP$ARCXHI(sl@1=MMRH za#y5a;AQBwLGKo>ORtuHySY=g9lRjo8hBZpQtwZ?jdOsl0ejb%wT#7iorC{P$0+$q zuO~&=8N6^Db;u_�D+r})(P zv>c1p(Ap8zDu?2Dp&;cl%pip6v;3xyCW#zyg;8L7p(gU!r)&cTpB|r)6EMq7FQluK z){WTn!A+0P%!>zU{fL_LLJ;lwAR46Rr#Vgz)3Y*4K!yu}hcZf4KJ+9EtIZFa3d1zE z>ZD<_Ck-pjtrrBOcU&SxjH7vlX;R@PSZjb!O*iJ0U}pr(K)N1s(nJZAYrHjwPR}GK zHQfrGk?Y2Rka%Kj&kN6#!jFOI+;Pzf&ZazP7I5sWG(UOsIB#O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ZREXV?e~gR@=WrQTXw1B zm^iuhZnz*@CwD@T$=!AY3eJgbm#AMl#G>sFlB77geJODy({H`h4V~}Yv637Wci+)k zh&7xIBb1}#D-iI)L5ctHj&Aa?SQ)#VWF)6z`6M4}Na|k{cY#^8n!2^S;GYZu@%oM& z!o+(!-pIyNoVpg$%Eew2hj&(hJD=|SF4-b37o+5-;z?2KkjM9Q@|3ujRLVySmTdMV f!dV3AMh-gUM>r%N`SEkkn_cOys4_12oooLK;e)ZG diff --git a/frontend/src/components/FeatureSpaceDetail.vue b/frontend/src/components/FeatureSpaceDetail.vue index c799af2..9b39243 100644 --- a/frontend/src/components/FeatureSpaceDetail.vue +++ b/frontend/src/components/FeatureSpaceDetail.vue @@ -832,7 +832,8 @@ export default { var VIFVar = JSON.parse(this.dataFS[23+this.quadrantNumber]) var MIVar = JSON.parse(this.dataFS[28+this.quadrantNumber]) MIVar = MIVar.concat(this.MIRemaining) - var colorCateg = d3.scaleOrdinal(d3.schemeDark2) + //var colorCateg = d3.scaleOrdinal(d3.schemeDark2) + var colorCateg = d3.scaleOrdinal().domain([0, 1, 2, 4]).range(['#808000','#7570b3','#1b9e77','#d95f02']) var corrTargetFormatted = [] for (let i = 0; i < Object.keys(corrTarget).length; i++) { diff --git a/frontend/src/components/FeatureSpaceOverview.vue b/frontend/src/components/FeatureSpaceOverview.vue index 79e8da5..bd73b66 100644 --- a/frontend/src/components/FeatureSpaceOverview.vue +++ b/frontend/src/components/FeatureSpaceOverview.vue @@ -1185,8 +1185,8 @@ export default { var legendRectSize = 14; var legendSpacing = 3; - var color = d3v5.scaleOrdinal(d3v5.schemeDark2) var labelsData = JSON.parse(this.overallData[1]) + var color = d3v5.scaleOrdinal().domain(labelsData).range(['#808000','#7570b3','#1b9e77','#d95f02']) var svgLegend = d3v5.select('#legendTarget').append('svg') .attr('width', 130) @@ -1199,7 +1199,7 @@ export default { .attr('class', 'legend') // NEW .attr('transform', function(d, i) { // NEW var height = legendRectSize + legendSpacing; // NEW - var offset = height * color.domain().length / 2; + var offset = height * 0 / 2; var horz = 25 // NEW var vert = i * height - offset; // NEW return 'translate(' + horz + ',' + vert + ')'; // NEW @@ -1208,14 +1208,14 @@ export default { legend.append('rect') .attr('width', legendRectSize) .attr('height', legendRectSize) - .style('fill', function (d) { return color(d) }) + .style('fill', function (d) { var d_string = String(d); return color(d_string) }) .style('opacity', "0.5"); legend.append('text') .attr('class', 'legendLab') .attr('x', legendRectSize + legendSpacing) .attr('y', legendRectSize - legendSpacing) - .text(function(d) { return d; }); + .text(function(d) { return d; }); } }, mounted () { diff --git a/run.py b/run.py index b4b2b0e..7f66fa5 100644 --- a/run.py +++ b/run.py @@ -470,9 +470,11 @@ def dataSetSelection(): XData, yData = ArrayDataResults, AllTargetsFloatValues global keepOriginalFeatures + global OrignList keepOriginalFeatures = XData.copy() keepOriginalFeatures.columns = [str(col) + ' F'+str(idx+1)+'' for idx, col in enumerate(keepOriginalFeatures.columns)] columnsNewGen = keepOriginalFeatures.columns.values.tolist() + OrignList = keepOriginalFeatures.columns.values.tolist() XData.columns = ['F'+str(idx+1) for idx, col in enumerate(XData.columns)] @@ -526,6 +528,7 @@ def executeModel(exeCall, flagEx, nodeTransfName): global listofTransformations global XDataStoredOriginal global finalResultsData + global OrignList global tracker global XDataNoRemoval @@ -539,11 +542,12 @@ def executeModel(exeCall, flagEx, nodeTransfName): if (flagEx == 3): XDataStored = XData.copy() XDataNoRemovalOrig = XDataNoRemoval.copy() + OrignList = columnsNewGen elif (flagEx == 2): XData = XDataStored.copy() XDataStoredOriginal = XDataStored.copy() XDataNoRemoval = XDataNoRemovalOrig.copy() - columnsNewGen = keepOriginalFeatures.columns.values.tolist() + columnsNewGen = OrignList else: XData = XDataStored.copy() XDataNoRemoval = XDataNoRemovalOrig.copy() @@ -552,13 +556,12 @@ def executeModel(exeCall, flagEx, nodeTransfName): if (flagEx == 4): XDataStored = XData.copy() XDataNoRemovalOrig = XDataNoRemoval.copy() - print('edw!') #XDataStoredOriginal = XDataStored.copy() elif (flagEx == 2): XData = XDataStored.copy() XDataStoredOriginal = XDataStored.copy() XDataNoRemoval = XDataNoRemovalOrig.copy() - columnsNewGen = keepOriginalFeatures.columns.values.tolist() + columnsNewGen = OrignList else: XData = XDataStored.copy() #XDataNoRemoval = XDataNoRemovalOrig.copy() @@ -572,12 +575,20 @@ def executeModel(exeCall, flagEx, nodeTransfName): bayesopt.maximize(init_points=10, n_iter=5, acq='ucb') # 35 and 15 bestParams = bayesopt.max['params'] estimator = XGBClassifier(n_estimators=int(bestParams.get('n_estimators')), eta=bestParams.get('eta'), max_depth=int(bestParams.get('max_depth')), probability=True, random_state=RANDOM_SEED, silent=True, verbosity = 0, use_label_encoder=False) - columnsNewGen = keepOriginalFeatures.columns.values.tolist() + columnsNewGen = OrignList + + + print(columnsNewGen) if (len(exeCall) != 0): if (flagEx == 1): - XData = XData.drop(XData.columns[exeCall], axis=1) - XDataStoredOriginal = XDataStoredOriginal.drop(XDataStoredOriginal.columns[exeCall], axis=1) + currentColumnsDeleted = [] + for uniqueValue in exeCall: + currentColumnsDeleted.append(tracker[uniqueValue]) + for column in XData.columns: + if (column in currentColumnsDeleted): + XData = XData.drop(column, axis=1) + XDataStoredOriginal = XDataStoredOriginal.drop(column, axis=1) elif (flagEx == 2): columnsKeepNew = [] columns = XDataGen.columns.values.tolist() @@ -665,29 +676,6 @@ def executeModel(exeCall, flagEx, nodeTransfName): columnsNamesLoc = XData.columns.values.tolist() - tracker = [] - for value in columnsNewGen: - value = value.split(' ') - if (len(value) > 1): - tracker.append(value[1]) - else: - tracker.append(value[0]) - - - storeIndices = [] - valuesStore = [] - for ind, col in enumerate(tracker): - for value in XDataStoredOriginal.columns.values.tolist(): - if col in value: - storeIndices.append(ind) - valuesStore.append(valuesStore) - tracker[ind] = tracker[ind].replace(col, value) - else: - break - # FIX THAT! - #for el in storeIndices: - # columnsNewGen[el] = columnsNewGen[el].replace(columnsNewGen[el],valuesStore[el]) - #print(columnsNewGen) for col in columnsNamesLoc: splittedCol = col.split('_') if (len(splittedCol) == 1): @@ -704,6 +692,23 @@ def executeModel(exeCall, flagEx, nodeTransfName): print(XDataStored) print(XDataStoredOriginal.columns) print(XDataNoRemoval) + + tracker = [] + for value in columnsNewGen: + value = value.split(' ') + if (len(value) > 1): + tracker.append(value[1]) + else: + tracker.append(value[0]) + print(tracker) + + # for ind, col in enumerate(tracker): + # for value in XDataStoredOriginal.columns.values.tolist(): + # if col in value: + # tracker[ind] = tracker[ind].replace(col, value) + # else: + # break + estimator.fit(XData, yData) yPredict = estimator.predict(XData) yPredictProb = cross_val_predict(estimator, XData, yData, cv=crossValidation, method='predict_proba')