class_docstr: Classification by support-vector machine.
  
  Support-vector machine (SVM) classification with precomputed Riemannian
  kernel matrix according to different metrics as described in [1]_.
  
  Parameters
  ----------
  metric : {"riemann", "euclid", "logeuclid"}, default="riemann"
      Metric for kernel matrix computation.
  Cref : None | callable | ndarray, shape (n_channels, n_channels)
      Reference point for kernel matrix computation.
      If None, the mean of the training data according to the metric is used.
      If callable, the function is called on the training data to calculate
      Cref.
  kernel_fct : None | "precomputed" | callable
      If None or "precomputed", the kernel matrix for datasets X and Y is
      estimated according to `pyriemann.utils.kernel(X, Y, Cref, metric)`.
      If callable, the callable is passed as the kernel parameter to
      `sklearn.svm.SVC()` [2]_. The callable has to be of the form
      `kernel(X, Y, Cref, metric)`.
  C : float, default=1.0
      Regularization parameter. The strength of the regularization is
      inversely proportional to C. Must be strictly positive. The penalty
      is a squared l2 penalty.
  shrinking : bool, default=True
      Whether to use the shrinking heuristic.
  probability : bool, default=False
      Whether to enable probability estimates. This must be enabled prior
      to calling `fit`, will slow down that method as it internally uses
      5-fold cross-validation, and `predict_proba` may be inconsistent with
      `predict`.
  tol : float, default=1e-3
      Tolerance for stopping criterion.
  cache_size : float, default=200
      Specify the size of the kernel cache (in MB).
  class_weight : dict or 'balanced', default=None
      Set the parameter C of class i to class_weight[i]*C for SVC. If not
      given, all classes are supposed to have weight one.
      The "balanced" mode uses the values of y to automatically adjust
      weights inversely proportional to class frequencies in the input data
      as ``n_matrices / (n_classes * np.bincount(y))``.
  verbose : bool, default=False
      Enable verbose output. Note that this setting takes advantage of a
      per-process runtime setting in libsvm that, if enabled, may not work
      properly in a multithreaded context.
  max_iter : int, default=-1
      Hard limit on iterations within solver, or -1 for no limit.
  decision_function_shape : {'ovo', 'ovr'}, default='ovr'
      Whether to return a one-vs-rest ('ovr') decision function of shape
      (n_matrices, n_classes) as all other classifiers, or the original
      one-vs-one ('ovo') decision function of libsvm which has shape
      (n_matrices, n_classes * (n_classes - 1) / 2). However, note that
      internally, one-vs-one ('ovo') is always used as a multi-class strategy
      to train models; an ovr matrix is only constructed from the ovo matrix.
      The parameter is ignored for binary classification.
  break_ties : bool, default=False
      If true, ``decision_function_shape='ovr'``, and number of classes > 2,
      `predict` will break ties according to the confidence values of
      `decision_function`; otherwise the first class among the tied
      classes is returned. Please note that breaking ties comes at a
      relatively high computational cost compared to a simple predict.
  random_state : int, RandomState instance or None, default=None
      Controls the pseudo random number generation for shuffling the data for
      probability estimates. Ignored when `probability` is False.
      Pass an int for reproducible output across multiple function calls.
  
  Notes
  -----
  .. versionadded:: 0.3
  
  References
  ----------
  .. [1] `Classification of covariance matrices using a Riemannian-based
      kernel for BCI applications
      <https://hal.archives-ouvertes.fr/hal-00820475/>`_
      A. Barachant, S. Bonnet, M. Congedo and C. Jutten. Neurocomputing,
      Elsevier, 2013, 112, pp.172-178.
  .. [2]
      https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html
