class TNN::FeedForwardNeuralNetwork::Node

Attributes

active_function[RW]
id[RW]
threshold[RW]
w[RW]

Public Class Methods

new(w = 0.0, active_function = "sig", threshold = 0.0) click to toggle source
# File lib/t_nn/feedforward_neural_network.rb, line 172
def initialize(w = 0.0, active_function = "sig", threshold = 0.0)
  @w = w 
  @threshold = threshold 
  @active_function = active_function
end

Public Instance Methods

input(w) click to toggle source

it can use input fase

# File lib/t_nn/feedforward_neural_network.rb, line 183
def input(w)
  @w = w
end
set_id(id) click to toggle source
# File lib/t_nn/feedforward_neural_network.rb, line 178
def set_id(id) 
  @id = id
end
sigmoid_fun(x, a=1) click to toggle source
# File lib/t_nn/feedforward_neural_network.rb, line 192
def sigmoid_fun(x, a=1)
  return (1.0/(1.0+Math.exp(-1.0 * a * x)))
end
update_w(input) click to toggle source
# File lib/t_nn/feedforward_neural_network.rb, line 187
def update_w(input)
  # update by sigmoid
  @w = sigmoid_fun(input)
end