class CooCoo::CostFunctions::CrossEntropy
Implements the log cross-entropy cost function that is used with {ActivationFunctions::SoftMax} and {ActivationFunctions::ShiftedSoftMax}. This calls Math.log
on the network's output and multiples that by the target. Therefore good target values are 0...1
.
Public Class Methods
call(target, x)
click to toggle source
# File lib/coo-coo/cost_functions.rb, line 65 def self.call(target, x) -x.log * target end
derivative(target, x)
click to toggle source
# File lib/coo-coo/cost_functions.rb, line 69 def self.derivative(target, x) -target / x end