class_docstr_tok: ["Classification","by","support-vector","machine",".","Support-vector","machine","(","SVM",")","classification","with","precomputed","Riemannian","kernel","matrix","according","to","different","metrics","as","described","in","[","1","]","_.","Parameters","--","--","--","--","--","metric",":","{","``","riemann","''",",","``","euclid","''",",","``","logeuclid","''","}",",","default=","''","riemann","''","Metric","for","kernel","matrix","computation",".","Cref",":","None","|","callable","|","ndarray",",","shape","(","n_channels",",","n_channels",")","Reference","point","for","kernel","matrix","computation",".","If","None",",","the","mean","of","the","training","data","according","to","the","metric","is","used",".","If","callable",",","the","function","is","called","on","the","training","data","to","calculate","Cref",".","kernel_fct",":","None","|","``","precomputed","''","|","callable","If","None","or","``","precomputed","''",",","the","kernel","matrix","for","datasets","X","and","Y","is","estimated","according","to","`","pyriemann.utils.kernel","(","X",",","Y",",","Cref",",","metric",")","`",".","If","callable",",","the","callable","is","passed","as","the","kernel","parameter","to","`","sklearn.svm.SVC","(",")","`","[","2","]","_",".","The","callable","has","to","be","of","the","form","`","kernel","(","X",",","Y",",","Cref",",","metric",")","`",".","C",":","float",",","default=1.0","Regularization","parameter",".","The","strength","of","the","regularization","is","inversely","proportional","to","C.","Must","be","strictly","positive",".","The","penalty","is","a","squared","l2","penalty",".","shrinking",":","bool",",","default=True","Whether","to","use","the","shrinking","heuristic",".","probability",":","bool",",","default=False","Whether","to","enable","probability","estimates",".","This","must","be","enabled","prior","to","calling","`","fit","`",",","will","slow","down","that","method","as","it","internally","uses","5-fold","cross-validation",",","and","`","predict_proba","`","may","be","inconsistent","with","`","predict","`",".","tol",":","float",",","default=1e-3","Tolerance","for","stopping","criterion",".","cache_size",":","float",",","default=200","Specify","the","size","of","the","kernel","cache","(","in","MB",")",".","class_weight",":","dict","or","'balanced","'",",","default=None","Set","the","parameter","C","of","class","i","to","class_weight","[","i","]","*","C","for","SVC",".","If","not","given",",","all","classes","are","supposed","to","have","weight","one",".","The","``","balanced","''","mode","uses","the","values","of","y","to","automatically","adjust","weights","inversely","proportional","to","class","frequencies","in","the","input","data","as","``","n_matrices","\/","(","n_classes","*","np.bincount","(","y",")",")","``",".","verbose",":","bool",",","default=False","Enable","verbose","output",".","Note","that","this","setting","takes","advantage","of","a","per-process","runtime","setting","in","libsvm","that",",","if","enabled",",","may","not","work","properly","in","a","multithreaded","context",".","max_iter",":","int",",","default=-1","Hard","limit","on","iterations","within","solver",",","or","-1","for","no","limit",".","decision_function_shape",":","{","'ovo","'",",","'ovr","'","}",",","default='ovr'","Whether","to","return","a","one-vs-rest","(","'ovr","'",")","decision","function","of","shape","(","n_matrices",",","n_classes",")","as","all","other","classifiers",",","or","the","original","one-vs-one","(","'ovo","'",")","decision","function","of","libsvm","which","has","shape","(","n_matrices",",","n_classes","*","(","n_classes","-","1",")","\/","2",")",".","However",",","note","that","internally",",","one-vs-one","(","'ovo","'",")","is","always","used","as","a","multi-class","strategy","to","train","models",";","an","ovr","matrix","is","only","constructed","from","the","ovo","matrix",".","The","parameter","is","ignored","for","binary","classification",".","break_ties",":","bool",",","default=False","If","true",",","``","decision_function_shape='ovr","'","``",",","and","number","of","classes",">","2",",","`","predict","`","will","break","ties","according","to","the","confidence","values","of","`","decision_function","`",";","otherwise","the","first","class","among","the","tied","classes","is","returned",".","Please","note","that","breaking","ties","comes","at","a","relatively","high","computational","cost","compared","to","a","simple","predict",".","random_state",":","int",",","RandomState","instance","or","None",",","default=None","Controls","the","pseudo","random","number","generation","for","shuffling","the","data","for","probability","estimates",".","Ignored","when","`","probability","`","is","False",".","Pass","an","int","for","reproducible","output","across","multiple","function","calls",".","Notes","--","--","-","..","versionadded",":",":","0.3","References","--","--","--","--","--","..","[","1","]","`","Classification","of","covariance","matrices","using","a","Riemannian-based","kernel","for","BCI","applications","<","https",":","\/\/hal.archives-ouvertes.fr\/hal-00820475\/",">","`","_","A.","Barachant",",","S.","Bonnet",",","M.","Congedo","and","C.","Jutten",".","Neurocomputing",",","Elsevier",",","2013",",","112",",","pp.172-178",".","..","[","2","]","https",":","\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.svm.SVC.html"]
code: def _set_cref(self, X):
      if self.Cref is None:
          self.Cref_ = mean_covariance(X, metric=self.metric)
      elif callable(self.Cref):
          self.Cref_ = self.Cref(X)
      elif isinstance(self.Cref, np.ndarray):
          self.Cref_ = self.Cref
      else:
          raise TypeError(
              f"Cref must be np.ndarray, callable or None, is "
              f"{self.Cref}."
          )
  
imports: import functools
  import numpy
  from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin
  from sklearn.svm import SVC
  from sklearn.utils.extmath import softmax
  from sklearn.linear_model import LogisticRegression
  from sklearn.pipeline import make_pipeline
  from joblib import Parallel, delayed
  import warnings
  from .utils.kernel import kernel
  from .utils.mean import mean_covariance, mean_power
  from .utils.distance import distance
  from .tangentspace import FGDA, TangentSpace
label_desc: Use image node_id 3 for calling the SVC obj's underlying member method code with example usage: obj._set_cref(X) without return types