class_docstr: Geodesic Regression.
  
  The generative model of the data is:
  :math:`Z = Exp_{\beta_0}(\beta_1.X)` and :math:`Y = Exp_Z(\epsilon)`
  where:
  
  - :math:`Exp` denotes the Riemannian exponential,
  - :math:`\beta_0` is called the intercept,
    and is a point on the manifold,
  - :math:`\beta_1` is called the coefficient,
    and is a tangent vector to the manifold at :math:`\beta_0`,
  - :math:`\epsilon \sim N(0, 1)` is a standard Gaussian noise,
  - :math:`X` is the input, :math:`Y` is the target.
  
  The geodesic regression method:
  
  - estimates :math:`\beta_0, \beta_1`,
  - predicts :math:`\hat{y}` from input :math:`X`.
  
  Parameters
  ----------
  space : Manifold
      Equipped manifold.
  center_X : bool
      Subtract mean to X as a preprocessing.
  method : str, {\'extrinsic\', \'riemannian\'}
      Gradient descent method.
      Optional, default: extrinsic.
  initialization : str or array-like,
      {'random', 'data', 'frechet', warm_start'}
      Initial values of the parameters for the optimization,
      or initialization method.
      Optional, default: 'random'
  regularization : float
      Weight on the constraint for the intercept to lie on the manifold in
      the extrinsic optimization scheme. An L^2 constraint is applied.
      Optional, default: 1.
  compute_training_score : bool
      Whether to compute R^2.
      Optional, default: False.
  
  Notes
  -----
  * Required metric methods:
      * all: `exp`, `squared_dist`
      * if `riemannian`: `parallel transport` or `to_tangent`
class_docstr_tok: ["Geodesic","Regression",".","The","generative","model","of","the","data","is",":",":","math",":","`","Z","=","Exp_","{","\\beta_0","}","(","\\beta_1.X",")","`","and",":","math",":","`","Y","=","Exp_Z","(","\\epsilon",")","`","where",":","-",":","math",":","`","Exp","`","denotes","the","Riemannian","exponential",",","-",":","math",":","`","\\beta_0","`","is","called","the","intercept",",","and","is","a","point","on","the","manifold",",","-",":","math",":","`","\\beta_1","`","is","called","the","coefficient",",","and","is","a","tangent","vector","to","the","manifold","at",":","math",":","`","\\beta_0","`",",","-",":","math",":","`","\\epsilon","\\sim","N","(","0",",","1",")","`","is","a","standard","Gaussian","noise",",","-",":","math",":","`","X","`","is","the","input",",",":","math",":","`","Y","`","is","the","target",".","The","geodesic","regression","method",":","-","estimates",":","math",":","`","\\beta_0",",","\\beta_1","`",",","-","predicts",":","math",":","`","\\hat","{","y","}","`","from","input",":","math",":","`","X","`",".","Parameters","--","--","--","--","--","space",":","Manifold","Equipped","manifold",".","center_X",":","bool","Subtract","mean","to","X","as","a","preprocessing",".","method",":","str",",","{","\\'extrinsic\\","'",",","\\'riemannian\\","'","}","Gradient","descent","method",".","Optional",",","default",":","extrinsic",".","initialization",":","str","or","array-like",",","{","'random","'",",","'data","'",",","'frechet","'",",","warm_start","'","}","Initial","values","of","the","parameters","for","the","optimization",",","or","initialization","method",".","Optional",",","default",":","'random'","regularization",":","float","Weight","on","the","constraint","for","the","intercept","to","lie","on","the","manifold","in","the","extrinsic","optimization","scheme",".","An","L^2","constraint","is","applied",".","Optional",",","default",":","1.","compute_training_score",":","bool","Whether","to","compute","R^2",".","Optional",",","default",":","False",".","Notes","--","--","-","*","Required","metric","methods",":","*","all",":","`","exp","`",",","`","squared_dist","`","*","if","`","riemannian","`",":","`","parallel","transport","`","or","`","to_tangent","`"]
docstr: Estimate the parameters using a Riemannian gradient descent.
  
  Estimate the intercept and the coefficient defining the
  geodesic regression model, using the Riemannian gradient.
  
  Parameters
  ----------
  X : array-like, shape=[n_samples,]
      Training input samples.
  y : array-like, shape=[n_samples, {dim, [n,n]}]
      Training target values.
  weights : array-like, shape=[n_samples,]
      Weights associated to the points.
      Optional, default: None.
  
  Returns
  -------
  res : OptimizeResult
      Scipy's optimize result.
docstr_tok: ["Estimate","the","parameters","using","a","Riemannian","gradient","descent",".","Estimate","the","intercept","and","the","coefficient","defining","the","geodesic","regression","model",",","using","the","Riemannian","gradient",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape=","[","n_samples",",","]","Training","input","samples",".","y",":","array-like",",","shape=","[","n_samples",",","{","dim",",","[","n",",","n","]","}","]","Training","target","values",".","weights",":","array-like",",","shape=","[","n_samples",",","]","Weights","associated","to","the","points",".","Optional",",","default",":","None",".","Returns","--","--","--","-","res",":","OptimizeResult","Scipy","'s","optimize","result","."]
code: def _fit_riemannian(self, X, y, weights=None):
      """Estimate the parameters using a Riemannian gradient descent.
  
      Estimate the intercept and the coefficient defining the
      geodesic regression model, using the Riemannian gradient.
  
      Parameters
      ----------
      X : array-like, shape=[n_samples,]
          Training input samples.
      y : array-like, shape=[n_samples, {dim, [n,n]}]
          Training target values.
      weights : array-like, shape=[n_samples,]
          Weights associated to the points.
          Optional, default: None.
  
      Returns
      -------
      res : OptimizeResult
          Scipy's optimize result.
      """
      objective_with_grad = lambda params: self._loss(
          X, y, params, weights
      )
  
      intercept_init, coef_init = self._initialize_parameters(y)
      x0 = gs.vstack(
          [gs.flatten(intercept_init), gs.flatten(coef_init)]
      )
  
      return self.optimizer.minimize(
          self.space, objective_with_grad, x0
      )
  
imports: import logging
  import math
  from scipy.optimize import OptimizeResult
  from sklearn.base import BaseEstimator
  import geomstats.backend
  import geomstats.errors
  from geomstats.learning.frechet_mean import FrechetMean
  from geomstats.numerics.optimizers import ScipyMinimize
label_desc: Use image node_id 10 for calling the GeodesicRegression obj's underlying member method code with example usage: obj._fit_riemannian(X, y, weights) and returns: self