Logistic Regression Sigmoid

Medium
machine-learning Meta Google

Implement the sigmoid function and a prediction function for logistic regression. Given weights, bias, and a feature vector, return the probability (sigmoid of the dot product plus bias).

Example

logistic_predict([0.5, -0.3], 0.1, [2.0, 1.0])
# => 0.6224593312018546  (sigmoid(0.5*2.0 + (-0.3)*1.0 + 0.1))

Test Cases

Python Editor

Output

Click "Run" to see results...