def fit(self, X, y=None, weights=None): """Compute the empirical Exponential Barycenter mean. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) The training input samples. y : array-like, shape (n_samples,) or (n_samples, n_outputs) The target values (class labels in classification, real numbers in regression). Ignored weights : array-like, shape=[n_samples,], optional Returns ------- self : object Returns self. """ if isinstance(self.group, Euclidean): mean = linear_mean(points=X, weights=weights) # TODO(nguigs): use closed form expression for special euclidean # group as before PR #537 else: mean = _default_gradient_descent(points=X, weights=weights, group=self.group, max_iter=self.max_iter, epsilon=self.epsilon, step=self.step, verbose=self.verbose) self.estimate_ = mean return self
def fit(self, X, y=None, weights=None): """Compute the empirical Exponential Barycenter mean. Parameters ---------- X : {array-like, sparse matrix}, shape=[..., n_features] Training input samples. y : array-like, shape=[...,] or [..., n_outputs] Target values (class labels in classification, real numbers in regression). Ignored. weights : array-like, shape=[...,] Weights associated to the points. Optional, default: None. Returns ------- self : object Returns self. """ if isinstance(self.group, Euclidean): mean = linear_mean(points=X, weights=weights) # TODO (nguigs): use closed form expression for special euclidean # group as before PR #537 else: mean = _default_gradient_descent( group=self.group, points=X, weights=weights, max_iter=self.max_iter, init_step_size=self.init_step_size, epsilon=self.epsilon, verbose=self.verbose, ) self.estimate_ = mean return self