class_docstr: Callback function for scheduling learning rate.
  
  .. versionadded:: 1.3.0
  
  Parameters
  ----------
  
  learning_rates :
      If it's a callable object, then it should accept an integer parameter
      `epoch` and returns the corresponding learning rate.  Otherwise it
      should be a sequence like list or tuple with the same size of boosting
      rounds.
class_docstr_tok: ["Callback","function","for","scheduling","learning","rate",".","..","versionadded",":",":","1.3.0","Parameters","--","--","--","--","--","learning_rates",":","If","it","'s","a","callable","object",",","then","it","should","accept","an","integer","parameter","`","epoch","`","and","returns","the","corresponding","learning","rate",".","Otherwise","it","should","be","a","sequence","like","list","or","tuple","with","the","same","size","of","boosting","rounds","."]
code: def __init__(
      self,
      learning_rates: Union[Callable[[int], float], Sequence[float]],
  ) -> None:
      if not callable(learning_rates) and not isinstance(
          learning_rates, collections.abc.Sequence
      ):
          raise TypeError(
              "Invalid learning rates, expecting callable or sequence, got: "
              f"{type(learning_rates)}"
          )
  
      if callable(learning_rates):
          self.learning_rates = learning_rates
      else:
          self.learning_rates = lambda epoch: cast(
              Sequence, learning_rates
          )[epoch]
      super().__init__()
  
imports: import collections
  import os
  import pickle
  from abc import ABC
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  import numpy
  from .None import collective
  from .core import Booster, DMatrix, XGBoostError, _parse_eval_str
label_desc: Use image node_id 1 to create a new LearningRateScheduler object from inherited base classes: TrainingCallback with example: obj = LearningRateScheduler(learning_rates)