class_docstr: Function decorator that takes care of cross-validation.
  Evaluations of the decorated function will always return a cross-validated
  estimate of generalization performance.
  
  :param x: data to be used for cross-validation
  :param num_folds: number of cross-validation folds (default 10)
  :param y: (optional) labels to be used for cross-validation.
      If specified, len(labels) must equal len(x)
  :param strata: (optional) strata to account for when generating folds.
      Strata signify instances that must be spread across folds.
      Not every instance must be in a stratum.
      Specify strata as a list of lists of instance indices.
  :param folds: (optional) prespecified cross-validation folds to be used (list of lists (iterations) of lists (folds)).
  :param num_iter: (optional) number of iterations to use (default 1)
  :param regenerate_folds: (optional) whether or not to regenerate folds on every evaluation (default false)
  :param clusters: (optional) clusters to account for when generating folds.
      Clusters signify instances that must be assigned to the same fold.
      Not every instance must be in a cluster.
      Specify clusters as a list of lists of instance indices.
  :param aggregator: function to aggregate scores of different folds (default: mean)
  
  Use :func:`cross_validated` to create instances of this class.
class_docstr_tok: ["Function","decorator","that","takes","care","of","cross-validation",".","Evaluations","of","the","decorated","function","will","always","return","a","cross-validated","estimate","of","generalization","performance",".",":","param","x",":","data","to","be","used","for","cross-validation",":","param","num_folds",":","number","of","cross-validation","folds","(","default","10",")",":","param","y",":","(","optional",")","labels","to","be","used","for","cross-validation",".","If","specified",",","len","(","labels",")","must","equal","len","(","x",")",":","param","strata",":","(","optional",")","strata","to","account","for","when","generating","folds",".","Strata","signify","instances","that","must","be","spread","across","folds",".","Not","every","instance","must","be","in","a","stratum",".","Specify","strata","as","a","list","of","lists","of","instance","indices",".",":","param","folds",":","(","optional",")","prespecified","cross-validation","folds","to","be","used","(","list","of","lists","(","iterations",")","of","lists","(","folds",")",")",".",":","param","num_iter",":","(","optional",")","number","of","iterations","to","use","(","default","1",")",":","param","regenerate_folds",":","(","optional",")","whether","or","not","to","regenerate","folds","on","every","evaluation","(","default","false",")",":","param","clusters",":","(","optional",")","clusters","to","account","for","when","generating","folds",".","Clusters","signify","instances","that","must","be","assigned","to","the","same","fold",".","Not","every","instance","must","be","in","a","cluster",".","Specify","clusters","as","a","list","of","lists","of","instance","indices",".",":","param","aggregator",":","function","to","aggregate","scores","of","different","folds","(","default",":","mean",")","Use",":","func",":","`","cross_validated","`","to","create","instances","of","this","class","."]
code: def __init__(
      self,
      f,
      x,
      num_folds=10,
      y=None,
      strata=None,
      folds=None,
      num_iter=1,
      regenerate_folds=False,
      clusters=None,
      aggregator=mean,
  ):
      self._x = x
      self._y = y
      self._strata = strata
      self._clusters = clusters
      self._regenerate_folds = regenerate_folds
      self._f = f
      self._reduce = aggregator
      if folds:
          assert (
              len(folds) == num_iter
          ), "Number of fold sets does not equal num_iter."
          assert (
              len(folds[0]) == num_folds
          ), "Number of folds does not match num_folds."
          self._folds = folds
      else:
          self._folds = [
              generate_folds(
                  self.len_x, num_folds, self.strata, self.clusters
              )
              for _ in range(num_iter)
          ]
      functools.update_wrapper(self, f)
  
imports: import math
  import random
  import itertools
  import functools
  import operator
  import array
  import inspect
label_desc: Use image node_id 1 to create a new cross_validated_callable object from inherited base classes: object with example: obj = cross_validated_callable(f, x, num_folds, y, strata, folds, num_iter, regenerate_folds, clusters, aggregator)