Statistical methods for task detection in lifelong reinforcement learning