Practice set — Part 1 (Q1–Q8)
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).
By Bayes' Rule: \(P(A|+) = \frac{P(+|A)P(A)}{P(+|A)P(A) + P(+|\neg A)P(\neg A)} = \frac{0.95 \times 0.02}{0.95(0.02) + 0.05(0.98)} = \frac{0.0190}{0.0680} = 0.279\).
Final Answer: \(0.279\)
Constant ratio per unit step is \(b = \frac{2}{1} = 2\), so \(E(3) = 4 \cdot 2 = 8\). Verification: confirm row, axis scale, and boundary values directly from the visual and check intermediate arithmetic. Final Answer: \(8\)
The log-likelihood \(\ln L(\mu) = -\frac{n}{2}\ln(2\pi\sigma^2) - \frac{1}{2\sigma^2}\sum (x_i - \mu)^2\). Setting \(\frac{\partial \ln L}{\partial \mu} = 0\) yields the sample mean \(\hat{\mu} = \frac{1}{n}\sum x_i = \frac{36}{12} = 3\).
Final Answer: \(\hat{\mu}_{\text{MLE}} = 3\)
Analytical Gradient Calculation: Differentiating the quadratic scalar loss \(L(w) = 6w^2 - 8w + 5\) with respect to \(w\) gives \(L'(w) = 12w - 8\). Notice \(L''(w) = 12 > 0\), confirming strict convexity with global minimizer \(w^* = \frac{2}{3}\).
Evaluating at \(w = 10\) yields \(\nabla L(10) = 12(10) - 8 = 120 - 8 = 112\) (indicating \(L\) increases steeply to the right, so gradient descent steps in the negative direction toward \(w^* = \frac{2}{3}\)).
Final Answer: \(\nabla L(10) = 112\)
The OLS slope is \(\hat{\beta}_1 = \frac{\text{Cov}(x, y)}{\text{Var}(x)} = \frac{36}{12} = 3\). The intercept is \(\hat{\beta}_0 = \bar{y} - \hat{\beta}_1\bar{x} = 35 - (3)(5) = 35 - 15 = 20\).
Final Answer: \(\hat{\beta}_1 = 3, \; \hat{\beta}_0 = 20\)
Precision is the fraction of predicted positive instances that are truly positive: \(\text{Precision} = \frac{TP}{TP + FP} = \frac{120}{120 + 40} = \frac{120}{160} = 75.0\%\).
Final Answer: \(75.0\%\)
The logistic regression model gives the probability of belonging to class 1 as \(p(x) = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x_1 + \beta_2 x_2)}}\). The classification boundary is the set of points where \(p(x) = 0.5\).
Setting \(p(x) = 0.5\), we have:
\(0.5 = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x_1 + \beta_2 x_2)}}\)
This implies:
\(1 + e^{-(\beta_0 + \beta_1 x_1 + \beta_2 x_2)} = 2\)
Therefore:
\(e^{-(\beta_0 + \beta_1 x_1 + \beta_2 x_2)} = 1\)
Taking the natural logarithm of both sides:
\(-(\beta_0 + \beta_1 x_1 + \beta_2 x_2) = \ln(1)\)
Since \(\ln(1) = 0\), we get:
\(\beta_0 + \beta_1 x_1 + \beta_2 x_2 = 0\)
This is the equation of the linear decision boundary.
Substitute the given parameter values: \(\beta_0 = -3\), \(\beta_1 = 1\), and \(\beta_2 = -2\).
\(-3 + x_1 + (-2) \cdot x_2 = 0\)
\(-3 + x_1 - 2x_2 = 0\)
We need to express this in the form \(x_2 = f(x_1)\).
\(2x_2 = x_1 - 3\)
\(x_2 = \frac{1}{2} x_1 - \frac{3}{2}\)
The area of the original triangle with vertices \(A = (1, 0)\), \(B = (0, 1)\), and \(C = (1, 1)\) can be calculated. We can use the determinant formula for the area of a triangle given its vertices \((x_1, y_1), (x_2, y_2), (x_3, y_3)\): Area = \(\frac{1}{2} |x_1(y_2 - y_3) + x_2(y_3 - y_1) + x_3(y_1 - y_2)|\).
Plugging in the coordinates: Area = \(\frac{1}{2} |1(1 - 1) + 0(1 - 0) + 1(0 - 1)| = \frac{1}{2} |0 + 0 - 1| = \frac{1}{2}\).
A linear transformation represented by a matrix \(M\) scales the area of a 2D shape by the absolute value of the determinant of the matrix \(M\). The determinant of \(M = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix}\) is \(\det(M) = (3 \times 3) - (1 \times 1) = 9 - 1 = 8\). The absolute value is \(|8| = 8\).
Therefore, the area of the transformed triangle \(A'B'C'\) is the original area multiplied by the determinant: Area(\(A'B'C'\)) = \(\frac{1}{2} \times 8 = 4\).
This area is then passed through a ReLU activation function \(f(x) = \max(0, x)\). Since the area is 4, which is positive, the ReLU function will return the value itself: \(f(4) = \max(0, 4) = 4\).
Thus, the final output value is 4.
Final Answer: \(4\)
