Sha256: 82487d23bff472aa5ead0bbaee4339c4445e2766416f08eae4e6a3d66bcf2729
Contents?: true
Size: 425 Bytes
Versions: 24
Compression:
Stored size: 425 Bytes
Contents
require "dnn" include DNN::Models include DNN::Layers include DNN::Optimizers include DNN::Losses x = Numo::SFloat[[0, 0], [1, 0], [0, 1], [1, 1]] y = Numo::SFloat[[0], [1], [1], [0]] model = Sequential.new model << InputLayer.new(2) model << Dense.new(16) model << ReLU.new model << Dense.new(1) model.setup(SGD.new, SigmoidCrossEntropy.new) model.train(x, y, 20000, batch_size: 4, verbose: false) p model.predict(x)
Version data entries
24 entries across 24 versions & 1 rubygems
Version | Path |
---|---|
ruby-dnn-0.14.3 | examples/xor_example.rb |
ruby-dnn-0.14.2 | examples/xor_example.rb |
ruby-dnn-0.14.1 | examples/xor_example.rb |
ruby-dnn-0.14.0 | examples/xor_example.rb |