Class: BackPropogation::ComputationalGates::DivGate
- Defined in:
- lib/ml_algorithms.rb
Instance Attribute Summary collapse
-
#in_frst ⇒ Object
Returns the value of attribute in_frst.
-
#in_scnd ⇒ Object
Returns the value of attribute in_scnd.
Attributes inherited from CompGate
Instance Method Summary collapse
- #backward_pass ⇒ Object
- #connect(f_n, s_n) ⇒ Object
- #forward_pass ⇒ Object
-
#initialize(name) ⇒ DivGate
constructor
A new instance of DivGate.
Constructor Details
#initialize(name) ⇒ DivGate
Returns a new instance of DivGate.
162 163 164 |
# File 'lib/ml_algorithms.rb', line 162 def initialize(name) super(name) end |
Instance Attribute Details
#in_frst ⇒ Object
Returns the value of attribute in_frst.
161 162 163 |
# File 'lib/ml_algorithms.rb', line 161 def in_frst @in_frst end |
#in_scnd ⇒ Object
Returns the value of attribute in_scnd.
161 162 163 |
# File 'lib/ml_algorithms.rb', line 161 def in_scnd @in_scnd end |
Instance Method Details
#backward_pass ⇒ Object
174 175 176 177 |
# File 'lib/ml_algorithms.rb', line 174 def backward_pass() @in_frst.bckwrd = @bckwrd * ((-1)/(@in_scnd.frwrd ** 2)) @in_scnd.bckwrd = @bckwrd * ((-1)/(@in_frst.frwrd ** 2)) end |
#connect(f_n, s_n) ⇒ Object
165 166 167 168 169 170 |
# File 'lib/ml_algorithms.rb', line 165 def connect(f_n,s_n) @in_frst = f_n @in_scnd = s_n f_n.out = self s_n.out = self end |
#forward_pass ⇒ Object
171 172 173 |
# File 'lib/ml_algorithms.rb', line 171 def forward_pass() @frwrd = @in_frst.frwrd / @in_scnd.frwrd end |