From 44aabbbf6e106e30e08eeb45541d4915ef9bda40 Mon Sep 17 00:00:00 2001 From: Angelos Chatzimparmpas Date: Wed, 30 Dec 2020 21:22:22 +0100 Subject: [PATCH] new --- __pycache__/run.cpython-38.pyc | Bin 25352 -> 25352 bytes .../src/components/FeatureSpaceDetail.vue | 166 +++++++++++++----- .../src/components/FeatureSpaceOverview.vue | 11 +- run.py | 2 +- 4 files changed, 129 insertions(+), 50 deletions(-) diff --git a/__pycache__/run.cpython-38.pyc b/__pycache__/run.cpython-38.pyc index c4ee2310796ab305889d18cef07ed6a98568bf3f..cb5f182e6d5b8b85bb7f86117d6df3f576640000 100644 GIT binary patch delta 4499 zcma)Hz zX9EfF25~FnB-@w_XI5DkxzVx&CpEaP@F=iB)a5j@R-xy7mbHjH*UoIy zX!JFTpzBlQi;THrEV~IU&A=vce%=DMMLbvFDVboqI20zB!A1zqxXK5$xNIZ+_vZ2H z1JIF!K8}(vRc%B`B@~hydB4RX?lcsN6NM!usU=KU4Qp+k!Sr-BaU-{rxkY7ORb2;$ z=mffe?Z6I#VfX9NQ6n>;X;E3S4{4(@-Yv%R3bXe>O8UYpUd}72liQHC1Jv!w;rr=F z$xlQ>x*E^|TWK@BDvxOazFWMT_XrD!ocvDHSJI+J;mcRq@#OdOU$;u%R9DSz_;zWy zxKZF?esX8^n%Px$O!~^gx5A9JDX%R_d5sUCYlfqP;!5F0avM$a5GxxtS4P4Qv41!Q z>H9b9N^URcuXEEH-)Ei)#(StVVdI1JW7vX$5yR%!LuSNClVqF(#YYzQjzNi^0G#FbYUZ%|JtSujna$k?j@l6p!b*slj76SgYX}RKsD_5Kk^@>6EF) z1=*=3AuAZxNR)4uD*QCMKT1#>VLhOQ45yi5()}tj7ndwP3wg%zlh$W$j%Zn2$<8H@ zEIw~_r3NJ7XGG?b^-8Lx*JDqcFFVTheziXs3dTqIGZ>b(&BEOTN+Nc3Bp6d%QLY7o z{NT8UEq+)J@H67Vl2|Lwi^s_qpvMu@Lq|1pk<)GV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y1$h5LdsrgRI)KA%eBvE^X>daG2$J_mnMSR zcWDv-t+&iUiQQd!EcF}-c(Zwhc&@T4M>?2v&7WZ0_kkVamzC9vaV(}Iqz_|n!)r_z zv8I|1bV=1#k8~xMUmuOc_#t6bwI;s^;_p^P(;VNDx6ZmU*pd=BykXKV6S$SaX4;tI z<;=rj>r%LeP5chHOQxWETF89>8%`JG=p13URRtjpP^y4<7 zxaqB^ctO-XQo9*bk%o)0aX7qGfgI32P-7{QxPRVEOv&v3BiqQF^AaXmF86bN#^^Q4 zqea7}c1ydNLTi(SX!v!JRo8s4+14cs3Qt}8ntLqyV6qU+w$O3M2DD+`B2Ls5)k*(w zshq3hrh7CJJTR(pE-*nr;Ap0X_t70`+lU(}|4q%_uhlP2zS}U`~HAy8T7c z24CneZ;DGj4fi2;0djM$d9i11KVI_4QnyUH(!JKtJSP4JC@9+!ZuS0*Q~DDGq*GbD zPWTJ|^W8(Qi)ioEj;7^4m?bAdy|aCf|88h-vAZB&w;-Iw`}wPuVMd*U+&+{tmIkGNVGn_YR3nRHHn1-M=~#Au(YFf(Bj-c1#1>R8`zWI2;qCC zdeJ&qNFNu&gKgdN<-??@ybi^Mw@QtYZpErkzFgEY=%f9&_qx?Lz)^JsVjrX8>bB_x=t=X1E~#YDM|;2CtcU4B(5yFn7_+|$NVk;PP2LEU-KwX2 zWD~ljJ4;XAfvWW1TPU3ew|708Fdb?%YP$V;WGFbyd#D57 z$lNepTpx{Tyn$NyZr}(o2ngULAoqL)rK
+
@@ -7,17 +8,19 @@ +
+ @@ -82,7 +85,7 @@ export default { .attr('width', 200) .attr('height', 80) .append('g') - .attr('transform', 'translate(30,30)'); + .attr('transform', 'translate(18,20)'); gStepPos.call(sliderStepPos); @@ -485,6 +488,8 @@ export default { var svg = d3.select("#FeatureGraph"); svg.selectAll("*").remove(); + var svg = d3.select('#chartID') + svg.selectAll("*").remove() var width = 819; var height = 819; @@ -674,17 +679,45 @@ export default { node.append('title').text(function (d) { return d.name; }); EventBus.$emit('brushLink', -1) }); - - var paramGroups = [ - {name: 'chargeStrength', values: [-30, -80]}, - {name: 'linkDistance', values: [30, -80]}, - {name: 'linkStrength', values: [0, 1]}, + var chartWidth = 350; + var chartHeight = 65; + var margin = {left: 25, right: 25, top: 10, bottom: 40}; + var chartSvg = d3.select('svg.chart') + .attr('width', chartWidth) + .attr('height', chartHeight) + .append('g') + .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); + + chartWidth = chartWidth - margin.left - margin.right; + chartHeight = chartHeight - margin.top - margin.bottom; + + var x = d3.scaleLinear() + .domain([75, 100]) + .range([0, chartWidth]); + + chartSvg.append('g') + .attr('transform', 'translate(0,' + chartHeight + ')') + .call(d3.axisBottom(x).ticks(7)) + .append("text") + .attr("fill", "#000") + .attr('transform', 'translate(' + chartWidth/2 + ',' + 0 + ')') + .attr("y", chartHeight + 10) + .attr("dy", "0.71em") + .attr("text-anchor", "middle") + .text("Graph readability (%)"); + + var readabilityCircles = chartSvg.append('g').selectAll('circle'); + // 48 parameters + 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: 'velocityDecay', values: [0.4, 0.8]} ]; - + var paramList = generateParams(paramGroups); var bestSoFar = d3.select('.best').selectAll('li') @@ -693,6 +726,7 @@ export default { .text(function (d) { return d; }); dispatch.on('layoutend', function (params, i) { + if (!bestParams || params.graphReadability > bestParams.graphReadability) { bestParams = params; selectedParams = bestParams; @@ -701,7 +735,31 @@ export default { .data(d3.map(bestParams).keys().filter(function (d) { return d !== 'positions' && d !== 'graphReadability'; })) .text(function (d) { return d + ' = ' + bestParams[d]; }); } + // Plot the number line. + readabilityCircles = readabilityCircles + .data(readabilityCircles.data().concat(params)) + .enter().append('circle') + .attr('cx', function (d) { return x(d.graphReadability*100); }) + .attr('cy', 5) + .attr('r', 4) + .on('click', function (d) { + selectedParams = d; + readabilityCircles.classed('selected', false); + d3.select(this).classed('selected', true).raise(); + + bestSoFar + .data(d3.map(selectedParams).keys().filter(function (d) { return d !== 'positions' && d !== 'graphReadability'; })) + .text(function (d) { return d + ' = ' + selectedParams[d]; }); + + drawGraph(); + }) + .merge(readabilityCircles) + .classed('selected', function (d) { return d === selectedParams; }); + + readabilityCircles.filter(function (d) { return d === selectedParams; }) + .raise(); + drawGraph(); }); var i = 0; @@ -724,9 +782,9 @@ export default { forceSim.tick(); } - p.graphReadability = greadability.greadability(graph.nodes, graph.links); - p.graphReadability = (p.graphReadability.crossing + p.graphReadability.crossingAngle + - p.graphReadability.angularResolutionMin + p.graphReadability.angularResolutionDev) / 4 + p.graphReadability = greadability.greadability(graph.nodes, graph.links); // crossing > angularResolDev > angularResolMin > Angle + p.graphReadability = (p.graphReadability.crossing * 1 + p.graphReadability.crossingAngle * 0.1 + + p.graphReadability.angularResolutionMin * 0.4 + p.graphReadability.angularResolutionDev * 0.75) / 2.25 p.positions = graph.nodes.map(function (n) { return {x: n.x, y: n.y}; }); @@ -963,8 +1021,6 @@ export default { zoom_handler(svg); - drawGraph(); - for (let i = 0; i < listofNodes.length; i++) { var numb = graph.nodes[i]['group'].match(/\d/g) numb = parseInt(numb.join("")) @@ -1001,11 +1057,10 @@ export default { d.fy = null; } - stepper.stop(); if (legendCall) { var svgLegend = d3.select("#legend").append("svg") - .attr("width", 160) + .attr("width", 170) .attr("height", 90) .attr("id", "legendNode") @@ -1133,61 +1188,64 @@ export default { }) }); - var textLine = d3.select('#legendText').append("svg").attr('width', 160).attr('height', 90) - + var textLine = d3.select('#legendText').append("svg").attr('width', 170).attr('height', 90) + + var marginBorder = 18 + var marginBorderX = 10 textLine.append('line') .style("stroke", "black") .style("stroke-width", 3) - .attr("x1", 35) - .attr("y1", 50) - .attr("x2", 74) - .attr("y2", 50) + .attr("x1", 35 + marginBorderX) + .attr("y1", 50 - marginBorder) + .attr("x2", 74 + marginBorderX) + .attr("y2", 50 - marginBorder) textLine.append("text") - .attr("dx", "75") - .attr("dy", "55") + .attr("dx", 75 + marginBorderX) + .attr("dy", 55 - marginBorder) .text("VIF") textLine.append('line') .style("stroke", "black") .style("stroke-width", 3) - .attr("x1", 42) - .attr("y1", 31) - .attr("x2", 53) - .attr("y2", 31) + .attr("x1", 42 + marginBorderX) + .attr("y1", 31 - marginBorder) + .attr("x2", 53 + marginBorderX) + .attr("y2", 31 - marginBorder) textLine.append("text") - .attr("dx", "54") - .attr("dy", "36") + .attr("dx", 54 + marginBorderX) + .attr("dy", 36 - marginBorder) .text("Per class COR") textLine.append('line') .style("stroke", "black") .style("stroke-width", 3) - .attr("x1", 32) - .attr("y1", 67) - .attr("x2", 74) - .attr("y2", 67) + .attr("x1", 32 + marginBorderX) + .attr("y1", 67 - marginBorder) + .attr("x2", 74 + marginBorderX) + .attr("y2", 67 - marginBorder) textLine.append("text") - .attr("dx", "75") - .attr("dy", "72") + .attr("dx", 75 + marginBorderX) + .attr("dy", 72 - marginBorder) .text("Target COR") textLine.append('line') .style("stroke", "#6baed6") .style("stroke-width", 3) - .attr("x1", 18) - .attr("y1", 50) - .attr("x2", 26) - .attr("y2", 50) + .attr("x1", 18 + marginBorderX) + .attr("y1", 50 - marginBorder) + .attr("x2", 26 + marginBorderX) + .attr("y2", 50 - marginBorder) textLine.append("text") - .attr("dx", "0") - .attr("dy", "55") + .attr("dx", 0 + marginBorderX) + .attr("dy", 55 - marginBorder) .style("fill", "#6baed6") .text("MI") } + stepper.stop(); } }); @@ -1283,6 +1341,8 @@ export default { reset () { var svg = d3.select("#FeatureGraph"); svg.selectAll("*").remove(); + var svg = d3.select('#chartID') + svg.selectAll("*").remove() }, }, mounted () { @@ -1387,4 +1447,24 @@ table td { padding-left: 6px !important; } +#chartID { + position: absolute; + transform: translate(-390px, 840px); +} + +.chart circle { + fill: black; + fill-opacity: 0.05; + stroke: black; + stroke-opacity: 0.05; + cursor: pointer; +} + +.chart circle.selected { + fill: #0062cc; + fill-opacity: 1; + stroke: #0062cc; + stroke-opacity: 1; +} + \ No newline at end of file diff --git a/frontend/src/components/FeatureSpaceOverview.vue b/frontend/src/components/FeatureSpaceOverview.vue index 27aa9ad..9875280 100644 --- a/frontend/src/components/FeatureSpaceOverview.vue +++ b/frontend/src/components/FeatureSpaceOverview.vue @@ -38,14 +38,14 @@
/
-
-
Labels
-
-
 Navigate
+
+
Labels
+
+
@@ -561,8 +561,7 @@ export default { function fullpath(d, idx) { idx = idx || 0; curPath.push(d); - return (d.parent ? fullpath(d.parent, curPath.length) : '') + - '/' + d.name + ''; } diff --git a/run.py b/run.py index d928ab8..6703740 100644 --- a/run.py +++ b/run.py @@ -436,7 +436,7 @@ def executeModel(exeCall, flagEx): scores = [] XData = XDataStored.copy() - + # Bayesian Optimization for 150 iterations if (keyFirstTime): create_global_function() params = {"C": (0.0001, 10000), "gamma": (0.0001, 10000)}
-
+
-
-

Collinear (>)

+
+

Fs COR (>)