From 659f2942ea2351930afb7eedb35345dbc282f809 Mon Sep 17 00:00:00 2001 From: Claire Savard Date: Tue, 3 Dec 2019 23:22:31 -0700 Subject: [PATCH 1/3] fixed default values --- sklearn/cluster/_affinity_propagation.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sklearn/cluster/_affinity_propagation.py b/sklearn/cluster/_affinity_propagation.py index 3393e0686bd02..0a02b1ae9cd13 100644 --- a/sklearn/cluster/_affinity_propagation.py +++ b/sklearn/cluster/_affinity_propagation.py @@ -242,36 +242,36 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): Parameters ---------- - damping : float, optional, default: 0.5 + damping : float, default=0.5 Damping factor (between 0.5 and 1) is the extent to which the current value is maintained relative to incoming values (weighted 1 - damping). This in order to avoid numerical oscillations when updating these values (messages). - max_iter : int, optional, default: 200 + max_iter : int, default=200 Maximum number of iterations. - convergence_iter : int, optional, default: 15 + convergence_iter : int, default=15 Number of iterations with no change in the number of estimated clusters that stops the convergence. - copy : boolean, optional, default: True + copy : boolean, default=True Make a copy of input data. - preference : array-like, shape (n_samples,) or float, optional + preference : array-like, shape (n_samples,) or float, default=None Preferences for each point - points with larger values of preferences are more likely to be chosen as exemplars. The number of exemplars, ie of clusters, is influenced by the input preferences value. If the preferences are not passed as arguments, they will be set to the median of the input similarities. - affinity : string, optional, default=``euclidean`` + affinity : string, default=``euclidean`` Which affinity to use. At the moment ``precomputed`` and ``euclidean`` are supported. ``euclidean`` uses the negative squared euclidean distance between points. - verbose : boolean, optional, default: False + verbose : boolean, default=False Whether to be verbose. From 76a808ecacc5f760016f0b5886dac95d8508431b Mon Sep 17 00:00:00 2001 From: Claire Savard Date: Wed, 4 Dec 2019 09:54:13 -0700 Subject: [PATCH 2/3] fixed datatype of attributes --- sklearn/cluster/_affinity_propagation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sklearn/cluster/_affinity_propagation.py b/sklearn/cluster/_affinity_propagation.py index 0a02b1ae9cd13..5bc93235c7181 100644 --- a/sklearn/cluster/_affinity_propagation.py +++ b/sklearn/cluster/_affinity_propagation.py @@ -256,7 +256,7 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): Number of iterations with no change in the number of estimated clusters that stops the convergence. - copy : boolean, default=True + copy : bool, default=True Make a copy of input data. preference : array-like, shape (n_samples,) or float, default=None @@ -266,12 +266,12 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): preferences value. If the preferences are not passed as arguments, they will be set to the median of the input similarities. - affinity : string, default=``euclidean`` - Which affinity to use. At the moment ``precomputed`` and - ``euclidean`` are supported. ``euclidean`` uses the + affinity : {'euclidean', 'precomputed'}, default='euclidean' + Which affinity to use. At the moment 'precomputed' and + ``euclidean`` are supported. 'euclidean' uses the negative squared euclidean distance between points. - verbose : boolean, default=False + verbose : bool, default=False Whether to be verbose. From 6ecb4778591b00d21bd4fcbea50104529f971d9d Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Tue, 10 Dec 2019 16:44:23 +0100 Subject: [PATCH 3/3] Apply reviews --- sklearn/cluster/_affinity_propagation.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sklearn/cluster/_affinity_propagation.py b/sklearn/cluster/_affinity_propagation.py index 5bc93235c7181..eaba9ccf1ec20 100644 --- a/sklearn/cluster/_affinity_propagation.py +++ b/sklearn/cluster/_affinity_propagation.py @@ -259,7 +259,7 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): copy : bool, default=True Make a copy of input data. - preference : array-like, shape (n_samples,) or float, default=None + preference : array-like of shape (n_samples,) or float, default=None Preferences for each point - points with larger values of preferences are more likely to be chosen as exemplars. The number of exemplars, ie of clusters, is influenced by the input @@ -277,16 +277,16 @@ class AffinityPropagation(ClusterMixin, BaseEstimator): Attributes ---------- - cluster_centers_indices_ : array, shape (n_clusters,) + cluster_centers_indices_ : ndarray of shape (n_clusters,) Indices of cluster centers - cluster_centers_ : array, shape (n_clusters, n_features) + cluster_centers_ : ndarray of shape (n_clusters, n_features) Cluster centers (if affinity != ``precomputed``). - labels_ : array, shape (n_samples,) + labels_ : ndarray of shape (n_samples,) Labels of each point - affinity_matrix_ : array, shape (n_samples, n_samples) + affinity_matrix_ : ndarray of shape (n_samples, n_samples) Stores the affinity matrix used in ``fit``. n_iter_ : int