From a0572108031566ce9f827090203b99f63cdafcdc Mon Sep 17 00:00:00 2001 From: alexandercbooth Date: Sat, 3 Dec 2016 23:49:57 -0500 Subject: [PATCH] docs(MLPClassifier): add multi-label support in fit docstring and remove unnecessary backticks in attributes --- .../neural_network/multilayer_perceptron.py | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sklearn/neural_network/multilayer_perceptron.py b/sklearn/neural_network/multilayer_perceptron.py index af324e84f1c39..b3b657e09c956 100644 --- a/sklearn/neural_network/multilayer_perceptron.py +++ b/sklearn/neural_network/multilayer_perceptron.py @@ -601,15 +601,16 @@ def _update_no_improvement_count(self, early_stopping, X_val, y_val): self.best_loss_ = self.loss_curve_[-1] def fit(self, X, y): - """Fit the model to data matrix X and target y. + """Fit the model to data matrix X and target(s) y. Parameters ---------- - X : {array-like, sparse matrix}, shape (n_samples, n_features) + X : array-like or sparse matrix, shape (n_samples, n_features) The input data. - y : array-like, shape (n_samples,) - The target values. + y : array-like, shape (n_samples,) or (n_samples, n_outputs) + The target values (class labels in classification, real numbers in + regression). Returns ------- @@ -818,17 +819,17 @@ class MLPClassifier(BaseMultilayerPerceptron, ClassifierMixin): Attributes ---------- - `classes_` : array or list of array of shape (n_classes,) + classes_ : array or list of array of shape (n_classes,) Class labels for each output. - `loss_` : float + loss_ : float The current loss computed with the loss function. - `coefs_` : list, length n_layers - 1 + coefs_ : list, length n_layers - 1 The ith element in the list represents the weight matrix corresponding to layer i. - `intercepts_` : list, length n_layers - 1 + intercepts_ : list, length n_layers - 1 The ith element in the list represents the bias vector corresponding to layer i + 1. @@ -838,10 +839,10 @@ class MLPClassifier(BaseMultilayerPerceptron, ClassifierMixin): n_layers_ : int Number of layers. - `n_outputs_` : int + n_outputs_ : int Number of outputs. - `out_activation_` : string + out_activation_ : string Name of the output activation function. Notes @@ -1163,14 +1164,14 @@ class MLPRegressor(BaseMultilayerPerceptron, RegressorMixin): Attributes ---------- - `loss_` : float + loss_ : float The current loss computed with the loss function. - `coefs_` : list, length n_layers - 1 + coefs_ : list, length n_layers - 1 The ith element in the list represents the weight matrix corresponding to layer i. - `intercepts_` : list, length n_layers - 1 + intercepts_ : list, length n_layers - 1 The ith element in the list represents the bias vector corresponding to layer i + 1. @@ -1180,10 +1181,10 @@ class MLPRegressor(BaseMultilayerPerceptron, RegressorMixin): n_layers_ : int Number of layers. - `n_outputs_` : int + n_outputs_ : int Number of outputs. - `out_activation_` : string + out_activation_ : string Name of the output activation function. Notes