Practice
import numpy as np
class ContinualLearner:
def __init__(self):
self.model = None
def update(self, new_data):
if self.model is None:
self.model = new_data
else:
self.model += new_data
learner = ContinualLearner()
learner.update(np.array([1, 2, 3]))
learner.update(np.array([4, 5, 6]))
print(learner.model)What does this code output?Solution
Step 1: Understand the update mechanism.
The code initializes the model with the first data and adds subsequent data to it.Step 2: Calculate the output.
First update sets model to [1, 2, 3]. Second update adds [4, 5, 6], resulting in [5, 7, 9].Final Answer:
Option A -> Option AQuick Check:
First set, then add. [OK]
import numpy as np
data = np.array([1, 2, 3, 4, 5])
# Simulate offline data processing
processed_data = data * 2
print(processed_data)Solution
Step 1: Understand the code operation
The code multiplies each element of the array by 2.Step 2: Calculate the expected output
Each element in the array [1, 2, 3, 4, 5] is multiplied by 2, resulting in [2, 4, 6, 8, 10].Final Answer:
Option B -> Option BQuick Check:
Array * 2 doubles each element. [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: 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: Understand the graph dynamics
Dynamic graphs require models that can adapt to changes in nodes and edges.Step 2: Evaluate each approach
Static GCNs and fixed adjacency matrices cannot adapt to changes, and RNNs are not designed for graph structures.Final Answer:
Option A -> Option AQuick Check:
Dynamic GNNs adapt to graph changes. [check]
