2D materials show brain-like learning