Learning temporal and structural credit assignments for reinforcement learning and experimental design