Resilience and Active Inference