class_docstr: ```
  Abstract class used to tune and train Keras models. The fit method is
  an abstract method and must be implemented by subclasses.
  ```
class_docstr_tok: ["``","`","Abstract","class","used","to","tune","and","train","Keras","models",".","The","fit","method","is","an","abstract","method","and","must","be","implemented","by","subclasses",".","``","`"]
docstr: ```
  Train model using a version of Leslie Smith's 1cycle policy.
  This method can be used with any optimizer. Thus,
  cyclical momentum is not currently implemented.
  
  Args:
      lr (float): (maximum) learning rate.
                 It is recommended that you estimate lr yourself by
                 running lr_finder (and lr_plot) and visually inspect plot
                 for dramatic loss drop.
      epochs (int): Number of epochs.  Number of epochs
      checkpoint_folder (string): Folder path in which to save the model weights
                                  for each epoch.
                                  File name will be of the form:
                                  weights-{epoch:02d}-{val_loss:.2f}.hdf5
      cycle_momentum (bool):    If True and optimizer is Adam, Nadam, or Adamax, momentum of
                                optimzer will be cycled between 0.95 and 0.85 as described in
                                https://arxiv.org/abs/1803.09820.
                                Only takes effect if Adam, Nadam, or Adamax optimizer is used.
      max_momentum(float): Maximum momentum to use if cycle_momentum=True
      min_momentum(float): minimum momentum to use if cycle_momentum=True
      class_weight (dict):       Optional dictionary mapping class indices (integers) to a weight (float)
      callbacks (list): list of Callback instances to employ during training
      steps_per_epoch(int):    Steps per epoch. If None, then, math.ceil(num_samples/batch_size) is used.
                               Ignored unless training dataset is generator.
      verbose (bool):  verbose mode
  ```
