Logistic sigmoid
Implement the logistic sigmoid function applied elementwise to a list of real numbers. Sigmoid(x) = 1 / (1 + exp(-x)). To avoid math range overflow for very negative inputs, use the equivalent stable form exp(x) / (1 + exp(x)) when x is negative. Return the list of outputs, each rounded to 6 decimal places. The input list may be empty (return an empty list).
Implement
sigmoid(xs: list[float]) → list[float]Examples
in
[[0]]out[0.5]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 12 min
solution.py
InputExpectedGot
[[0]][0.5]not run yetsample