class_docstr: Regression by k-nearest-neighbors.
  
  Regression by k-nearest neighbors (k-NN). For each point of the test set,
  the pairwise distance to each element of the training set is estimated. The
  value is calculated according to the softmax average w.r.t. distance of
  the k-nearest neighbors.
  
  DISCLAIMER: This is an unpublished algorithm.
  
  Parameters
  ----------
  n_neighbors : int, default=5
      Number of neighbors.
  metric : string | dict, default='riemann'
      The type of metric used for distance estimation.
      See `distance` for the list of supported metric.
  
  Attributes
  ----------
  values_ : ndarray, shape (n_matrices,)
      Training target values.
  covmeans_ : ndarray, shape (n_matrices, n_channels, n_channels)
      Training set of SPD matrices.
  
  Notes
  -----
  .. versionadded:: 0.3
class_docstr_tok: ["Regression","by","k-nearest-neighbors",".","Regression","by","k-nearest","neighbors","(","k-NN",")",".","For","each","point","of","the","test","set",",","the","pairwise","distance","to","each","element","of","the","training","set","is","estimated",".","The","value","is","calculated","according","to","the","softmax","average","w.r.t",".","distance","of","the","k-nearest","neighbors",".","DISCLAIMER",":","This","is","an","unpublished","algorithm",".","Parameters","--","--","--","--","--","n_neighbors",":","int",",","default=5","Number","of","neighbors",".","metric",":","string","|","dict",",","default='riemann'","The","type","of","metric","used","for","distance","estimation",".","See","`","distance","`","for","the","list","of","supported","metric",".","Attributes","--","--","--","--","--","values_",":","ndarray",",","shape","(","n_matrices",",",")","Training","target","values",".","covmeans_",":","ndarray",",","shape","(","n_matrices",",","n_channels",",","n_channels",")","Training","set","of","SPD","matrices",".","Notes","--","--","-","..","versionadded",":",":","0.3"]
docstr: Init.
docstr_tok: ["Init","."]
code: def __init__(self, n_neighbors=5, metric="riemann"):
      """Init."""
      self.n_neighbors = n_neighbors
      self._estimator_type = "regressor"
      super().__init__(metric=metric)
  
file_path: pyRiemann/pyriemann/regression.py
imports: import functools
  import numpy
  from sklearn.metrics import r2_score
  from sklearn.svm import SVR
  from sklearn.utils.extmath import softmax
  from .utils.kernel import kernel
  from .classification import MDM, _check_metric
  from .utils.mean import mean_covariance
label_desc: Use image node_id 1 to create a new KNearestNeighborRegressor object from inherited base classes: MDM with example: obj = KNearestNeighborRegressor(n_neighbors, metric)