Practice
Solution
Step 1: Understand the purpose of normalization.
Normalization scales the data to a range of [0, 1] and is useful when data is on different scales.Step 2: Eliminate wrong options.
When the data follows a Gaussian distribution. is incorrect because standardization is preferred for Gaussian distributions. When the data contains outliers. is incorrect because normalization is sensitive to outliers. When the model is sensitive to variance. is incorrect because standardization handles variance better.Final Answer:
Option A -> Option AQuick Check:
Normalize for non-Gaussian, different scales. [OK]
import numpy as np
from sklearn.model_selection import train_test_split
X = np.array([[1, 2], [3, 4], [5, 6], [7, 8]])
y = np.array([0, 1, 0, 1])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
print(X_train.shape, X_test.shape)What is the output of this code snippet?Solution
Step 1: Understand train_test_split behavior.
With test_size=0.5, the data is split equally into train and test sets.Step 2: Calculate expected shapes.
Original data has 4 samples, so both train and test sets will have 2 samples each.Final Answer:
Option C -> Option CQuick Check:
Equal split with test_size=0.5. [OK]
Solution
Step 1: Identify the nature of the problem.
Predicting the next word in a sentence involves understanding context and patterns, which are complex and not easily defined by rules.Step 2: Eliminate rule-based problems.
Options A, C, and D are deterministic and can be solved with explicit algorithms.Final Answer:
Option A -> Option AQuick Check:
ML for patterns, rules for logic. [OK]
Solution
Step 1: Consider sample size constraints
With small sample sizes, non-parametric tests are more reliable as they do not assume normal distribution.Step 2: Eliminate inappropriate tests
Use a t-test assuming equal variances. assumes equal variances which may not hold. Use a z-test assuming normal distribution. assumes normal distribution, which is unreliable with small samples. Use a chi-squared test for independence. is for categorical data, not model comparison.Final Answer:
Option B -> Option BQuick Check:
Small samples? Use non-parametric tests [OK]
Solution
Step 1: Consider latency constraints.
Real-time systems require low-latency solutions.Step 2: Evaluate focal loss.
Focal loss can be integrated into the model without affecting real-time processing speed.Final Answer:
Option C -> Option CQuick Check:
Focal loss suits real-time needs. [OK]
