diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-06 21:10:40 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-06 21:10:40 +0200 |
| commit | 954c81596701e4948a7e9cc3133f601b067ba31c (patch) | |
| tree | 8ecd66bf2d1ae604590b5bf6b2010eb9c6953698 /public/bundle.js | |
| parent | 813a1bb59d1b605cf5420148711aa6d72aeea952 (diff) | |
fix graph
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/public/bundle.js b/public/bundle.js index be12c49..6042c3d 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -8741,6 +8741,7 @@ var SampleRNNGraph = function (_Component) { var hmax = h / 2; var epochsScaleFactor = 1; // 3/2 + ctx.save(); var X = void 0, Y = void 0; for (var ii = 0; ii < epochsMax; ii++) { @@ -8751,7 +8752,7 @@ var SampleRNNGraph = function (_Component) { ctx.lineTo(X, h); ctx.lineWidth = 0.5; // ctx.stroke() - if (ii % 5 === 0) { + if ((ii + 1) % 6 === 0) { ctx.lineWidth = 0.5; ctx.stroke(); var fontSize = 12; @@ -8775,7 +8776,7 @@ var SampleRNNGraph = function (_Component) { ctx.stroke(); ctx.stroke(); ctx.stroke(); - ctx.setLineDash([0, 0]); + ctx.setLineDash([1, 1]); var _fontSize = 12; ctx.font = 'italic ' + _fontSize + 'px "Georgia"'; ctx.fillStyle = 'rgba(0,12,28,0.6)'; @@ -8783,6 +8784,7 @@ var SampleRNNGraph = function (_Component) { // } } ctx.lineWidth = 1; + ctx.restore(); keys.forEach(function (key) { var loss = lossReport[key]; @@ -8790,20 +8792,18 @@ var SampleRNNGraph = function (_Component) { var vg = parseFloat(loss[0].training_loss) || 5; // console.log(vf) var vv = 1 - norm(vf, scaleMin, scaleMax / 2); - ctx.lineWidth = (1 - norm(vf, scaleMin, scaleMax)) * 5; + ctx.lineWidth = (1 - norm(vf, scaleMin, scaleMax)) * 4; ctx.strokeStyle = 'rgba(' + [randrange(30, 190), randrange(30, 150), randrange(60, 120)].join(',') + ',' + 0.8 + ')'; var begun = false; loss.forEach(function (a, i) { var v = parseFloat(a.training_loss); if (!v) return; - var x = lerp((i - 2) / (epochsMax / epochsScaleFactor) * epochsScaleFactor, wmin, wmax); + var x = lerp(i / (epochsMax / epochsScaleFactor) * epochsScaleFactor, wmin, wmax); var y = lerp(norm(v, scaleMin, scaleMax), hmax, hmin); - if (i === 0) { - return; - } if (!begun) { begun = true; - ctx.beginPath(x, y); + ctx.beginPath(0, 0); + ctx.moveTo(x, y); } else { ctx.lineTo(x, y); // ctx.stroke() @@ -8812,11 +8812,12 @@ var SampleRNNGraph = function (_Component) { ctx.stroke(); var i = loss.length - 1; var v = parseFloat(loss[i].training_loss); - var x = lerp((i - 2) / (epochsMax / epochsScaleFactor) * epochsScaleFactor, wmin, wmax); + var x = lerp(i / (epochsMax / epochsScaleFactor) * epochsScaleFactor, wmin, wmax); var y = lerp(norm(v, scaleMin, scaleMax), hmax, hmin); var fontSize = 9; ctx.font = 'italic ' + fontSize + 'px "Georgia"'; - ctx.fillText(key, x + fontSize, y + fontSize); + ctx.fillStyle = 'rgba(0,12,28,0.6)'; + ctx.fillText(key, x + 4, y + fontSize / 2); }); } }]); |
