class Object

Constants

CONV_HEIGHT
CONV_OUT_HEIGHT
CONV_OUT_WIDTH
CONV_WIDTH
DELAY
HEIGHT
HI
HIDDEN_LENGTH
INPUT_LENGTH
INPUT_SIZE
OUTPUT_LENGTH
OUTPUT_SIZE
OUT_HEIGHT
OUT_WIDTH
RECURRENT_LENGTH
RotationSteps
SEQUENCE_LENGTH
SINGLE_LAYER
SIZE
WIDTH
X_STEP
Y_STEP

Public Class Methods

define_once(method, &definition) click to toggle source
# File lib/coo-coo/core_ext.rb, line 26
def self.define_once(method, &definition)
  unless instance_defines?(method)
    define_method(method, &definition)
  end
end
delegate(*args) click to toggle source
# File lib/coo-coo/core_ext.rb, line 32
def self.delegate(*args)
  opts = args.pop
  
  args.each do |meth|
    define_method(meth) do |*a|
      send(opts[:to]).send(meth, *a)
    end
  end
end
instance_defines?(method) click to toggle source
# File lib/coo-coo/core_ext.rb, line 22
def self.instance_defines?(method)
  instance_methods.include?(method)
end

Public Instance Methods

cost(net, expecting, outputs) click to toggle source
# File lib/coo-coo/temporal_network.rb, line 214
def cost(net, expecting, outputs)
  CooCoo::Sequence[outputs.zip(expecting).collect do |output, target|
    CooCoo::CostFunctions::MeanSquare.derivative(net.prep_output_target(target), output.last)
  end]
end
mark_random(v) click to toggle source
# File lib/coo-coo/temporal_network.rb, line 150
def mark_random(v)
  bingo = rand < 0.1
  if bingo
    v = v.dup
    v[0] = 1.0
    return v, true
  else
    return v, false
  end
end
matrix_image(m, width) click to toggle source

input = (input - 0.5) * 2.0 target = (target - 0.5) * 2.0

# File lib/coo-coo/convolution.rb, line 245
def matrix_image(m, width)
  puts("matrix image #{width}")
  s = m.to_a.each_slice(width).collect do |line|
    line.collect do |c|
      if c > 0.75
        '#'
      elsif c > 0.5
        'X'
      elsif c > 0.25
        'x'
      elsif c >= 0.0
        '.'
      elsif c >= -0.5
        '-'
      else
        '~'
      end
    end.join
  end.join("\n")
end
print_image(img) click to toggle source
training_set() click to toggle source
# File lib/coo-coo/data_sources/xournal/bitmap_stream.rb, line 192
def training_set
  CooCoo::DataSources::Xournal::BitmapStream.new(@options.to_h)
end