From cf4093e3f7bc232bc9e1565385fffb7d24c3ef5e Mon Sep 17 00:00:00 2001 From: Angelos Chatzimparmpas Date: Sat, 2 Jan 2021 15:23:58 +0100 Subject: [PATCH] new --- __pycache__/run.cpython-38.pyc | Bin 25352 -> 27681 bytes .../src/components/FeatureSpaceDetail.vue | 41 ++++---- .../src/components/FeatureSpaceOverview.vue | 4 +- frontend/src/components/Heatmap.vue | 62 +++++++++--- frontend/src/components/Main.vue | 29 ++++++ frontend/src/components/Results.vue | 4 +- run.py | 90 ++++++++++++++++-- 7 files changed, 189 insertions(+), 41 deletions(-) diff --git a/__pycache__/run.cpython-38.pyc b/__pycache__/run.cpython-38.pyc index cb5f182e6d5b8b85bb7f86117d6df3f576640000..668336b7ec77c068bb68c8501397a74c254dd463 100644 GIT binary patch delta 8432 zcma)B4RBo5b$<8lkM>uqm9&y}CCmD?w6gwe%d#=D{3Bb~!Ip(3|FE$vKj}TmE3bCf zcb{y@tXLa4gakxPZ%Ro5bTuRa5z-{6)3jmYkeZ}3g))@RBhG=KEQ97TF7bknrYlPDM%G;levp{S5BMnAr+c)JQA9j4#x(R^LHrWWr6mB4YZg2 zu3$guV%?T5lffv`oow2&k-W*0mM`>xiW=D=)xv+BTAyr)3rl34#EIj`n*G;dZnvO~7=4V}rB zxEY6BA!kpjo7Bz)BGtlxF4YGU{R&1IZX8wKl{M;{Fschi)v24=yse_L9$i_7(11Vy zG~=`)g=r)EuI+Ks%?{dYcQ+%i2_R4`OR6*!mBy99NHDC%_V0;NKXO|T)+4kctV3u+ zXh-N^-?e)Z8?m_op%Y;fK)_Cw*i1-`9SFu$+J!wO`=A-2bA!N9=s8IZM#6M64(LYM z0-)K3R4F{J3@b2bEB4-ounpmMgdT+L00HM7F!-=^{(ur@I~*P44i<4Nk$&cO9&FY3 z5sK~r(2A&{(x7rq=?{jK0cl#f1ii6~0D`5A4O)Ecl*P!Nar)Sc&VF)orJyiD?7M(V zcO&$%M_lD>yv)rW_jp^E$pGJ{%S0oy0A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q1~IaZW%3OMVwVy{c3{7N4Easow&RsrVS~g|hTz^%B1_Rh`Uu?W_FtDbj-UYP}0tv9ZLS8bwy@q#q-7y%6yUggpR0JMRfJkjwmY zf!)0?q7*h7+^le{JJUa_sa9r17|vCXhT`Fo`5Ujq4-Yf8}@Tg z@SsENb>a0QpAOcRN5H&chPzdCKE0K{j)IkEgS*H%zoJH?hGjAmo(cx&edve@?iMk) z=tbi2e}X=cP(Q*&1blX**AVbVNv|Wkg77NB(+J;0cn{%i-Z|5f^+>wj9a|r~ti?lm iKX@(0p5m8ghRcrPRn(c3tm3!ZrrR90qx^%J-v0**ux@n# diff --git a/frontend/src/components/FeatureSpaceDetail.vue b/frontend/src/components/FeatureSpaceDetail.vue index 5d9b4d7..e89c595 100644 --- a/frontend/src/components/FeatureSpaceDetail.vue +++ b/frontend/src/components/FeatureSpaceDetail.vue @@ -9,17 +9,17 @@
- - + +
-
+
-
+

Fs COR (>)

