Opening the Blackbox: Self-learning materials