logistic_loss
std.optim.logistic_loss · Level L5Logistic regression's loss: the mean binary cross-entropy of the logits Xw against y, through bce_with_logits. Bind its gradient as @grad[f=std.optim.logistic_loss,wrt=w] and minimize_adam trains on the loss alone; NOVA derives the gradient by reverse mode.
Signature
logistic_loss(w: f64[d], X: f64[n, d], y: f64[n]) → f64[]
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size.
- Agrees with the reference
mean(t·log(1 + e^(−z)) + (1 − t)·log(1 + e^z)), z = Xwto 80 digits (100-digit arithmetic), on all 40 test cases. - All 40 float64 results inside the running error bound; the closest uses 32% of it.
- Interpreter and NumPy backend return bit-identical results.
- At float32 too: the 40 test cases rounded to float32, and 40 of them inside the running error bound at u = 2⁻²⁴; the closest uses 22% of it.
- correctly rounded (the float64 nearest the exact value)
- 68%
- bit-equal to the NumPy formula in float64
- 100%
- largest error, in units in the last place
- 1.25
Identity
sha256:3a29dc3f47e6791565fd9ecbb901649c42f7bd29fda5d63d54fa69a199d6d74bThe semantic hash of the graph. It changes when the program changes, and never when only its documentation does.
Control handle
- Symbol
- Ω:std.optim.logistic_loss · Ω:logistic_loss
- Pins
sha256:af50c553b03b6a4ec5c9f4aac87d519afb233df55f7e00aa1101ed32a43aad3athis graph and the 2 it reaches through calls- Evidence
sha256:0a7c0ca040765a82c39bb86a969927ce6f52e54f2ac1029ee7a69e53bb7f5498the hash of its verification record- Needs
- no capability: a pure function
Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.