From 9b224aafc1d9aff7b27e95f47c97e5ed1c3d4cc7 Mon Sep 17 00:00:00 2001 From: Fabian Pedregosa <fabian.pedregosa@inria.fr> Date: Tue, 14 Dec 2010 19:37:33 +0100 Subject: [PATCH] Add type info to docstrings. --- scikits/learn/linear_model/logistic.py | 32 ++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/scikits/learn/linear_model/logistic.py b/scikits/learn/linear_model/logistic.py index bd37a2fdaa..e2e7eef452 100644 --- a/scikits/learn/linear_model/logistic.py +++ b/scikits/learn/linear_model/logistic.py @@ -62,15 +62,26 @@ class LogisticRegression(BaseLibLinear, ClassifierMixin): dual=dual, loss='lr', eps=eps, C=C, fit_intercept=fit_intercept) - def predict_proba(self, T): + def predict_proba(self, X): """ Probability estimates. The returned estimates for all classes are ordered by the label of classes. + + Parameters + ---------- + X : array-like, shape = [n_samples, n_features] + + Returns + ------- + T : array-like, shape = [n_samples, n_classes] + Returns the probability of the sample for each class in + the model, where classes are ordered by arithmetical + order. """ - T = np.asanyarray(T, dtype=np.float64, order='C') - probas = _liblinear.predict_prob_wrap(T, self.raw_coef_, + X = np.asanyarray(X, dtype=np.float64, order='C') + probas = _liblinear.predict_prob_wrap(X, self.raw_coef_, self._get_solver_type(), self.eps, self.C, self.class_weight_label, @@ -78,11 +89,22 @@ class LogisticRegression(BaseLibLinear, ClassifierMixin): self._get_bias()) return probas[:,np.argsort(self.label_)] - def predict_log_proba(self, T): + def predict_log_proba(self, X): """ Log of Probability estimates. The returned estimates for all classes are ordered by the label of classes. + + Parameters + ---------- + X : array-like, shape = [n_samples, n_features] + + Returns + ------- + X : array-like, shape = [n_samples, n_classes] + Returns the log-probabilities of the sample for each class in + the model, where classes are ordered by arithmetical + order. """ - return np.log(self.predict_proba(T)) + return np.log(self.predict_proba(X)) -- GitLab