0
0
Agentic_aiml~10 mins

Self-improving agents in Agentic Ai - Interactive Code Practice

Choose your learning style8 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Aevaluate
Bpredict
Cinitialize
Dupdate
Attempts:
3 left
2fill in blank
medium

Complete 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'
Ainitialize
Breset
Cupdate
Devaluate
Attempts:
3 left
3fill in blank
hard

Fix 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'
Aupdate
Bpredict
Ctrain
Devaluate
Attempts:
3 left
4fill in blank
hard

Fill 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'
Apredict
Bevaluate
Cconfidence_score
Dupdate
Attempts:
3 left
5fill in blank
hard

Fill 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'
Apredict
B>
Cupdate
Devaluate
Attempts:
3 left