class_docstr: Class for training and visualizing a self-organizing map.
  
  Attributes:
  
      codebook     The codebook of the self-organizing map.
  
      bmus         The BMUs corresponding to the data points.
  
  :param n_columns: The number of columns in the map.
  :type n_columns: int.
  :param n_rows: The number of rows in the map.
  :type n_rows: int.
  :param initialcodebook: Optional parameter to start the training with a
                          given codebook.
  :type initialcodebook: 2D numpy.array of float32.
  :param kerneltype: Optional parameter to specify which kernel to use:
  
                         * 0: dense CPU kernel (default)
                         * 1: dense GPU kernel (if compiled with it)
  :type kerneltype: int.
  :param maptype: Optional parameter to specify the map topology:
  
                         * "planar": Planar map (default)
                         * "toroid": Toroid map
  :type maptype: str.
  :param gridtype: Optional parameter to specify the grid form of the nodes:
  
                         * "rectangular": rectangular neurons (default)
                         * "hexagonal": hexagonal neurons
  :type gridtype: str.
  :param compactsupport: Optional parameter to cut off map updates beyond the
                         training radius with the Gaussian neighborhood.
                         Default: True.
  :type compactsupport: bool.
  :param neighborhood: Optional parameter to specify the neighborhood:
  
                         * "gaussian": Gaussian neighborhood (default)
                         * "bubble": bubble neighborhood function
  :type neighborhood: str.
  :param vect_distance: Optional parameter to specify the vector distance function:
  
                         * "euclidean": Euclidean (default)
                         * "norm-inf": infinite norm (max absolute distance among components)
                         * "norm-p": p-th root of sum of absolute differences ^ p (only supported by kerneltype 0)
  :type vect_distance: str.
  :param std_coeff: Optional parameter to set the coefficient in the Gaussian
                    neighborhood function exp(-||x-y||^2/(2*(coeff*radius)^2))
                    Default: 0.5
  :type std_coeff: float.
  :param initialization: Optional parameter to specify the initalization:
  
                         * "random": random weights in the codebook
                         * "pca": codebook is initialized from the first
                           subspace spanned by the first two eigenvectors of
                           the correlation matrix
  :type initialization: str.
  :param verbose: Optional parameter to specify verbosity (0, 1, or 2).
  :type verbose: int.
class_docstr_tok: ["Class","for","training","and","visualizing","a","self-organizing","map",".","Attributes",":","codebook","The","codebook","of","the","self-organizing","map",".","bmus","The","BMUs","corresponding","to","the","data","points",".",":","param","n_columns",":","The","number","of","columns","in","the","map",".",":","type","n_columns",":","int",".",":","param","n_rows",":","The","number","of","rows","in","the","map",".",":","type","n_rows",":","int",".",":","param","initialcodebook",":","Optional","parameter","to","start","the","training","with","a","given","codebook",".",":","type","initialcodebook",":","2D","numpy.array","of","float32",".",":","param","kerneltype",":","Optional","parameter","to","specify","which","kernel","to","use",":","*","0",":","dense","CPU","kernel","(","default",")","*","1",":","dense","GPU","kernel","(","if","compiled","with","it",")",":","type","kerneltype",":","int",".",":","param","maptype",":","Optional","parameter","to","specify","the","map","topology",":","*","``","planar","''",":","Planar","map","(","default",")","*","``","toroid","''",":","Toroid","map",":","type","maptype",":","str",".",":","param","gridtype",":","Optional","parameter","to","specify","the","grid","form","of","the","nodes",":","*","``","rectangular","''",":","rectangular","neurons","(","default",")","*","``","hexagonal","''",":","hexagonal","neurons",":","type","gridtype",":","str",".",":","param","compactsupport",":","Optional","parameter","to","cut","off","map","updates","beyond","the","training","radius","with","the","Gaussian","neighborhood",".","Default",":","True",".",":","type","compactsupport",":","bool",".",":","param","neighborhood",":","Optional","parameter","to","specify","the","neighborhood",":","*","``","gaussian","''",":","Gaussian","neighborhood","(","default",")","*","``","bubble","''",":","bubble","neighborhood","function",":","type","neighborhood",":","str",".",":","param","vect_distance",":","Optional","parameter","to","specify","the","vector","distance","function",":","*","``","euclidean","''",":","Euclidean","(","default",")","*","``","norm-inf","''",":","infinite","norm","(","max","absolute","distance","among","components",")","*","``","norm-p","''",":","p-th","root","of","sum","of","absolute","differences","^","p","(","only","supported","by","kerneltype","0",")",":","type","vect_distance",":","str",".",":","param","std_coeff",":","Optional","parameter","to","set","the","coefficient","in","the","Gaussian","neighborhood","function","exp","(","-||x-y||^2\/","(","2","*","(","coeff","*","radius",")","^2",")",")","Default",":","0.5",":","type","std_coeff",":","float",".",":","param","initialization",":","Optional","parameter","to","specify","the","initalization",":","*","``","random","''",":","random","weights","in","the","codebook","*","``","pca","''",":","codebook","is","initialized","from","the","first","subspace","spanned","by","the","first","two","eigenvectors","of","the","correlation","matrix",":","type","initialization",":","str",".",":","param","verbose",":","Optional","parameter","to","specify","verbosity","(","0",",","1",",","or","2",")",".",":","type","verbose",":","int","."]
docstr: Train the map on the current data in the Somoclu object.
  :param data: Optional parameter to provide training data. It is not
               necessary if the data was added via the method
               `update_data`.
  :type data: 2D numpy.array of float32.
  :param epochs: The number of epochs to train the map for.
  :type epochs: int.
  :param radius0: The initial radius on the map where the update happens
                  around a best matching unit. Default value of 0 will
                  trigger a value of min(n_columns, n_rows)/2.
  :type radius0: float.
  :param radiusN: The radius on the map where the update happens around a
                  best matching unit in the final epoch. Default: 1.
  :type radiusN: float.
  :param radiuscooling: The cooling strategy between radius0 and radiusN:
  
                             * "linear": Linear interpolation (default)
                             * "exponential": Exponential decay
  :param scale0: The initial learning scale. Default value: 0.1.
  :type scale0: float.
  :param scaleN: The learning scale in the final epoch. Default: 0.01.
  :type scaleN: float.
  :param scalecooling: The cooling strategy between scale0 and scaleN:
  
                             * "linear": Linear interpolation (default)
                             * "exponential": Exponential decay
  :type scalecooling: str.
