#312Logistic regression — the sigmoid reflection identityEasyLinear RegressionLogistic RegressionActivation Functions
Logistic regression — the sigmoid reflection identity
Background
The sigmoid is point-symmetric about . Reflecting the score flips the probability to its complement:
This is exactly why : negating the logit gives you the other class's probability. The curve's centre at is the 0.5 decision threshold.
Problem statement
Implement sigmoid_reflection(z) that returns for each value in z.
Input
z— array-like of real-valued scores (logits).
Output
Returns an np.ndarray the same length as z, where element is .
Examples
Example 1
Input: z = [0, 2, -3]
Output: [0.5 0.11920292 0.95257413]
Explanation: ; ; .
Example 2
Input: z = [0]
Output: [0.5]
Explanation: the symmetry centre — and agree.
Constraints
- Return , which must equal elementwise.
- Vectorise over
z; no Python loop.
Notes
- Reading as is the bridge from last lesson's complement rule to this lesson's sigmoid — one identity ties them together.
Python
Loading...
▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.
- •Reference values
- •Sample mixed scores
- •Worked example single positive