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
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
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
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
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
