Module Expr Str Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias alias ImportFrom alias Assign NameStore ListLoad Str Str Str Str Str Str Assign NameStore Dict Str Str NameLoad NameLoad ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Num Str Str Str Num Num NameLoad Num 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 Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareLtE NameLoad Num body Raise Call NameLoad Str If CompareNotIn NameLoad NameLoad body Raise Call NameLoad Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body If CompareEq NameLoad Str body If CompareIn NameLoad AttributeLoad NameLoad attr body Return Str orelse If CompareIn NameLoad AttributeLoad NameLoad attr body Return Str orelse Raise Call NameLoad Call AttributeLoad Str attr NameLoad orelse If CompareIn NameLoad NameLoad body If CompareNotIn NameLoad AttributeLoad SubscriptLoad NameLoad Index NameLoad attr body Raise Call NameLoad Call AttributeLoad Str attr SubscriptLoad NameLoad Index NameLoad NameLoad Return NameLoad orelse Raise Call NameLoad Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad keyword Str keyword NameLoad Assign NameStore AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Assign NameStore Dict Assign AttributeStore NameLoad attr Call SubscriptLoad NameLoad Index NameLoad NameLoad keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad NameLoad keyword Str keyword NameLoad Assign NameStore SubscriptLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Index Num Assign NameStore BinOpMult AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad keyword AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword NameLoad AugAssignSub NameStore Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Num NameLoad body Expr Str If CompareNotIn AttributeLoad NameLoad attr ListLoad Str Str body Raise Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num keyword NameLoad If CompareEq AttributeLoad NameLoad attr Str body Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index NameLoad AttributeLoad NameLoad attr orelse If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr keyword TupleLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore BinOpDiv BinOpMult BinOpPow Call NameLoad BinOpMult Num NameLoad BinOpMult Num NameLoad BinOpDiv Num NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Return BinOpAdd SubscriptLoad NameLoad Index NameLoad BinOpMult NameLoad SubscriptLoad NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A 
Kernel Density Estimation
-------------------------
 N/A numpy np scipy.special gammainc base BaseEstimator utils check_array check_random_state utils.extmath row_norms ball_tree BallTree DTYPE kd_tree KDTree N/A VALID_KERNELS N/A gaussian tophat epanechnikov exponential linear cosine N/A TREE_DICT N/A ball_tree kd_tree BallTree KDTree KernelDensity N/A BaseEstimator N/A N/A Kernel Density Estimation

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

    Parameters
    ----------
    bandwidth : float
        The bandwidth of the kernel.

    algorithm : string
        The tree algorithm to use.  Valid options are
        ['kd_tree'|'ball_tree'|'auto'].  Default is 'auto'.

    kernel : string
        The kernel to use.  Valid kernels are
        ['gaussian'|'tophat'|'epanechnikov'|'exponential'|'linear'|'cosine']
        Default is 'gaussian'.

    metric : string
        The distance metric to use.  Note that not all metrics are
        valid with all algorithms.  Refer to the documentation of
        :class:`BallTree` and :class:`KDTree` for a description of
        available algorithms.  Note that the normalization of the density
        output is correct only for the Euclidean distance metric. Default
        is 'euclidean'.

    atol : float
        The desired absolute tolerance of the result.  A larger tolerance will
        generally lead to faster execution. Default is 0.

    rtol : float
        The desired relative tolerance of the result.  A larger tolerance will
        generally lead to faster execution.  Default is 1E-8.

    breadth_first : boolean
        If true (default), use a breadth-first approach to the problem.
        Otherwise use a depth-first approach.

    leaf_size : int
        Specify the leaf size of the underlying tree.  See :class:`BallTree`
        or :class:`KDTree` for details.  Default is 40.

    metric_params : dict
        Additional parameters to be passed to the tree for use with the
        metric.  For more information, see the documentation of
        :class:`BallTree` or :class:`KDTree`.
     __init__ N/A N/A self bandwidth algorithm kernel metric atol rtol breadth_first leaf_size metric_params N/A 1.0 auto gaussian euclidean 0 0 True 40 None N/A N/A N/A self algorithm algorithm N/A N/A self bandwidth bandwidth N/A N/A self kernel kernel N/A N/A self metric metric N/A N/A self atol atol N/A N/A self rtol rtol N/A N/A self breadth_first breadth_first N/A N/A self leaf_size leaf_size N/A N/A self metric_params metric_params N/A N/A N/A self _choose_algorithm N/A self algorithm N/A self metric N/A N/A bandwidth 0 N/A N/A N/A ValueError bandwidth must be positive N/A N/A kernel VALID_KERNELS N/A N/A N/A ValueError N/A N/A invalid kernel: '{0}' format kernel N/A _choose_algorithm N/A N/A self algorithm metric N/A N/A N/A N/A algorithm auto N/A N/A N/A metric N/A KDTree valid_metrics N/A N/A kd_tree N/A N/A N/A metric N/A BallTree valid_metrics N/A N/A ball_tree N/A N/A N/A ValueError N/A N/A invalid metric: '{0}' format metric N/A N/A N/A algorithm TREE_DICT N/A N/A N/A metric N/A N/A TREE_DICT N/A algorithm valid_metrics N/A N/A N/A ValueError N/A N/A invalid metric for {0}: '{1}' format N/A TREE_DICT N/A algorithm metric N/A algorithm N/A N/A N/A ValueError N/A N/A invalid algorithm: '{0}' format algorithm N/A fit N/A N/A self X y N/A None N/A N/A Fit the Kernel Density model on the data.

        Parameters
        ----------
        X : array_like, shape (n_samples, n_features)
            List of n_features-dimensional data points.  Each row
            corresponds to a single data point.
         N/A algorithm N/A N/A self _choose_algorithm N/A self algorithm N/A self metric N/A X N/A check_array X order C dtype DTYPE N/A kwargs N/A self metric_params N/A N/A kwargs None N/A N/A kwargs N/A N/A N/A self tree_ N/A N/A TREE_DICT N/A algorithm X metric N/A self metric leaf_size N/A self leaf_size kwargs N/A self N/A score_samples N/A N/A self X N/A N/A N/A Evaluate the density model on the data.

        Parameters
        ----------
        X : array_like, shape (n_samples, n_features)
            An array of points to query.  Last dimension should match dimension
            of training data (n_features).

        Returns
        -------
        density : ndarray, shape (n_samples,)
            The array of log(density) evaluations.
         N/A X N/A check_array X order C dtype DTYPE N/A N N/A N/A N/A N/A self tree_ data shape N/A 0 N/A atol_N N/A N/A self atol N N/A log_density N/A N/A N/A self tree_ kernel_density X h N/A self bandwidth kernel N/A self kernel atol atol_N rtol N/A self rtol breadth_first N/A self breadth_first return_log True N/A log_density N/A N/A np log N N/A log_density N/A score N/A N/A self X y N/A None N/A N/A Compute the total log probability under the model.

        Parameters
        ----------
        X : array_like, shape (n_samples, n_features)
            List of n_features-dimensional data points.  Each row
            corresponds to a single data point.

        Returns
        -------
        logprob : float
            Total log-likelihood of the data in X.
         N/A N/A N/A np sum N/A N/A self score_samples X N/A sample N/A N/A self n_samples random_state N/A 1 None N/A N/A Generate random samples from the model.

        Currently, this is implemented only for gaussian and tophat kernels.

        Parameters
        ----------
        n_samples : int, optional
            Number of samples to generate. Defaults to 1.

        random_state : RandomState or an int seed (0 by default)
            A random number generator instance.

        Returns
        -------
        X : array_like, shape (n_samples, n_features)
            List of samples.
         N/A N/A N/A self kernel N/A gaussian tophat N/A N/A N/A NotImplementedError N/A data N/A N/A np asarray N/A N/A self tree_ data N/A rng N/A check_random_state random_state N/A i N/A N/A rng randint N/A N/A data shape N/A 0 size n_samples N/A N/A N/A self kernel gaussian N/A N/A N/A N/A np atleast_2d N/A N/A rng normal N/A data N/A i N/A self bandwidth N/A N/A N/A N/A self kernel tophat N/A N/A dim N/A N/A data shape N/A 1 N/A X N/A N/A rng normal size N/A n_samples dim N/A s_sq N/A row_norms X squared True N/A correction N/A N/A N/A N/A gammainc N/A 0.5 dim N/A 0.5 s_sq N/A 1.0 dim N/A self bandwidth N/A N/A np sqrt s_sq N/A N/A N/A data N/A i N/A X N/A correction N/A N/A N/A N/A np newaxis N/A N/A