Read the equation
The chain rule gives a factor of −(x−1), divided by the smoothing square root and the squared score denominator. For T>0 it is finite everywhere and equals zero at the target. This matches the C++ helper’s body and avoids the original score’s cusp.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| x | Activation value |
| T | Positive smoothing parameter |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
/**
* compute_phi_grad - Gradient of consciousness w.r.t. activation
*
* d(Phi)/dx = -sign(x-1) / (1 + |x-1|)^2
*
* For smooth version:
* d(Phi_smooth)/dx = -(x-1) / (sqrt((x-1)^2 + T) * (1 + sqrt((x-1)^2 + T))^2)
*
* @param activation The activation value
* @param temperature Smoothing temperature
* @return Gradient of phi w.r.t. activation
*/
inline double compute_phi_grad(double activation, double temperature = TEMPERATURE_DEFAULT) {
double diff = activation - 1.0;
double smooth_abs = std::sqrt(diff * diff + temperature);
double denom = 1.0 + smooth_abs;
return -diff / (smooth_abs * denom * denom);Exact original notation
d(Phi_smooth)/dx = -(x-1) / (sqrt((x-1)^2 + T) * (1 + sqrt((x-1)^2 + T))^2)