Module Expr Str Import alias identifier ImportFrom alias alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num Num Num NameLoad NameLoad NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num If CompareNotEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num body Raise Call NameLoad BinOpMod Str Call NameLoad AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad If BoolOpOr CompareLt NameLoad Num CompareGtE NameLoad Num body Raise Call NameLoad Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num Assign SubscriptStore AttributeLoad NameLoad attr Slice BinOpAdd NameLoad Num NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad AugAssignAdd NameStore BinOpMult BinOpAdd BinOpMult AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr NameLoad BinOpMult AttributeLoad Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr Num Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad UnaryOpUSub AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Expr Call AttributeLoad NameLoad attr NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad NameLoad Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad BinOpSub SubscriptLoad NameLoad Index TupleLoad NameLoad NameLoad NameLoad AugAssignMult NameStore BinOpSub Num NameLoad AugAssignMult NameStore NameLoad AugAssignAdd NameStore NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Num NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Slice BinOpAdd NameLoad Num SubscriptLoad AttributeLoad NameLoad attr Slice BinOpAdd NameLoad Num AugAssignSub NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Expr Call AttributeLoad NameLoad attr Num AttributeLoad NameLoad attr NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Slice BinOpAdd NameLoad Num NameLoad AugAssignMult NameStore BinOpSub Num NameLoad AugAssignMult NameStore NameLoad AugAssignSub NameStore NameLoad Assign NameStore CompareGt BinOpAdd Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Num Assign SubscriptStore NameLoad ExtSlice Slice Index BinOpMod NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num If CompareGtE NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore CompareNotEq Call AttributeLoad NameLoad attr BinOpAdd CompareEq NameLoad NameLoad CompareEq NameLoad Num NameLoad If BoolOpOr BoolOpAnd UnaryOpNot NameLoad CompareGt NameLoad Num CompareEq NameLoad NameLoad body If NameLoad body Print BinOpMod Str NameLoad Break orelse If NameLoad body Print Str Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr CompareGt Call AttributeLoad NameLoad attr BinOpAdd NameLoad NameLoad Num Index Num Assign NameStore AttributeLoad NameLoad attr If CompareGt NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index NameLoad keyword Num Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad NameLoad body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr CompareEq NameLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index TupleLoad SubscriptLoad NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr NameLoad keyword Num Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad ExtSlice Slice Index NameLoad keyword Num Assign SubscriptStore NameLoad Index NameLoad Call AttributeLoad NameLoad attr NameLoad Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad Num Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If NameLoad body Return TupleLoad NameLoad NameLoad BinOpAdd NameLoad Num orelse Return TupleLoad NameLoad NameLoad decorator_list ClassDef bases NameLoad NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Num Num NameLoad NameLoad Str NameLoad body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return CompareEq AttributeLoad NameLoad attr Str decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call NameLoad NameLoad keyword Str If CompareEq AttributeLoad NameLoad attr Str body Assign AttributeStore NameLoad attr NameLoad orelse If CompareEq AttributeLoad NameLoad attr Str body Assign AttributeStore NameLoad attr UnaryOpUSub Call NameLoad NameLoad keyword NameLoad orelse Raise Call NameLoad BinOpMod Str Call NameLoad AttributeLoad NameLoad attr Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad If CompareNotEq AttributeLoad NameLoad attr Str body Assign AttributeStore NameLoad attr Call AttributeLoad SubscriptLoad NameLoad Index AttributeLoad NameLoad attr attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call NameLoad NameLoad Str If UnaryOpNot Call NameLoad NameLoad Str body Raise Call NameLoad Str Return Call NameLoad NameLoad AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A Affinity Propagation clustering algorithm. N/A numpy np base BaseEstimator ClusterMixin utils as_float_array check_array utils.validation check_is_fitted metrics euclidean_distances metrics pairwise_distances_argmin affinity_propagation N/A N/A S preference convergence_iter max_iter damping copy verbose return_n_iter N/A None 15 200 0.5 True False False N/A N/A Perform Affinity Propagation Clustering of data

    Read more in the :ref:`User Guide <affinity_propagation>`.

    Parameters
    ----------

    S : array-like, shape (n_samples, n_samples)
        Matrix of similarities between points

    preference : array-like, shape (n_samples,) or float, optional
        Preferences for each point - points with larger values of
        preferences are more likely to be chosen as exemplars. The number of
        exemplars, i.e. 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 (resulting in a moderate
        number of clusters). For a smaller amount of clusters, this can be set
        to the minimum value of the similarities.

    convergence_iter : int, optional, default: 15
        Number of iterations with no change in the number
        of estimated clusters that stops the convergence.

    max_iter : int, optional, default: 200
        Maximum number of iterations

    damping : float, optional, default: 0.5
        Damping factor between 0.5 and 1.

    copy : boolean, optional, default: True
        If copy is False, the affinity matrix is modified inplace by the
        algorithm, for memory efficiency

    verbose : boolean, optional, default: False
        The verbosity level

    return_n_iter : bool, default False
        Whether or not to return the number of iterations.

    Returns
    -------

    cluster_centers_indices : array, shape (n_clusters,)
        index of clusters centers

    labels : array, shape (n_samples,)
        cluster labels for each point

    n_iter : int
        number of iterations run. Returned only if `return_n_iter` is
        set to True.

    Notes
    -----
    See examples/cluster/plot_affinity_propagation.py for an example.

    References
    ----------
    Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
    Between Data Points", Science Feb. 2007
     N/A S N/A as_float_array S copy copy N/A n_samples N/A N/A S shape N/A 0 N/A N/A N/A N/A S shape N/A 0 N/A N/A S shape N/A 1 N/A N/A N/A ValueError N/A S must be a square array (shape=%s) N/A repr N/A S shape N/A N/A preference None N/A N/A preference N/A N/A np median S N/A N/A N/A damping 0.5 N/A damping 1 N/A N/A N/A ValueError damping must be >= 0.5 and < 1 N/A random_state N/A N/A N/A np random RandomState 0 N/A N/A N/A S flat N/A N/A n_samples 1 preference N/A A N/A N/A np zeros N/A n_samples n_samples N/A R N/A N/A np zeros N/A n_samples n_samples N/A tmp N/A N/A np zeros N/A n_samples n_samples N/A S N/A N/A N/A N/A N/A N/A np finfo N/A np double eps S N/A N/A N/A N/A np finfo N/A np double tiny 100 N/A N/A random_state randn n_samples n_samples N/A e N/A N/A np zeros N/A n_samples convergence_iter N/A ind N/A N/A np arange n_samples N/A it N/A range max_iter N/A N/A N/A N/A np add A S tmp N/A I N/A N/A np argmax tmp axis 1 N/A Y N/A tmp N/A N/A ind I N/A N/A tmp N/A N/A ind I N/A N/A np inf N/A Y2 N/A N/A np max tmp axis 1 N/A N/A N/A np subtract S N/A Y N/A N/A N/A None tmp N/A N/A tmp N/A N/A ind I N/A N/A S N/A N/A ind I Y2 N/A tmp N/A 1 damping N/A R damping N/A R tmp N/A N/A N/A np maximum R 0 tmp N/A N/A N/A tmp flat N/A N/A n_samples 1 N/A N/A R flat N/A N/A n_samples 1 N/A tmp N/A N/A np sum tmp axis 0 N/A dA N/A N/A N/A N/A np diag tmp copy N/A N/A N/A tmp clip 0 N/A np inf tmp N/A N/A N/A tmp flat N/A N/A n_samples 1 dA N/A tmp N/A 1 damping N/A A damping N/A A tmp N/A E N/A N/A N/A N/A np diag A N/A N/A np diag R 0 N/A N/A e N/A N/A N/A N/A it convergence_iter E N/A K N/A N/A np sum E axis 0 N/A N/A it convergence_iter N/A N/A se N/A N/A np sum e axis 1 N/A unconverged N/A N/A N/A np sum N/A N/A se convergence_iter N/A se 0 n_samples N/A N/A N/A N/A unconverged N/A K 0 N/A it max_iter N/A N/A verbose N/A N/A N/A Converged after %d iterations. it N/A N/A N/A verbose N/A N/A Did not converge N/A I N/A N/A N/A np where N/A N/A N/A np diag N/A A R 0 N/A 0 N/A K N/A I size N/A N/A K 0 N/A N/A c N/A N/A np argmax N/A S N/A N/A N/A I axis 1 N/A N/A c N/A I N/A N/A np arange K N/A k N/A range K N/A N/A ii N/A N/A N/A np where N/A c k N/A 0 N/A j N/A N/A np argmax N/A N/A np sum N/A S N/A N/A N/A ii N/A N/A N/A N/A np newaxis ii axis 0 N/A N/A I N/A k N/A ii N/A j N/A c N/A N/A np argmax N/A S N/A N/A N/A I axis 1 N/A N/A c N/A I N/A N/A np arange K N/A labels N/A I N/A c N/A cluster_centers_indices N/A N/A np unique labels N/A labels N/A N/A np searchsorted cluster_centers_indices labels N/A N/A labels N/A N/A np empty N/A n_samples 1 N/A cluster_centers_indices None N/A N/A N/A labels fill N/A np nan N/A return_n_iter N/A N/A N/A cluster_centers_indices labels N/A it 1 N/A N/A N/A cluster_centers_indices labels N/A AffinityPropagation N/A BaseEstimator ClusterMixin N/A N/A Perform Affinity Propagation Clustering of data.

    Read more in the :ref:`User Guide <affinity_propagation>`.

    Parameters
    ----------
    damping : float, optional, default: 0.5
        Damping factor between 0.5 and 1.

    convergence_iter : int, optional, default: 15
        Number of iterations with no change in the number
        of estimated clusters that stops the convergence.

    max_iter : int, optional, default: 200
        Maximum number of iterations.

    copy : boolean, optional, default: True
        Make a copy of input data.

    preference : array-like, shape (n_samples,) or float, optional
        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``
        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
        Whether to be verbose.


    Attributes
    ----------
    cluster_centers_indices_ : array, shape (n_clusters,)
        Indices of cluster centers

    cluster_centers_ : array, shape (n_clusters, n_features)
        Cluster centers (if affinity != ``precomputed``).

    labels_ : array, shape (n_samples,)
        Labels of each point

    affinity_matrix_ : array, shape (n_samples, n_samples)
        Stores the affinity matrix used in ``fit``.

    n_iter_ : int
        Number of iterations taken to converge.

    Notes
    -----
    See examples/cluster/plot_affinity_propagation.py for an example.

    The algorithmic complexity of affinity propagation is quadratic
    in the number of points.

    References
    ----------

    Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
    Between Data Points", Science Feb. 2007
     __init__ N/A N/A self damping max_iter convergence_iter copy preference affinity verbose N/A 0.5 200 15 True None euclidean False N/A N/A N/A self damping damping N/A N/A self max_iter max_iter N/A N/A self convergence_iter convergence_iter N/A N/A self copy copy N/A N/A self verbose verbose N/A N/A self preference preference N/A N/A self affinity affinity N/A _pairwise N/A N/A self N/A N/A N/A N/A N/A self affinity precomputed N/A property fit N/A N/A self X y N/A None N/A N/A  Create affinity matrix from negative euclidean distances, then
        apply affinity propagation clustering.

        Parameters
        ----------

        X: array-like, shape (n_samples, n_features) or (n_samples, n_samples)
            Data matrix or, if affinity is ``precomputed``, matrix of
            similarities / affinities.
         N/A X N/A check_array X accept_sparse csr N/A N/A N/A self affinity precomputed N/A N/A N/A self affinity_matrix_ X N/A N/A N/A N/A self affinity euclidean N/A N/A N/A self affinity_matrix_ N/A N/A euclidean_distances X squared True N/A N/A N/A ValueError N/A Affinity must be 'precomputed' or 'euclidean'. Got %s instead N/A str N/A self affinity N/A N/A N/A self cluster_centers_indices_ N/A self labels_ N/A self n_iter_ N/A affinity_propagation N/A self affinity_matrix_ N/A self preference max_iter N/A self max_iter convergence_iter N/A self convergence_iter damping N/A self damping copy N/A self copy verbose N/A self verbose return_n_iter True N/A N/A N/A self affinity precomputed N/A N/A N/A self cluster_centers_ N/A N/A N/A X N/A N/A self cluster_centers_indices_ copy N/A self N/A predict N/A N/A self X N/A N/A N/A Predict the closest cluster each sample in X belongs to.

        Parameters
        ----------
        X : {array-like, sparse matrix}, shape (n_samples, n_features)
            New data to predict.

        Returns
        -------
        labels : array, shape (n_samples,)
            Index of the cluster each sample belongs to.
         N/A N/A check_is_fitted self cluster_centers_indices_ N/A N/A N/A hasattr self cluster_centers_ N/A N/A N/A ValueError Predict method is not supported when affinity='precomputed'. N/A N/A pairwise_distances_argmin X N/A self cluster_centers_ N/A N/A