Anomaly detection using state‐space models and reinforcement learning