Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a self-improving agent class with an update method.
Agentic AI
class SelfImprovingAgent: def __init__(self, model): self.model = model def [1](self, data): # Improve the model using new data self.model.train(data)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'predict' instead of 'update' because prediction does not improve the model.
Using 'initialize' which is for setup, not improvement.
✗ Incorrect
The method to improve or refine the agent's model is typically called 'update'.
2fill in blank
mediumComplete the code to make the agent improve itself by retraining on its own predictions.
Agentic AI
def self_improve(agent, data): predictions = agent.predict(data) agent.[1](predictions)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'initialize' which resets the model instead of improving it.
Using 'evaluate' which only measures performance.
✗ Incorrect
The agent should update its model using the predictions to improve itself.
3fill in blank
hardFix the error in the code to correctly implement a self-improving loop.
Agentic AI
for epoch in range(10): predictions = agent.predict(data) agent.[1](predictions) loss = agent.evaluate(data) print(f"Epoch {epoch}: Loss = {loss}")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'predict' which does not change the model.
Using 'evaluate' which only measures performance.
✗ Incorrect
The agent should update its model with predictions to improve, not predict again.
4fill in blank
hardFill both blanks to create a dictionary comprehension that maps data points to their improved predictions.
Agentic AI
improved_predictions = {point: agent.[1](point) for point in data if agent.[2](point) > 0.5} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'update' in the comprehension which changes the model instead of predicting.
Using 'evaluate' which returns overall loss, not per data point score.
✗ Incorrect
We predict for each point and filter by confidence_score greater than 0.5.
5fill in blank
hardFill all three blanks to implement a self-improving agent loop that predicts, filters, and updates.
Agentic AI
for data_point in dataset: prediction = agent.[1](data_point) if prediction [2] 0.7: agent.[3]([data_point])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'evaluate' instead of 'update' to improve the model.
Using '<' instead of '>' which reverses the condition.
✗ Incorrect
The agent predicts, checks if prediction is greater than 0.7, then updates with that data point.
