vastorbit.machine_learning.memmodel.ensemble.IsolationForest.predict¶
- IsolationForest.predict(X: Annotated[list | ndarray, 'Array Like Structure']) ndarray¶
Predicts using the
IsolationForestmodel.- Parameters:
X (ArrayLike) – The data on which to make the prediction.
- Returns:
Predicted values.
- Return type:
numpy.array
Examples
Import the required modules and create many
BinaryTreeAnomaly.from vastorbit.machine_learning.memmodel.tree import BinaryTreeAnomaly model1 = BinaryTreeAnomaly( children_left = [1, 3, None, None, None], children_right = [2, 4, None, None, None], feature = [0, 1, None, None, None], threshold = ["female", 30, None, None, None], value = [None, None, [2, 10], [3, 4], [7, 8]], psy = 100, ) model2 = BinaryTreeAnomaly( children_left = [1, 3, None, None, None], children_right = [2, 4, None, None, None], feature = [0, 1, None, None, None], threshold = ["female", 30, None, None, None], value = [None, None, [1, 11], [2, 5], [5, 10]], psy = 100, ) model3 = BinaryTreeAnomaly( children_left = [1, 3, None, None, None], children_right = [2, 4, None, None, None], feature = [0, 1, None, None, None], threshold = ["female", 30, None, None, None], value = [None, None, [3, 9], [1, 6], [8, 7]], psy = 100, )
Let’s create a model.
from vastorbit.machine_learning.memmodel.ensemble import IsolationForest model_isf = IsolationForest(trees = [model1, model2, model3])
Create a dataset.
data = [["male", 100], ["female", 20], ["female", 50]]
Compute the predictions.
model_isf.predict(data)
Note
Refer to
IsolationForestfor more information about the different methods and usages.