Sha256: 887a2c18650d6e5d4228c6eadc20ef478618e1936e4fafe1229e04815c91a4dd

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

require "dnn"
require "dnn/datasets/mnist"
require_relative "convnet8"

include DNN::Callbacks

x_train, y_train = DNN::MNIST.load_train
x_test, y_test = DNN::MNIST.load_test

x_train = Numo::SFloat.cast(x_train) / 255
x_test = Numo::SFloat.cast(x_test) / 255

y_train = DNN::Utils.to_categorical(y_train, 10, Numo::SFloat)
y_test = DNN::Utils.to_categorical(y_test, 10, Numo::SFloat)

model = ConvNet.create([28, 28, 1])
model.add_callback(CheckPoint.new("trained/trained_mnist", interval: 5))

model.train(x_train, y_train, 20, batch_size: 128, test: [x_test, y_test])

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-dnn-1.3.0 examples/judge-number/mnist_train.rb
ruby-dnn-1.2.3 examples/judge-number/mnist_train.rb
ruby-dnn-1.2.2 examples/judge-number/mnist_train.rb
ruby-dnn-1.2.1 examples/judge-number/mnist_train.rb
ruby-dnn-1.2.0 examples/judge-number/mnist_train.rb
ruby-dnn-1.1.6 examples/judge-number/mnist_train.rb