Practice set — Part 6 (Q41–Q48)
Fifty applied mathematics problems for AI & Data Science spanning high-dimensional vectors and cosine similarity, neural layer matrix transformations, multivariable calculus and gradient descent optimization, conditional probability and Bayes' theorem, probability distributions and maximum likelihood estimation (MLE), ordinary least squares linear regression, logistic regression and cross-entropy loss, and covariance matrices and Principal Component Analysis (PCA).
The Euclidean (\(L_2\)) norm of a vector \(\mathbf{v} = [v_x, v_y]^T\) is calculated as \(\|\mathbf{v}\|_2 = \sqrt{v_x^2 + v_y^2}\). For the given vector \(\mathbf{v}\) with components \(v_x = -3\) and \(v_y = 4\), the norm is: \(\|\mathbf{v}\|_2 = \sqrt{(-3)^2 + (4)^2} = \sqrt{9 + 16} = \sqrt{25} = 5\).
By the multiplication rule of conditional probability: \(P(\text{Defect} \cap \text{Positive}) = P(\text{Defect}) \times P(\text{Positive} | \text{Defect}) = 0.25 \times 0.90 = 0.2250\).
Compute partial derivatives: \(\frac{\partial L}{\partial w_1} = 2(2)w_1 = 4(2) = 8\); \(\frac{\partial L}{\partial w_2} = 2(3)w_2 = 6(-1) = -6\). Therefore, \(\nabla L = [8, -6]^T\).
Let D be the event that an individual has the disease, and P be the event that the individual tests positive.
We are given the following probabilities:
- Prior probability of having the disease: \(P(D) = \frac{1}{1000} = 0.001\)
- Prior probability of not having the disease: \(P(D^c) = 1 - P(D) = 1 - 0.001 = 0.999\)
- Sensitivity (true positive rate): \(P(P|D) = 0.99\)
- Specificity (true negative rate): \(P(P^c|D^c) = 0.95\)
From specificity, we can derive the false positive rate: \(P(P|D^c) = 1 - P(P^c|D^c) = 1 - 0.95 = 0.05\).
We want to find the probability that an individual actually has the disease given a positive test result, which is \(P(D|P)\). We can use Bayes' Theorem:
\[P(D|P) = \frac{P(P|D) P(D)}{P(P)}\]
To find \(P(P)\), the overall probability of testing positive, we can use the law of total probability:
\[P(P) = P(P|D) P(D) + P(P|D^c) P(D^c)\]
Substitute the given values:
\[P(P) = (0.99)(0.001) + (0.05)(0.999)\]
\[P(P) = 0.00099 + 0.04995\]
\[P(P) = 0.05094\]
Now, substitute \(P(P)\) back into Bayes' Theorem:
\[P(D|P) = \frac{(0.99)(0.001)}{0.05094}\]
\[P(D|P) = \frac{0.00099}{0.05094}\]
\[P(D|P) \approx 0.0194346\]
Therefore, the probability that a person who tests positive actually has the disease is approximately \(0.0194\), which is closest to \(0.019\).
Step 1 · Manhattan (\(L_1\)) Norm: Summing absolute coordinate magnitudes of \(\mathbf{w} = [10, -15]^T\) gives \(\|\mathbf{w}\|_1 = |10| + |-15| = 10 + 15 = 25\).
Step 2 · Euclidean (\(L_2\)) Norm: Taking the square root of the sum of squared components yields \(\|\mathbf{w}\|_2 = \sqrt{10^2 + (-15)^2} = \sqrt{100 + 225} = \sqrt{325} = 5\sqrt{13} \approx 18.03\) (confirming the universal norm inequality \(\|\mathbf{w}\|_2 \le \|\mathbf{w}\|_1\)).
Variance Decomposition & \(R^2\): In ordinary least-squares regression with an intercept, \(\text{SST} = \text{SSR} + \text{SSE}\), where \(\text{SSE} = \sum (y_i - \hat{y}_i)^2 = 20\) and \(\text{SST} = \sum (y_i - \bar{y})^2 = 100\).
The coefficient of determination measures the proportion of total target variance captured by the linear predictors: \[ R^2 = 1 - \frac{\text{SSE}}{\text{SST}} = 1 - \frac{20}{100} = 1 - 0.20 = 0.80 \; (80\%). \]
Confusion Matrix Evaluation: Total evaluated instances equal \(N = TP + TN + FP + FN = 70 + 40 + 10 + 10 = 130\), of which \(TP + TN = 70 + 40 = 110\) are classified into their true ground-truth label.
Therefore, overall classification accuracy is \[ \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} = \frac{110}{130} = \frac{11}{13} \approx 0.8462 \; (84.6\%). \]
Affine Dense Layer Parameter Count: For \(\mathbf{y} = \mathbf{W}\mathbf{x} + \mathbf{b}\) mapping \(\mathbf{x} \in \mathbb{R}^{50}\) to \(\mathbf{y} \in \mathbb{R}^{25}\), each of the \(25\) output neurons connects to all \(50\) inputs, giving \(\mathbf{W} \in \mathbb{R}^{25 \times 50}\) with \(25 \times 50 = 1250\) scalar weights.
Adding one independent bias parameter per output unit (\(\mathbf{b} \in \mathbb{R}^{25}\)) yields \(1250 + 25 = 1275\) total learnable parameters.
