Our main looks like this so far:
func main() {
imgs, err := readImageFile(os.Open("train-images-idx3-ubyte"))
if err != nil {
log.Fatal(err)
}
labels, err := readLabelFile(os.Open("train-labels-idx1-ubyte"))
if err != nil {
log.Fatal(err)
}
log.Printf("len imgs %d", len(imgs))
data := prepareX(imgs)
lbl := prepareY(labels)
visualize(data, 10, 10, "image.png")
data2, err := zca(data)
if err != nil {
log.Fatal(err)
}
visualize(data2, 10, 10, "image2.png")
nat, err := native.MatrixF64(data2.(*tensor.Dense))
if err != nil {
log.Fatal(err)
}
log.Printf("Start Training")
nn := New(784, 100, 10)
costs := make([]float64, 0, data2.Shape()[0])
for e := 0; e < 5; e++ {
data2Shape := data2.Shape()
var oneimg, onelabel tensor.Tensor
for i := 0; i < data2Shape...