Sha256: f9cdf112536e43822b8f0d67fee829943ffc637ea79ae215a78a454ebe40a94a

Contents?: true

Size: 336 Bytes

Versions: 2

Compression:

Stored size: 336 Bytes

Contents

# -*- coding: utf-8 -*-

class Synapse
  @x #input
  @w #wichtung
  
  def initialize
    @w = 0.0
  end
  
  def fire
    return @x * @w if @x.is_a? Numeric
    return @x.a * @w if @x.is_a? Perceptron
  end
  
  def backpropagate error
    @w += (LEARNRATE * @x * error)
  end
  
  # Setter for Input
  def x= x
    @x = x
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
Santino-neurotic-0.0.0 lib/synapse.rb
Santino-neurotic-0.0.1 lib/synapse.rb