summaryrefslogtreecommitdiff
path: root/app/client/modules/samplernn
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-06 21:10:40 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-06 21:10:40 +0200
commit954c81596701e4948a7e9cc3133f601b067ba31c (patch)
tree8ecd66bf2d1ae604590b5bf6b2010eb9c6953698 /app/client/modules/samplernn
parent813a1bb59d1b605cf5420148711aa6d72aeea952 (diff)
fix graph
Diffstat (limited to 'app/client/modules/samplernn')
-rw-r--r--app/client/modules/samplernn/views/samplernn.graph.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/app/client/modules/samplernn/views/samplernn.graph.js b/app/client/modules/samplernn/views/samplernn.graph.js
index e94db6c..40e47fa 100644
--- a/app/client/modules/samplernn/views/samplernn.graph.js
+++ b/app/client/modules/samplernn/views/samplernn.graph.js
@@ -71,6 +71,7 @@ class SampleRNNGraph extends Component {
const hmax = h/2
const epochsScaleFactor = 1 // 3/2
+ ctx.save()
let X, Y
for (var ii = 0; ii < epochsMax; ii++) {
X = lerp((ii)/(epochsMax/(epochsScaleFactor))*(epochsScaleFactor), wmin, wmax)
@@ -80,7 +81,7 @@ class SampleRNNGraph extends 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()
const fontSize = 12
@@ -104,7 +105,7 @@ class SampleRNNGraph extends Component {
ctx.stroke()
ctx.stroke()
ctx.stroke()
- ctx.setLineDash([0,0])
+ ctx.setLineDash([1,1])
const fontSize = 12
ctx.font = 'italic ' + (fontSize) + 'px "Georgia"'
ctx.fillStyle = 'rgba(0,12,28,0.6)'
@@ -112,6 +113,7 @@ class SampleRNNGraph extends Component {
// }
}
ctx.lineWidth = 1
+ ctx.restore()
keys.forEach(key => {
const loss = lossReport[key]
@@ -119,33 +121,32 @@ class SampleRNNGraph extends Component {
const vg = parseFloat(loss[0].training_loss) || 5
// console.log(vf)
const 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+ ')'
let begun = false
loss.forEach((a, i) => {
const v = parseFloat(a.training_loss)
if (! v) return
- const x = lerp((i-2)/(epochsMax/(epochsScaleFactor))*(epochsScaleFactor), wmin, wmax)
+ const x = lerp((i)/(epochsMax/(epochsScaleFactor))*(epochsScaleFactor), wmin, wmax)
const 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.lineTo(x,y)
// ctx.stroke()
}
})
ctx.stroke()
const i = loss.length-1
const v = parseFloat(loss[i].training_loss)
- const x = lerp((i-2)/(epochsMax/(epochsScaleFactor))*(epochsScaleFactor), wmin, wmax)
+ const x = lerp((i)/(epochsMax/(epochsScaleFactor))*(epochsScaleFactor), wmin, wmax)
const y = lerp(norm(v, scaleMin, scaleMax), hmax, hmin)
const 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)
})
}
}