Practice
Solution
Step 1: Identify the core requirement
The first step in framing a business problem as an ML problem is to clearly define the business objective. Without a clear objective, the ML model cannot be aligned with business goals.Step 2: Eliminate wrong options
Selecting the right algorithm is incorrect because algorithm selection comes after defining the problem. Collecting as much data as possible is incorrect because data collection should be guided by the problem definition. Ensuring high computational resources is incorrect because computational resources are a consideration after the problem is defined.Final Answer:
Option D -> Option DQuick Check:
Start with a clear business goal. [OK]
Solution
Step 1: Understand the decision boundary.
The decision boundary in logistic regression is where the predicted probability is 0.5, indicating equal likelihood of either class.Step 2: Eliminate wrong options.
The point where the model's accuracy is maximized. is incorrect because accuracy is not directly related to the decision boundary. The line that separates the data into two equal parts. is incorrect as it describes a median, not a decision boundary. The point where the loss function is minimized. is incorrect because the loss function is minimized during training, not at the decision boundary.Final Answer:
Option D -> Option DQuick Check:
Decision boundary = probability 0.5 [OK]
import torch
Q = torch.rand(2, 3, 4)
K = torch.rand(2, 4, 4)
V = torch.rand(2, 4, 5)
output = torch.matmul(torch.matmul(Q, K.transpose(-2, -1)), V)Solution
Step 1: Analyze matrix multiplications
The first multiplicationtorch.matmul(Q, K.transpose(-2, -1))results in a shape of (2, 3, 4). The second multiplication with V results in (2, 3, 5).Step 2: Eliminate wrong options
(2, 4, 5) is incorrect because it assumes incorrect dimensions for Q. (2, 3, 4) is incorrect because it doesn't account for the final multiplication with V. (2, 5, 5) is incorrect because it assumes incorrect dimensions for the final output.Final Answer:
Option D -> Option DQuick Check:
Check matrix dimensions after each multiplication. [OK]
Solution
Step 1: Identify the role of feature scaling in PCA
PCA is sensitive to the scale of the data.Step 2: Evaluate each option
Missing values would cause errors, not low variance. Too many components would explain more variance, not less. A small dataset affects generalization, not variance explained.Final Answer:
Option C -> Option CQuick Check:
Standardize features before PCA [OK]
Solution
Step 1: Addressing class imbalance.
Applying class weights helps logistic regression focus more on the minority class by penalizing misclassifications more heavily.Step 2: Eliminate wrong options.
Use a higher learning rate to speed up convergence. is incorrect as learning rate affects convergence speed, not class balance. Increase the number of iterations to ensure convergence. is incorrect because more iterations don't address imbalance. Use a linear kernel to transform the feature space. is incorrect as logistic regression doesn't use kernels.Final Answer:
Option C -> Option CQuick Check:
Use class weights for imbalance [OK]
