Isolation Kernel
ikpykit.kernel.IsoKernel ¶
IsoKernel(
method="anne",
n_estimators=200,
max_samples="auto",
random_state=None,
)
Bases: TransformerMixin
, BaseEstimator
Isolation Kernel.
Build Isolation Kernel feature vector representations via the feature map for a given dataset.
Isolation kernel is a data dependent kernel measure that is adaptive to local data distribution and has more flexibility in capturing the characteristics of the local data distribution. It has been shown promising performance on density and distance-based classification and clustering problems.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
The method to compute the isolation kernel feature. The available methods are: |
"anne"
|
n_estimators |
int
|
The number of base estimators in the ensemble. |
200
|
max_samples |
int
|
The number of samples to draw from X to train each base estimator.
|
"auto"
|
random_state |
int, RandomState instance or None
|
Controls the pseudo-randomness of the selection of the feature and split values for each branching step and each tree in the forest. Pass an int for reproducible results across multiple function calls.
See :term: |
None
|
References
.. [1] Qin, X., Ting, K.M., Zhu, Y. and Lee, V.C. "Nearest-neighbour-induced isolation similarity and its impact on density-based clustering". In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 33, 2019, July, pp. 4755-4762
Examples:
>>> from ikpykit.kernel import IsoKernel
>>> import numpy as np
>>> X = [[0.4,0.3], [0.3,0.8], [0.5, 0.4], [0.5, 0.1]]
>>> ik = IsoKernel().fit(X)
>>> X_trans = ik.transform(X)
>>> X_sim = ik.similarity(X)
Source code in ikpykit/kernel/_isokernel.py
75 76 77 78 79 80 81 |
|
fit ¶
fit(X, y=None)
Fit the model on data X.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
np.array of shape (n_samples, n_features)
|
The input instances. |
required |
Returns:
Name | Type | Description |
---|---|---|
self |
object
|
|
Source code in ikpykit/kernel/_isokernel.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
similarity ¶
similarity(X, dense_output=True)
Compute the isolation kernel similarity matrix of X.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
The input instances. |
required | |
dense_output |
Whether to return dense matrix of output. |
True
|
Returns:
Type | Description |
---|---|
The simalarity matrix are organised as a n_instances * n_instances matrix.
|
|
Source code in ikpykit/kernel/_isokernel.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
transform ¶
transform(X, dense_output=False)
Compute the isolation kernel feature of X.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
The input instances. |
required | |
dense_output |
Whether to return dense matrix of output. |
False
|
Returns:
Type | Description |
---|---|
The finite binary features based on the kernel feature map.
|
|
The features are organised as a n_instances by psi*t matrix.
|
|
Source code in ikpykit/kernel/_isokernel.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
|