Learning with frequency