import numpy as np
# Given vectors
x = np.array([1, 2])
w = np.array([0.5, 1.0])
# 1. Compute z = w^T x
z = np.dot(w, x)
# 2. Compute sigmoid(z)
def sigmoid(z):
return 1 / (1 + np.exp(-z))
sigma_z = sigmoid(z)
print("z =", z)
print("sigma(z) =", sigma_z)
Output:
z = 2.5
sigma(z) = 0.9241418199787566
1. Predicting if a bank transaction is fraud (yes/no)
✅ Suitable for Logistic Regression
Why: This is a binary classification problem (fraud or not fraud), which is exactly what logistic regression is designed for.
---
2. Predicting the price of a used car
❌ Not Suitable for Logistic Regression
Why: This is a regression problem with a continuous numeric output (price). Linear regression or other regression algorithms are more appropriate.
---
3. Predicting if a student will pass or fail based on hours studied
✅ Suitable for Logistic Regression
Why: This is a binary classification task (pass or fail), and logistic regression works well when the outcome is categorical and binary.