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