Practice set — Part 5 (Q33–Q40)
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 problem statement explicitly defines that the number of defective items, \(Y\), follows a Poisson distribution with a rate parameter \(\lambda = 3\). The rate parameter \(\lambda\) is a direct characteristic of the Poisson distribution that determines its mean and variance. Therefore, the value of \(\lambda\) is directly given as 3.
The problem asks for the predicted value \(\hat{y}\) given an independent variable value \(x=4\) and a linear regression equation \(\hat{y} = 3 + 2x\). We substitute the value of \(x\) into the equation:
\(\hat{y} = 3 + 2(4)\)
\(\hat{y} = 3 + 8\)
\(\hat{y} = 11\)
Therefore, the predicted value for the dependent variable is 11. Common errors might involve incorrectly multiplying 2 by 4 or incorrectly adding 3 to 8.
Since \(\mathbf{X}\) has \(22\) columns, \(\mathbf{X}^T\) is \(22 \times N\) and \(\mathbf{X}^T\mathbf{X}\) is \(22 \times 22\). Furthermore, \((\mathbf{X}^T\mathbf{X})^T = \mathbf{X}^T(\mathbf{X}^T)^T = \mathbf{X}^T\mathbf{X}\), proving it is always symmetric.
The output vector \(\mathbf{y}\) is computed by multiplying the weight matrix \(W\) by the input vector \(\mathbf{x}\). This is a standard matrix-vector multiplication.
\(\mathbf{y} = W\mathbf{x} = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \begin{pmatrix} 5 \\ 6 \end{pmatrix}\)
To compute the first element of \(\mathbf{y}\), we take the dot product of the first row of \(W\) with \(\mathbf{x}\): \((1)(5) + (2)(6) = 5 + 12 = 17\).
To compute the second element of \(\mathbf{y}\), we take the dot product of the second row of \(W\) with \(\mathbf{x}\): \((3)(5) + (4)(6) = 15 + 24 = 39\).
Therefore, the output vector is \(\mathbf{y} = \begin{pmatrix} 17 \\ 39 \end{pmatrix}\).
To find the resultant vector \(\mathbf{w} = \mathbf{u} + \mathbf{v}\), we add the corresponding components of the two vectors. \(\mathbf{w} = \begin{pmatrix} 3 \\ -2 \end{pmatrix} + \begin{pmatrix} -1 \\ 5 \end{pmatrix} = \begin{pmatrix} 3 + (-1) \\ -2 + 5 \end{pmatrix} = \begin{pmatrix} 2 \\ 3 \end{pmatrix}\).
For a Bernoulli likelihood \(L(p) = p^k (1-p)^{n-k}\), the log-likelihood is \(\ln L = k\ln p + (n-k)\ln(1-p)\). Setting derivative to zero: \(\frac{k}{p} - \frac{n-k}{1-p} = 0 \implies \hat{p} = \frac{k}{n} = \frac{15}{50} = 0.300\).
The quadratic loss function is defined as \(L(y, \hat{y}) = (y - \hat{y})^2\). Given the true value \(y = 3\) and the predicted value \(\hat{y} = 5\), we substitute these values into the loss function:
\(L(3, 5) = (3 - 5)^2\)
\(L(3, 5) = (-2)^2\)
\(L(3, 5) = 4\)
Therefore, the value of the loss function is 4.
The squared Euclidean norm of a vector \(\mathbf{v} = \begin{bmatrix} v_1 \\ v_2 \end{bmatrix}\) is given by \(\|\mathbf{v}\|^2 = v_1^2 + v_2^2\). For the given vector \(\mathbf{v} = \begin{bmatrix} 3 \\ -4 \end{bmatrix}\), the squared Euclidean norm is \((3)^2 + (-4)^2 = 9 + 16 = 25\).
