Class: CooCoo::CostFunctions::MeanSquare
- Defined in:
- lib/coo-coo/cost_functions.rb
Overview
Implements the mean square cost function. Its derivative is a simple difference between the target and actual output.
Class Method Summary collapse
Class Method Details
.call(target, x) ⇒ Object
47 48 49 50 |
# File 'lib/coo-coo/cost_functions.rb', line 47 def self.call(target, x) d = derivative(target, x) d * d * 0.5 end |
.derivative(target, x, y = nil) ⇒ Object
52 53 54 |
# File 'lib/coo-coo/cost_functions.rb', line 52 def self.derivative(target, x, y = nil) x - target end |