Practice
from sklearn.linear_model import Ridge
import numpy as np
X = np.array([[1, 2], [3, 4], [5, 6]])
y = np.array([1, 2, 3])
model = Ridge(alpha=0.0)
model.fit(X, y)
print(model.coef_)What does this code output?Solution
Step 1: Understand the effect of alpha=0 in Ridge.
Setting alpha to zero in Ridge regression makes it equivalent to ordinary least squares.Step 2: Eliminate wrong options.
Alpha=0 does not cause an error. Zero coefficients would require L1 regularization. Random coefficients are incorrect as the model still fits the data.Final Answer:
Option B -> Option BQuick Check:
Alpha=0 in Ridge = OLS. [OK]
Solution
Step 1: Identify symptoms of overfitting
Overfitting occurs when a model performs well on training data but poorly on unseen data.Step 2: Determine the cause
A complex model with too many parameters relative to the data size is a common cause of overfitting.Final Answer:
Option B -> Option BQuick Check:
Complex models overfit small data. [OK]
Solution
Step 1: Identify the problem
Missing small objects often relates to anchor box size.Step 2: Analyze options
The model's anchor boxes are too large is correct because large anchor boxes can miss small objects. The learning rate is too high affects convergence, not detection size. The batch size is too small affects training stability, not object size. The model's confidence threshold is too low would increase false positives, not miss objects.Final Answer:
Option D -> Option DQuick Check:
Small objects need small anchors [OK]
Solution
Step 1: Understand Chain-of-Thought
Chain-of-Thought is best for tasks requiring complex reasoning.Step 2: Eliminate wrong options
When the task involves simple factual recall. is incorrect as factual recall doesn't need reasoning. When the model needs to be fine-tuned with a few examples. is about Few-Shot, not Chain-of-Thought. When the task requires generating creative content. is unrelated to reasoning.Final Answer:
Option B -> Option BQuick Check:
Use Chain-of-Thought for complex reasoning tasks. [OK]
Solution
Step 1: Consider latency constraints.
Embedded methods integrate feature selection into model training, optimizing for both accuracy and speed.Step 2: Eliminate wrong options.
Filter methods do not consider model performance. Wrapper methods and recursive feature elimination are too slow for real-time systems.Final Answer:
Option B -> Option BQuick Check:
Embedded = fast, integrated. [OK]
