Implement imitation learning, a type of reinforcement learning where an agent learns from a demonstration provided by an expert. **Example:** Consider a simple navigation task where an expert demonstrates how to navigate from a start state to a goal state. The goal is to learn a policy that mimics the expert's behavior. **Constraints:** Use NumPy for numerical computations and ensure the learned policy is close to the expert's policy.
Test Cases
Test Case 1
Input:
{"expert_policy": [0.5, 0.5], "env": "GridWorld", "max_episodes": 1000, "max_steps": 100}Expected:
[0.5, 0.5]Test Case 2
Input:
{"expert_policy": [0.7, 0.3], "env": "CartPole", "max_episodes": 1000, "max_steps": 100}Expected:
[0.7, 0.3]+ 3 hidden test cases