map('Rubix\ML\sigmoid'); } /** * Calculate the derivative of the activation. * * @internal * * @param Matrix $input * @param Matrix $output * @return Matrix */ public function differentiate(Matrix $input, Matrix $output) : Matrix { return $output->map([$this, '_differentiate']); } /** * @internal * * @param float $output * @return float */ public function _differentiate(float $output) : float { return $output * (1.0 - $output); } /** * Return the string representation of the object. * * @internal * * @return string */ public function __toString() : string { return 'Sigmoid'; } }