Kernel Density Estimation.
Read more in the User Guide.
new KernelDensity(opts?: object): KernelDensity;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
opts.algorithm? |
"auto" | "ball_tree" | "kd_tree" |
The tree algorithm to use. Default Value 'auto' |
opts.atol? |
number |
The desired absolute tolerance of the result. A larger tolerance will generally lead to faster execution. Default Value 0 |
opts.bandwidth? |
number | "scott" | "silverman" |
The bandwidth of the kernel. If bandwidth is a float, it defines the bandwidth of the kernel. If bandwidth is a string, one of the estimation methods is implemented. Default Value 1 |
opts.breadth_first? |
boolean |
If true (default), use a breadth-first approach to the problem. Otherwise use a depth-first approach. Default Value true |
opts.kernel? |
"linear" | "cosine" | "exponential" | "gaussian" | "tophat" | "epanechnikov" |
The kernel to use. Default Value 'gaussian' |
opts.leaf_size? |
number |
Specify the leaf size of the underlying tree. See BallTree or KDTree for details. Default Value 40 |
opts.metric? |
string |
Metric to use for distance computation. See the documentation of scipy.spatial.distance and the metrics listed in distance\_metrics for valid metric values. Not all metrics are valid with all algorithms: refer to the documentation of BallTree and KDTree . Note that the normalization of the density output is correct only for the Euclidean distance metric. Default Value 'euclidean' |
opts.metric_params? |
any |
Additional parameters to be passed to the tree for use with the metric. For more information, see the documentation of BallTree or KDTree . |
opts.rtol? |
number |
The desired relative tolerance of the result. A larger tolerance will generally lead to faster execution. Default Value 0 |
Defined in: generated/neighbors/KernelDensity.ts:23
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/neighbors/KernelDensity.ts:158
Fit the Kernel Density model on the data.
fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
List of n_features-dimensional data points. Each row corresponds to a single data point. |
opts.sample_weight? |
ArrayLike |
List of sample weights attached to the data X. |
opts.y? |
any |
Ignored. This parameter exists only for compatibility with Pipeline . |
Promise
<any
>
Defined in: generated/neighbors/KernelDensity.ts:175
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/neighbors/KernelDensity.ts:224
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/neighbors/KernelDensity.ts:110
Generate random samples from the model.
Currently, this is implemented only for gaussian and tophat kernels.
sample(opts: object): Promise<ArrayLike[]>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.n_samples? |
number |
Number of samples to generate. Default Value 1 |
opts.random_state? |
number |
Determines random number generation used to generate random samples. Pass an int for reproducible results across multiple function calls. See Glossary. |
Promise
<ArrayLike
[]>
Defined in: generated/neighbors/KernelDensity.ts:261
Compute the total log-likelihood under the model.
score(opts: object): Promise<number>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
List of n_features-dimensional data points. Each row corresponds to a single data point. |
opts.y? |
any |
Ignored. This parameter exists only for compatibility with Pipeline . |
Promise
<number
>
Defined in: generated/neighbors/KernelDensity.ts:301
Compute the log-likelihood of each sample under the model.
score_samples(opts: object): Promise<ArrayLike>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
An array of points to query. Last dimension should match dimension of training data (n_features). |
Promise
<ArrayLike
>
Defined in: generated/neighbors/KernelDensity.ts:339
Request metadata passed to the fit
method.
Note that this method is only relevant if enable\_metadata\_routing=True
(see sklearn.set\_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
set_fit_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.sample_weight? |
string | boolean |
Metadata routing for sample\_weight parameter in fit . |
Promise
<any
>
Defined in: generated/neighbors/KernelDensity.ts:376
boolean
=false
Defined in: generated/neighbors/KernelDensity.ts:21
boolean
=false
Defined in: generated/neighbors/KernelDensity.ts:20
PythonBridge
Defined in: generated/neighbors/KernelDensity.ts:19
string
Defined in: generated/neighbors/KernelDensity.ts:16
any
Defined in: generated/neighbors/KernelDensity.ts:17
Value of the bandwidth, given directly by the bandwidth parameter or estimated using the ‘scott’ or ‘silverman’ method.
bandwidth_(): Promise<number>;
Promise
<number
>
Defined in: generated/neighbors/KernelDensity.ts:482
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/neighbors/KernelDensity.ts:457
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/neighbors/KernelDensity.ts:409
py(): PythonBridge;
PythonBridge
Defined in: generated/neighbors/KernelDensity.ts:97
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/neighbors/KernelDensity.ts:101
The tree algorithm for fast generalized N-point problems.
tree_(): Promise<any>;
Promise
<any
>
Defined in: generated/neighbors/KernelDensity.ts:434