class_docstr: Base class for density estimation and regression KDE classes.
class_docstr_tok: ["Base","class","for","density","estimation","and","regression","KDE","classes","."]
docstr: Returns the cross-validation least squares bandwidth parameter(s).
  
  Notes
  -----
  For more details see pp. 16, 27 in Ref. [1] (see module docstring).
  
  Returns the value of the bandwidth that maximizes the integrated mean
  square error between the estimated and actual distribution.  The
  integrated mean square error (IMSE) is given by:
  
  .. math:: \int\left[\hat{f}(x)-f(x)\right]^{2}dx
  
  This is the general formula for the IMSE.  The IMSE differs for
  conditional (``KDEMultivariateConditional``) and unconditional
  (``KDEMultivariate``) kernel density estimation.
docstr_tok: ["Returns","the","cross-validation","least","squares","bandwidth","parameter","(","s",")",".","Notes","--","--","-","For","more","details","see","pp",".","16",",","27","in","Ref",".","[","1","]","(","see","module","docstring",")",".","Returns","the","value","of","the","bandwidth","that","maximizes","the","integrated","mean","square","error","between","the","estimated","and","actual","distribution",".","The","integrated","mean","square","error","(","IMSE",")","is","given","by",":","..","math",":",":","\\int\\left","[","\\hat","{","f","}","(","x",")","-f","(","x",")","\\right","]","^","{","2","}","dx","This","is","the","general","formula","for","the","IMSE",".","The","IMSE","differs","for","conditional","(","``","KDEMultivariateConditional","``",")","and","unconditional","(","``","KDEMultivariate","``",")","kernel","density","estimation","."]
code: def _cv_ls(self):
      r"""
      Returns the cross-validation least squares bandwidth parameter(s).
  
      Notes
      -----
      For more details see pp. 16, 27 in Ref. [1] (see module docstring).
  
      Returns the value of the bandwidth that maximizes the integrated mean
      square error between the estimated and actual distribution.  The
      integrated mean square error (IMSE) is given by:
  
      .. math:: \int\left[\hat{f}(x)-f(x)\right]^{2}dx
  
      This is the general formula for the IMSE.  The IMSE differs for
      conditional (``KDEMultivariateConditional``) and unconditional
      (``KDEMultivariate``) kernel density estimation.
      """
      h0 = self._normal_reference()
      bw = optimize.fmin(
          self.imse, x0=h0, maxiter=1e3, maxfun=1e3, disp=0, xtol=1e-3
      )
      bw = self._set_bw_bounds(bw)  # bound bw if necessary
      return bw
  
imports: import copy
  import numpy
  from scipy import optimize
  from scipy.stats.mstats import mquantiles
  from .None import kernels
label_desc: Use image node_id 9 for calling the GenericKDE obj's underlying member method code with example usage: obj._cv_ls() and returns: bw