Practice
import torch
from torchvision.models.detection import yolo_v3
model = yolo_v3(pretrained=True)
model.eval()
input_tensor = torch.rand(1, 3, 416, 416)
output = model(input_tensor)
print(output[0]['boxes'].shape)Solution
Step 1: Understand YOLO output
YOLO outputs a list of detections, each with a bounding box of 4 coordinates.Step 2: Determine output shape
The shape is (N, 4) where N is the number of detected objects.Final Answer:
Option B -> Option BQuick Check:
YOLO boxes = (N, 4) [OK]
import numpy as np
coefficients = np.array([0.5, -0.25])
features = np.array([2, 3])
log_odds = np.dot(coefficients, features)
print(log_odds)Solution
Step 1: Calculate the dot product.
The dot product is calculated as (0.5 * 2) + (-0.25 * 3) = 1.0 - 0.75 = 0.25.Step 2: Identify the correct output.
-0.25 is correct because the calculation results in 0.25. 1.25 is incorrect as it suggests a miscalculation. 0.25 is incorrect due to a sign error. 2.75 is incorrect due to a misunderstanding of dot product.Final Answer:
Option A -> Option AQuick Check:
Dot product = sum of products [OK]
Solution
Step 1: Identify LightGBM's strengths
LightGBM is optimized for speed and performance on large datasets with high dimensionality.Step 2: Eliminate wrong options
When you need better accuracy on small datasets. is incorrect because XGBoost often performs better on small datasets. When interpretability of the model is the primary concern. is incorrect because neither LightGBM nor XGBoost is particularly interpretable. When you require a model that handles categorical features natively. is incorrect because both can handle categorical features, but LightGBM is faster on large datasets.Final Answer:
Option A -> Option AQuick Check:
LightGBM = Large, high-dimensional data [OK]
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]
Solution
Step 1: Analyze the symptoms
Underperformance on complex tasks often indicates a lack of capacity to capture hierarchical features, suggesting the network might be too shallow.Step 2: Eliminate wrong options
The network is too deep, causing overfitting. is incorrect because overfitting would show high training accuracy. The learning rate is too high, causing divergence. is incorrect because divergence would cause erratic loss. The batch size is too small, causing slow convergence. is incorrect because slow convergence would not cause underperformance if training is complete.Final Answer:
Option D -> Option DQuick Check:
Shallow networks miss hierarchies. [OK]
