skclean.detectors.ForestKDN¶
-
class
skclean.detectors.
ForestKDN
(n_neighbors=5, n_estimators=100, max_leaf_nodes=64, weight='distance', n_jobs=1, random_state=None)¶ Like KDN, but a trained Random Forest is used to compute pairwise similarity.
Specifically, for a pair of samples, their similarity is the percentage of times they belong to the same leaf. See [LM17] for details.
- Parameters
n_neighbors (int, default=5) – No of nearest neighbors to use to compute conf_score
n_estimators (int, default=101) – No of trees in Random Forest.
max_leaf_nodes (int, default=64) – Maximum no of leaves in each tree.
weight (string, default='distance') – weight function used in prediction. If ‘distance’, weights points by the inverse of their distance. If ‘uniform’, all points in each neighborhood are weighted equally.
n_jobs (int, default=1) – No of parallel cpu cores to use
random_state (int, default=None) – Set this value for reproducibility
Methods
__init__
([n_neighbors, n_estimators, …])Initialize self.
detect
(X, y)fit_transform
(X[, y])Fit to data, then transform it.
get_params
([deep])Get parameters for this estimator.
set_params
(**params)Set the parameters of this estimator.
transform
(X)