Top Level Namespace

Includes:
CooCoo

Defined Under Namespace

Modules: CooCoo Classes: Array, Enumerator, File, Numeric, Object

Constant Summary collapse

WIDTH =
16
HEIGHT =
16
SIZE =

1024 * 1024 * 1

10
RotationSteps =
7.0
X_STEP =
4
Y_STEP =
4
CONV_WIDTH =
4
CONV_HEIGHT =
4
CONV_OUT_WIDTH =
1
CONV_OUT_HEIGHT =
1
INPUT_SIZE =
layer.num_inputs
OUT_WIDTH =
layer.output_width
OUT_HEIGHT =
layer.output_height
OUTPUT_SIZE =
layer.size
HI =
<<-EOT
\ePq
\#0;2;0;0;0\#1;2;100;0;0\#2;2;0;100;0
\#1~~@@vv@@~~@@~~$
\#2??}}GG}}??}}??-
\#1!14@
\e\\
EOT
INPUT_LENGTH =
2
OUTPUT_LENGTH =
2
SEQUENCE_LENGTH =
ENV.fetch('SEQUENCE_LENGTH', 6).to_i
HIDDEN_LENGTH =
10
RECURRENT_LENGTH =

boosts the signal

SEQUENCE_LENGTH * 4
DELAY =
ENV.fetch('DELAY', 2).to_i
SINGLE_LAYER =
(ENV.fetch('SINGLE_LAYER', 'true') == "true")

Constants included from CooCoo

CooCoo::VERSION, CooCoo::Vector

Instance Method Summary collapse

Methods included from CooCoo

debug, default_activation, root

Instance Method Details

#cost(net, expecting, outputs) ⇒ Object



214
215
216
217
218
# 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) ⇒ Object



150
151
152
153
154
155
156
157
158
159
# 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) ⇒ Object

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



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# 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


229
230
231
232
233
# File 'lib/coo-coo/image.rb', line 229

def print_image(img)
  img.height.times do |y|
    puts(img.to_a[y].collect { |c| (c > 0.5)? 'X' : '.' }.join)
  end
end

#training_setObject



192
193
194
# File 'lib/coo-coo/data_sources/xournal/bitmap_stream.rb', line 192

def training_set
  CooCoo::DataSources::Xournal::BitmapStream.new(@options.to_h)
end