August 2019
Intermediate to advanced
242 pages
5h 45m
English
Training is all well and good, but we also need to know whether or not our model is actually doing what it claims to be doing. We can reuse our training code, but let's make a few changes.
First, let's remove the solver command. We're testing our model, not training it, so we shouldn't be updating weights:
solver.Step(m.learnables())
Second, let's actually get an image out of our dataset into a convenient file:
for j := 0; j < xVal.Shape()[0]; j++ { rowT, _ := xVal.Slice(sli{j, j + 1}) row := rowT.Data().([]float64) img := visualizeRow(row) f, _ := os.OpenFile(fmt.Sprintf("images/%d - %d - %d - %d.jpg", b, j, rowLabel, rowGuess), os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644) jpeg.Encode(f, img, &jpeg.Options{jpeg.DefaultQuality}) ...Read now
Unlock full access