docstr_tok: ["Train","the","map","on","the","current","data","in","the","Somoclu","object",".",":","param","data",":","Optional","parameter","to","provide","training","data",".","It","is","not","necessary","if","the","data","was","added","via","the","method","`","update_data","`",".",":","type","data",":","2D","numpy.array","of","float32",".",":","param","epochs",":","The","number","of","epochs","to","train","the","map","for",".",":","type","epochs",":","int",".",":","param","radius0",":","The","initial","radius","on","the","map","where","the","update","happens","around","a","best","matching","unit",".","Default","value","of","0","will","trigger","a","value","of","min","(","n_columns",",","n_rows",")","\/2",".",":","type","radius0",":","float",".",":","param","radiusN",":","The","radius","on","the","map","where","the","update","happens","around","a","best","matching","unit","in","the","final","epoch",".","Default",":","1.",":","type","radiusN",":","float",".",":","param","radiuscooling",":","The","cooling","strategy","between","radius0","and","radiusN",":","*","``","linear","''",":","Linear","interpolation","(","default",")","*","``","exponential","''",":","Exponential","decay",":","param","scale0",":","The","initial","learning","scale",".","Default","value",":","0.1.",":","type","scale0",":","float",".",":","param","scaleN",":","The","learning","scale","in","the","final","epoch",".","Default",":","0.01.",":","type","scaleN",":","float",".",":","param","scalecooling",":","The","cooling","strategy","between","scale0","and","scaleN",":","*","``","linear","''",":","Linear","interpolation","(","default",")","*","``","exponential","''",":","Exponential","decay",":","type","scalecooling",":","str","."]
code: def train(
      self,
      data=None,
      epochs=10,
      radius0=0,
      radiusN=1,
      radiuscooling="linear",
      scale0=0.1,
      scaleN=0.01,
      scalecooling="linear",
  ):
      """Train the map on the current data in the Somoclu object.
      :param data: Optional parameter to provide training data. It is not
                   necessary if the data was added via the method
                   `update_data`.
      :type data: 2D numpy.array of float32.
      :param epochs: The number of epochs to train the map for.
      :type epochs: int.
      :param radius0: The initial radius on the map where the update happens
                      around a best matching unit. Default value of 0 will
                      trigger a value of min(n_columns, n_rows)/2.
      :type radius0: float.
      :param radiusN: The radius on the map where the update happens around a
                      best matching unit in the final epoch. Default: 1.
      :type radiusN: float.
      :param radiuscooling: The cooling strategy between radius0 and radiusN:
  
                                 * "linear": Linear interpolation (default)
                                 * "exponential": Exponential decay
      :param scale0: The initial learning scale. Default value: 0.1.
      :type scale0: float.
      :param scaleN: The learning scale in the final epoch. Default: 0.01.
      :type scaleN: float.
      :param scalecooling: The cooling strategy between scale0 and scaleN:
  
                                 * "linear": Linear interpolation (default)
                                 * "exponential": Exponential decay
      :type scalecooling: str.
      """
      _check_cooling_parameters(radiuscooling, scalecooling)
      if self._data is None and data is None:
          raise Exception("No data was provided!")
      elif data is not None:
          self.update_data(data)
      self._init_codebook()
      self.umatrix.shape = (self._n_rows * self._n_columns,)
      self.bmus.shape = (self.n_vectors * 2,)
      wrap_train(
          np.ravel(self._data),
          epochs,
          self._n_columns,
          self._n_rows,
          self.n_dim,
          self.n_vectors,
          radius0,
          radiusN,
          radiuscooling,
          scale0,
          scaleN,
          scalecooling,
          self._kernel_type,
          self._map_type,
          self._grid_type,
          self._compact_support,
          self._neighborhood == "gaussian",
          self._std_coeff,
          self._verbose,
          self.codebook,
          self.bmus,
          self.umatrix,
          self._vect_distance,
      )
      self.umatrix.shape = (self._n_rows, self._n_columns)
      self.bmus.shape = (self.n_vectors, 2)
      self.codebook.shape = (self._n_rows, self._n_columns, self.n_dim)
  
imports: from __future__ import division, print_function
  import sys
  import matplotlib.cm
  import matplotlib.pyplot
  import matplotlib.collections
  import numpy
  from scipy.spatial.distance import cdist
label_desc: Use image node_id 5 for calling the Somoclu obj's underlying member method code with example usage: obj.train(data, epochs, radius0, radiusN, radiuscooling, scale0, scaleN, scalecooling) without return types