Practice
1.
import numpy as np
from sklearn.neighbors import NearestNeighbors
X = np.array([[1, 2], [3, 4], [5, 6]])
knn = NearestNeighbors(n_neighbors=2)
knn.fit(X)
distances, indices = knn.kneighbors([[1, 2]])
print(indices)What does this code output?easy
Solution
Step 1: Understand kneighbors output
The code finds the 2 nearest neighbors of [1, 2] in X.Step 2: Calculate distances
[1, 2] is closest to itself (index 0) and then to [3, 4] (index 1).Final Answer:
Option C -> Option CQuick Check:
Self is always nearest. [OK]
Hint: Self is always nearest. [OK]
Common Mistakes:
2. In the context of model debugging, which of the following is a common symptom of data leakage?
easy
Solution
Step 1: Identify data leakage symptoms
Data leakage often results in a model that performs well on both training and validation sets because it has inadvertently learned from the validation data.Step 2: Eliminate wrong options
Options A, B, and C indicate poor generalization or overfitting, not data leakage.Final Answer:
Option D -> Option DQuick Check:
Data leakage = too good to be true [OK]
Hint: Data leakage = too good to be true [OK]
Common Mistakes:
3. A model using RAG prompting is producing irrelevant information. What is the most likely cause?
medium
Solution
Step 1: Analyze RAG prompting
RAG relies on retrieving relevant documents to generate accurate responses.Step 2: Eliminate wrong options
The model is not trained on enough data. is incorrect as training data size is unrelated to retrieval. The prompt is too short. is incorrect because prompt length doesn't affect retrieval. The model's architecture is outdated. is unrelated to the issue.Final Answer:
Option A -> Option AQuick Check:
Irrelevant info? Check retrieval component in RAG. [OK]
Hint: Irrelevant info? Check retrieval component in RAG. [OK]
Common Mistakes:
4. You are tasked with designing a segmentation system for autonomous vehicles that must handle both object detection and segmentation efficiently. Which approach would you choose and why?
hard
Solution
Step 1: Determine system requirements
Autonomous vehicles need both object detection and detailed scene understanding.Step 2: Evaluate segmentation approaches
Semantic lacks instance detail, instance lacks semantic context, object detection is not segmentation.Final Answer:
Option B -> Option BQuick Check:
Panoptic = Comprehensive scene understanding [OK]
Hint: Panoptic = Comprehensive scene understanding [OK]
Common Mistakes:
5. You are designing a system to predict stock prices using both historical and real-time data. Which approach best integrates these data sources effectively?
hard
Solution
Step 1: Identify the need for integration
A hybrid system allows for leveraging the strengths of both historical and real-time data.Step 2: Evaluate the options
Use a batch processing system to handle both data types simultaneously. does not effectively integrate real-time updates. Train separate models for historical and real-time data and average their predictions. may lead to inconsistent predictions. Rely solely on real-time data for predictions to ensure up-to-date results. ignores valuable historical data.Final Answer:
Option A -> Option AQuick Check:
Hybrid systems leverage both data types effectively. [OK]
Hint: Hybrid systems leverage both data types effectively. [OK]
Common Mistakes:
