Sha256: 00d3a4d7d5da51a9168a5fd7e5cde3c806113be2cc42f92467e26a0cb120e520
Contents?: true
Size: 480 Bytes
Versions: 3
Compression:
Stored size: 480 Bytes
Contents
require "dnn" include DNN::Layers include DNN::Activations include DNN::Optimizers include DNN::Losses Model = DNN::Model Utils = DNN::Utils x = Numo::SFloat[[0, 0], [1, 0], [0, 1], [1, 1]] y = Numo::SFloat[[0], [1], [1], [0]] model = Model.new model << InputLayer.new(2) model << Dense.new(16) model << ReLU.new model << Dense.new(1) model.compile(SGD.new, SigmoidCrossEntropy.new) model.train(x, y, 20000, batch_size: 4, verbose: false) p Utils.sigmoid(model.predict(x))
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby-dnn-0.10.4 | examples/xor_example.rb |
ruby-dnn-0.10.3 | examples/xor_example.rb |
ruby-dnn-0.10.2 | examples/xor_example.rb |