Machine-learned models for magnetic materials