docstr_tok: ["``","`","Train","model","using","a","version","of","Leslie","Smith","'s","1cycle","policy",".","This","method","can","be","used","with","any","optimizer",".","Thus",",","cyclical","momentum","is","not","currently","implemented",".","Args",":","lr","(","float",")",":","(","maximum",")","learning","rate",".","It","is","recommended","that","you","estimate","lr","yourself","by","running","lr_finder","(","and","lr_plot",")","and","visually","inspect","plot","for","dramatic","loss","drop",".","epochs","(","int",")",":","Number","of","epochs",".","Number","of","epochs","checkpoint_folder","(","string",")",":","Folder","path","in","which","to","save","the","model","weights","for","each","epoch",".","File","name","will","be","of","the","form",":","weights-","{","epoch:02d","}","-","{","val_loss",":",".2f","}",".hdf5","cycle_momentum","(","bool",")",":","If","True","and","optimizer","is","Adam",",","Nadam",",","or","Adamax",",","momentum","of","optimzer","will","be","cycled","between","0.95","and","0.85","as","described","in","https",":","\/\/arxiv.org\/abs\/1803.09820",".","Only","takes","effect","if","Adam",",","Nadam",",","or","Adamax","optimizer","is","used",".","max_momentum","(","float",")",":","Maximum","momentum","to","use","if","cycle_momentum=True","min_momentum","(","float",")",":","minimum","momentum","to","use","if","cycle_momentum=True","class_weight","(","dict",")",":","Optional","dictionary","mapping","class","indices","(","integers",")","to","a","weight","(","float",")","callbacks","(","list",")",":","list","of","Callback","instances","to","employ","during","training","steps_per_epoch","(","int",")",":","Steps","per","epoch",".","If","None",",","then",",","math.ceil","(","num_samples\/batch_size",")","is","used",".","Ignored","unless","training","dataset","is","generator",".","verbose","(","bool",")",":","verbose","mode","``","`"]
code: def fit_onecycle(
      self,
      lr,
      epochs,
      checkpoint_folder=None,
      cycle_momentum=True,
      max_momentum=0.95,
      min_momentum=0.85,
      class_weight=None,
      callbacks=[],
      steps_per_epoch=None,
      verbose=1,
  ):
      """
      ```
      Train model using a version of Leslie Smith's 1cycle policy.
      This method can be used with any optimizer. Thus,
      cyclical momentum is not currently implemented.
  
      Args:
          lr (float): (maximum) learning rate.
                     It is recommended that you estimate lr yourself by
                     running lr_finder (and lr_plot) and visually inspect plot
                     for dramatic loss drop.
          epochs (int): Number of epochs.  Number of epochs
          checkpoint_folder (string): Folder path in which to save the model weights
                                      for each epoch.
                                      File name will be of the form:
                                      weights-{epoch:02d}-{val_loss:.2f}.hdf5
          cycle_momentum (bool):    If True and optimizer is Adam, Nadam, or Adamax, momentum of
                                    optimzer will be cycled between 0.95 and 0.85 as described in
                                    https://arxiv.org/abs/1803.09820.
                                    Only takes effect if Adam, Nadam, or Adamax optimizer is used.
          max_momentum(float): Maximum momentum to use if cycle_momentum=True
          min_momentum(float): minimum momentum to use if cycle_momentum=True
          class_weight (dict):       Optional dictionary mapping class indices (integers) to a weight (float)
          callbacks (list): list of Callback instances to employ during training
          steps_per_epoch(int):    Steps per epoch. If None, then, math.ceil(num_samples/batch_size) is used.
                                   Ignored unless training dataset is generator.
          verbose (bool):  verbose mode
      ```
      """
      if not self._is_adamlike() and cycle_momentum:
          warnings.warn(
              "cyclical momentum has been disabled because "
              + 'optimizer is not "Adam-like" with beta_1 param'
          )
          cycle_momentum = False
  
      num_samples = U.nsamples_from_data(self.train_data)
      if steps_per_epoch is None:
          steps_per_epoch = math.ceil(num_samples / self.batch_size)
  
      # setup callbacks for learning rates and early stopping
      if not callbacks:
          kcallbacks = []
      else:
          kcallbacks = callbacks[:]
      if cycle_momentum:
          max_momentum = max_momentum
          min_momentum = min_momentum
      else:
          max_momentum = None
          min_momentum = None
  
      from .lroptimize.triangular import CyclicLR
  
      clr = CyclicLR(
          base_lr=lr / 10,
          max_lr=lr,
          step_size=math.ceil((steps_per_epoch * epochs) / 2),
          reduce_on_plateau=0,
          max_momentum=max_momentum,
          min_momentum=min_momentum,
          verbose=verbose,
      )
      kcallbacks.append(clr)
  
      # start training
      policy = "onecycle"
      U.vprint("\n", verbose=verbose)
      U.vprint(
          "begin training using %s policy with max lr of %s..."
          % (policy, lr),
          verbose=verbose,
      )
      hist = self.fit(
          lr,
          epochs,
          early_stopping=None,
          checkpoint_folder=checkpoint_folder,
          verbose=verbose,
          class_weight=class_weight,
          callbacks=kcallbacks,
          steps_per_epoch=steps_per_epoch,
      )
      hist.history["lr"] = clr.history["lr"]
      hist.history["iterations"] = clr.history["iterations"]
      if cycle_momentum:
          hist.history["momentum"] = clr.history["momentum"]
      self.history = hist
      return hist
  
imports: from .None import utils
  from .graph.predictor import LinkPredictor, NodePredictor
  from .graph.preprocessor import LinkPreprocessor, NodePreprocessor
  from .imports import *
  from .lroptimize.lrfinder import *
  from .tabular.predictor import TabularPredictor
  from .tabular.preprocessor import TabularPreprocessor
  from .text.ner.predictor import NERPredictor
  from .text.ner.preprocessor import NERPreprocessor
  from .text.predictor import TextPredictor
  from .text.preprocessor import BERTPreprocessor, TextPreprocessor, TransformersPreprocessor
  from .vision.predictor import ImagePredictor
  from .vision.preprocessor import ImagePreprocessor
label_desc: Use image node_id 32 for calling the Learner obj's underlying member method code with example usage: obj.fit_onecycle(lr, epochs, checkpoint_folder, cycle_momentum, max_momentum, min_momentum, class_weight, callbacks, steps_per_epoch, verbose) and returns: hist