@@ -95,6 +95,7 @@ export default { this.KeepIDs = [] this.keepNumberOfCompareNodes = 0 this.graphVizualization() + EventBus.$emit('storeGeneration') }, setLayerCompare() { this.mode = 1 @@ -491,8 +492,9 @@ export default { var svg = d3.select('#chartID') svg.selectAll("*").remove() - var width = 819; - var height = 819; + var marginNodes = {top: 0, right: 0, bottom: 0, left: 0}; + var width = 819 - marginNodes.right - marginNodes.left; + var height = 819 - marginNodes.top - marginNodes.bottom; var numTicks = 200; @@ -503,7 +505,8 @@ export default { svg = d3.select("#FeatureGraph").append("svg") .attr("width", width) - .attr("height", height); + .attr("height", height) + .attr('transform', `translate(${marginNodes.left}, ${marginNodes.top})`); var graph = this.jsonData @@ -635,6 +638,11 @@ export default { EventBus.$emit('UpdateIDs', IDsGather) if (selectionCounter == 1) { EventBus.$emit('Default') + } else if (selectionCounter == 2) { + EventBus.$emit('UpdateIDs', IDsGather) + EventBus.$emit('CompareTwo', IDsGather) + } else { + } } } @@ -647,7 +655,7 @@ export default { items.forEach( function (it) { it.childNodes[0].style.visibility = "hidden"; it.childNodes[1].setAttribute("transform", "translate(50,50) scale(0.28) rotate(180)"); - it.childNodes[1].childNodes[0].style.fill = "white"; + it.childNodes[1].childNodes[0].style.fill = "#D3D3D3"; it.childNodes[2].style.visibility = "hidden"; }) } @@ -679,9 +687,9 @@ export default { node.append('title').text(function (d) { return d.name; }); EventBus.$emit('brushLink', -1) }); - var chartWidth = 350; + var chartWidth = 310; var chartHeight = 65; - var margin = {left: 25, right: 25, top: 10, bottom: 40}; + var margin = {left: 8, right: 15, top: 10, bottom: 40}; var chartSvg = d3.select('svg.chart') .attr('width', chartWidth) .attr('height', chartHeight) @@ -704,7 +712,7 @@ export default { .attr("y", chartHeight + 10) .attr("dy", "0.71em") .attr("text-anchor", "middle") - .text("Graph readability (%)"); + .text("Weighted graph readability (%)"); var readabilityCircles = chartSvg.append('g').selectAll('circle'); // 48 parameters @@ -1021,6 +1029,7 @@ export default { zoom_handler(svg); + for (let i = 0; i < listofNodes.length; i++) { var numb = graph.nodes[i]['group'].match(/\d/g) numb = parseInt(numb.join("")) @@ -1190,7 +1199,7 @@ export default { var textLine = d3.select('#legendText').append("svg").attr('width', 170).attr('height', 90) - var marginBorder = 18 + var marginBorder = 16 var marginBorderX = 10 textLine.append('line') .style("stroke", "black") @@ -1208,7 +1217,7 @@ export default { textLine.append('line') .style("stroke", "black") .style("stroke-width", 3) - .attr("x1", 42 + marginBorderX) + .attr("x1", 44 + marginBorderX) .attr("y1", 31 - marginBorder) .attr("x2", 53 + marginBorderX) .attr("y2", 31 - marginBorder) @@ -1281,8 +1290,8 @@ export default { yDistance = yDistance[1] - yDistance[0]; graph.nodes.forEach(function (n, i) { - n.x = (height - 10) * (n.x - xMin) / Math.max(xDistance, yDistance); - n.y = (height - 10) * (n.y - yMin) / Math.max(xDistance, yDistance); + n.x = (height - 105) * (n.x - xMin) / Math.max(xDistance, yDistance); // Margin for Nodes + n.y = (height - 105) * (n.y - yMin) / Math.max(xDistance, yDistance); // Margin for Nodes }); xDistance = d3.extent(graph.nodes, function (n) { return n.x; }); @@ -1449,7 +1458,7 @@ table td { #chartID { position: absolute; - transform: translate(-390px, 840px); + transform: translate(-354px, 840px); } .chart circle { diff --git a/frontend/src/components/FeatureSpaceOverview.vue b/frontend/src/components/FeatureSpaceOverview.vue index 9875280..258976f 100644 --- a/frontend/src/components/FeatureSpaceOverview.vue +++ b/frontend/src/components/FeatureSpaceOverview.vue @@ -44,7 +44,7 @@
Labels
-
+
@@ -367,7 +367,7 @@ export default { if(d.name == 'Data') { return d.selected ? 0 : 0; } else if (d.name == 'All' || d.name == 'Best' || d.name == 'Good' || d.name == 'Bad' || d.name == 'Worst'){ - return d.selected ? 2 : 2; + return d.selected ? 3 : 3; } else { return d.selected ? 0 : 0; } diff --git a/frontend/src/components/Heatmap.vue b/frontend/src/components/Heatmap.vue index 115af56..351deac 100644 --- a/frontend/src/components/Heatmap.vue +++ b/frontend/src/components/Heatmap.vue @@ -40,6 +40,7 @@ export default { dataFI: [], featureData: [], generKey: [], + featureGenGlobal: [] } }, methods: { @@ -82,17 +83,16 @@ export default { var FeaturesAccuracy = JSON.parse(this.dataFI[2]) if (Object.entries(this.generKey).length == 0) { - var Features = this.featureData[0] + var Features = JSON.parse(this.featureData[0]) } else { - console.log(this.generKey) var Features = this.generKey } - + console.log(Features) let arr = Object.values(featureUni.Score); let minUni = Math.min(...arr); let maxUni = Math.max(...arr); - let len = Features.length + var len = Features.length let indicesYAxis = [] for (let i = 0; i < len; i++) { indicesYAxis[i] = [Features[i]] @@ -120,16 +120,25 @@ export default { } 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) + values[j] = ((((Object.values(featureUni.Score)[i]-minUni)/(maxUni-minUni)))+(PermImpEli[i][0])+(FeaturesAccuracy[i][0]))/(len2-2) } else { if (Object.entries(this.generKey).length == 0) { values[j] = -2 } else { - if (i == 0 || i == 1) { - values[j] = -3 + if (Object.entries(this.generKey).length == 7) { + if (i == 0 || i == 1) { + values[j] = -3 + } + else { + values[j] = -4 + } + } else { + if (i == 0 || i == 1 || i == 2) { + values[j] = -3 + } + else { + values[j] = -4 } - else { - values[j] = -4 } } } @@ -145,8 +154,17 @@ export default { }, heatmap_display(data, heatmapId) { + if (Object.entries(this.generKey).length == 0) { + var Features = JSON.parse(this.featureData[0]) + } else { + var Features = this.generKey + } + + var len = Features.length + + var featuresAddRem = [] - var featuresGen = [] + var featuresGen = this.featureGenGlobal var cellSize = this.cellSize //########################################################################## // Patrick.Brockmann@lsce.ipsl.fr @@ -237,7 +255,7 @@ export default { }) .attr("x", 0) .attr("y", function(d, i) { - return (i * cellSize); + return (i * cellSize); }) .style("text-anchor", "end") .attr("transform", function(d, i) { @@ -306,7 +324,7 @@ export default { }) .attr("class", "row"); 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", -75).style("text-anchor", "middle").style("font-size", "16px").text("Feature"); // -130 before for HeartC + svg.append("text").attr("transform", "rotate(-90)").attr("x", (-1)*(cellSize*(len/2))).attr("y", -75).style("text-anchor", "middle").style("font-size", "16px").text("Feature"); // -130 before for HeartC var heatMap = row.selectAll(".cell") .data(function(d) { return d; @@ -381,9 +399,19 @@ export default { return colorScale(d) } } else { - featuresAddRem.push(k) - EventBus.$emit('removeFeatures', featuresAddRem) - return "url(#diagonalHatch)" + if (d == -4) { + const index = featuresGen.indexOf(k); + console.log(index) + if (index > -1) { + featuresGen.splice(index, 1); + } + EventBus.$emit('removeFeaturesGen', featuresGen) + return "url(#diagonalHatch)" + } else { + featuresAddRem.push(k) + EventBus.$emit('removeFeatures', featuresAddRem) + return "url(#diagonalHatch)" + } } } else { if (d == -3) { @@ -587,6 +615,10 @@ export default { } }, mounted () { + + EventBus.$on('removeFeaturesGen', data => { this.featureGenGlobal = data }) + EventBus.$on('addFeatureGen', data => { this.featureGenGlobal = data }) + EventBus.$on('Generation', data => { this.generKey = data }) EventBus.$on('HeatmapCall', data => { this.dataFI = data }) diff --git a/frontend/src/components/Main.vue b/frontend/src/components/Main.vue index 4abbfda..3c1cd00 100755 --- a/frontend/src/components/Main.vue +++ b/frontend/src/components/Main.vue @@ -459,6 +459,7 @@ export default Vue.extend({ .then(response => { console.log('Server successfully send the importances!') this.Importance = response.data.Importance + console.log(this.Importance) this.featureNames = [] EventBus.$emit('Generation', this.featureNames) EventBus.$emit('HeatmapCall', this.Importance) @@ -533,6 +534,28 @@ export default Vue.extend({ console.log(error) }) }, + storeGenFun () { + const path = `http://127.0.0.1:5000/data/storeGeneratedFeatures` + const postData = { + } + const axiosConfig = { + headers: { + 'Content-Type': 'application/json', + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token', + 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, OPTIONS' + } + } + axios.post(path, postData, axiosConfig) + .then(response => { + console.log('Store newly generated features!') + EventBus.$emit('updateFeatureImp') + EventBus.$emit('Default') + }) + .catch(error => { + console.log(error) + }) + }, Compare () { const path = `http://127.0.0.1:5000/data/compareFun` const postData = { @@ -581,6 +604,7 @@ export default Vue.extend({ }, }, created () { + // does the browser support the Navigation Timing API? if (window.performance) { console.info("window.performance is supported"); @@ -594,6 +618,8 @@ export default Vue.extend({ }, mounted() { + EventBus.$on('storeGeneration', this.storeGenFun) + var modal = document.getElementById('myModal') window.onclick = function(event) { //alert(event.target) @@ -619,6 +645,7 @@ export default Vue.extend({ EventBus.$on('CompareThree', this.Compare) EventBus.$on('Default', this.returnImportance) + EventBus.$on('updateFeatureImp', this.returnCorrel) EventBus.$on('ReturningBrushedPointsIDs', data => { this.modelsUpdate = data }) //EventBus.$on('ReturningBrushedPointsIDs', this.UpdateBarChartFeatures ) @@ -674,6 +701,8 @@ export default Vue.extend({ EventBus.$on('addFeature', this.ManipulFeature) EventBus.$on('removeFeatures', this.ManipulFeature) + EventBus.$on('removeFeaturesGen', data => { this.featureAddRemGen = data }) + EventBus.$on('removeFeaturesGen', this.ManipulFeatureGen) EventBus.$on('addFeatureGen', data => { this.featureAddRemGen = data }) EventBus.$on('addFeatureGen', this.ManipulFeatureGen) diff --git a/frontend/src/components/Results.vue b/frontend/src/components/Results.vue index 2839830..951c5cb 100644 --- a/frontend/src/components/Results.vue +++ b/frontend/src/components/Results.vue @@ -47,7 +47,7 @@ export default { .attr('width', width + margin.left + margin.right) .attr('height', height + margin.top + margin.bottom) .append('g') - .attr('transform', 'translate(' + -5 + ',' + 0 + ')') + .attr('transform', 'translate(' + 0 + ',' + 0 + ')') var border = chart.append('rect') .attr('x', yLabelWidth) @@ -62,7 +62,7 @@ export default { var data = [] var features = this.featuresReceived[33] - var labelsX = ['Add', 'Remove', 'Combine', 'Round'] + var labelsX = ['Add', 'Remove', 'Transform', 'Generate'] for (let i=0; i< features.length; i++) { data.push({ label: features[i], diff --git a/run.py b/run.py index 6703740..31eaaf0 100644 --- a/run.py +++ b/run.py @@ -119,6 +119,10 @@ def reset(): global columnsKeep columnsKeep = [] + + global columnsNewGen + columnsNewGen = [] + return 'The reset was done!' # retrieve data from client and select the correct data set @@ -219,6 +223,9 @@ def retrieveFileName(): global columnsKeep columnsKeep = [] + global columnsNewGen + columnsNewGen = [] + DataRawLength = -1 DataRawLengthTest = -1 data = json.loads(fileName) @@ -399,6 +406,7 @@ def dataSetSelection(): global keepOriginalFeatures keepOriginalFeatures = XData.copy() keepOriginalFeatures.columns = [str(col) + ' (F'+str(idx+1)+')' for idx, col in enumerate(keepOriginalFeatures.columns)] + columnsNewGen = keepOriginalFeatures.columns.values.tolist() XData.columns = ['F'+str(idx+1) for idx, col in enumerate(XData.columns)] @@ -433,9 +441,18 @@ def executeModel(exeCall, flagEx): global XData global XDataStored global previousState + global columnsNewGen scores = [] - XData = XDataStored.copy() + if (len(exeCall) == 0): + if (flagEx == 3): + XDataStored = XData.copy() + else: + XData = XDataStored.copy() + else: + XData = XDataStored.copy() + columnsNewGen = keepOriginalFeatures.columns.values.tolist() + # Bayesian Optimization for 150 iterations if (keyFirstTime): create_global_function() @@ -444,20 +461,23 @@ def executeModel(exeCall, flagEx): svc_bayesopt.maximize(init_points=130, n_iter=20, acq='ucb') bestParams = svc_bayesopt.max['params'] estimator = SVC(C=bestParams.get('C'), gamma=bestParams.get('gamma'), probability=True, random_state=RANDOM_SEED) - featureImportanceData = estimatorFeatureSelection(XData, estimator) if (len(exeCall) != 0): if (flagEx == 1): XData = XData.drop(XData.columns[exeCall], axis=1) - else: + elif (flagEx == 2): columnsKeepNew = [] columns = XDataGen.columns.values.tolist() for indx, col in enumerate(columns): if indx in exeCall: columnsKeepNew.append(col) + columnsNewGen.append(col) + XDataTemp = XDataGen[columnsKeepNew] XData[columnsKeepNew] = XDataTemp.values + print(XDataStored) print(XData) + featureImportanceData = estimatorFeatureSelection(XData, estimator) estimator.fit(XData, yData) yPredict = estimator.predict(XData) yPredictProb = cross_val_predict(estimator, XData, yData, cv=crossValidation, method='predict_proba') @@ -1104,7 +1124,7 @@ def Seperation(): global packCorr packCorr = [] - packCorr.append(list(keepOriginalFeatures.columns.values.tolist())) + packCorr.append(json.dumps(columnsNewGen)) packCorr.append(json.dumps(target_names)) packCorr.append(json.dumps(probabilityPredictions)) @@ -1226,7 +1246,7 @@ def CompareFunPy(): feat2 = XDataGen.iloc[:,1] XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[1]] = feat1 + feat2 XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|'] = abs(feat1 - feat2) - XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]] = feat1 + feat2 + XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]] = feat1 * feat2 XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[1]] = feat1 / feat2 XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[0]] = feat2 / feat1 columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[1]) @@ -1235,8 +1255,66 @@ def CompareFunPy(): columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[1]) columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[0]) elif (compareMode == 2): - pass + XDataGen = XData[columnsKeepNonOrig] + feat1 = XDataGen.iloc[:,0] + feat2 = XDataGen.iloc[:,1] + feat3 = XDataGen.iloc[:,2] + XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[1]] = feat1 + feat2 + XDataGen['F'+columnsKeepID[1]+'+F'+columnsKeepID[2]] = feat2 + feat3 + XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[2]] = feat1 + feat3 + XDataGen['F'+columnsKeepID[0]+'+F'+columnsKeepID[1]+'+F'+columnsKeepID[2]] = feat1 + feat2 + feat3 + XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|'] = abs(feat1 - feat2) + XDataGen['|F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|'] = abs(feat2 - feat3) + XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[2]+'|'] = abs(feat1 - feat3) + XDataGen['|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|'] = abs(feat1 - feat2 - feat3) + XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]] = feat1 * feat2 + XDataGen['F'+columnsKeepID[1]+'xF'+columnsKeepID[2]] = feat2 * feat3 + XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[2]] = feat1 * feat3 + XDataGen['F'+columnsKeepID[0]+'xF'+columnsKeepID[1]+'xF'+columnsKeepID[2]] = feat1 * feat2 * feat3 + XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[1]] = feat1 / feat2 + XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[0]] = feat2 / feat1 + XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[2]] = feat2 / feat3 + XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[1]] = feat3 / feat2 + XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[2]] = feat1 / feat3 + XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[0]] = feat3 / feat1 + XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[2]] = feat1 / feat2 / feat3 + XDataGen['F'+columnsKeepID[0]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[1]] = feat1 / feat3 / feat2 + XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[0]] = feat2 / feat3 / feat1 + XDataGen['F'+columnsKeepID[1]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[2]] = feat2 / feat1 / feat3 + XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[1]] = feat3 / feat1 / feat2 + XDataGen['F'+columnsKeepID[2]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[0]] = feat3 / feat2 / feat1 + + columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[1]) + columnsKeep.append('F'+columnsKeepID[1]+'+F'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[0]+'+F'+columnsKeepID[1]+'+F'+columnsKeepID[2]) + columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'|') + columnsKeep.append('|F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|') + columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[2]+'|') + columnsKeep.append('|F'+columnsKeepID[0]+'-F'+columnsKeepID[1]+'-F'+columnsKeepID[2]+'|') + columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[1]) + columnsKeep.append('F'+columnsKeepID[1]+'xF'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[0]+'xF'+columnsKeepID[1]+'xF'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[1]) + columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[0]) + columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[1]) + columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[0]) + columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[0]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[1]) + columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[2]+'/F'+columnsKeepID[0]) + columnsKeep.append('F'+columnsKeepID[1]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[2]) + columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[0]+'/F'+columnsKeepID[1]) + columnsKeep.append('F'+columnsKeepID[2]+'/F'+columnsKeepID[1]+'/F'+columnsKeepID[0]) else: pass featureCompareData = estimatorFeatureSelection(XDataGen, estimator) + return 'Okay' + +@cross_origin(origin='localhost',headers=['Content-Type','Authorization']) +@app.route('/data/storeGeneratedFeatures', methods=["GET", "POST"]) +def storeGeneratedFeat(): + executeModel([], 3) return 'Okay' \ No newline at end of file