Skip to content
Permalink
0.0.1-alpha
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
29 lines (26 sloc) 637 Bytes
<?php
namespace Rubix\Engine\NeuralNetwork\ActivationFunctions;
class Heaviside implements ActivationFunction
{
/**
* Compute the output value.
*
* @param float $value
* @return float
*/
public function compute(float $value) : float
{
return $value >= 0.0 ? 1.0 : 0.0;
}
/**
* Calculate the partial derivative with respect to the computed output.
*
* @param float $value
* @param float $computed
* @return float
*/
public function differentiate(float $value, float $computed) : float
{
return $value === 0.0 ? 1.0 : 0.0;
}
}