pyod icon indicating copy to clipboard operation
pyod copied to clipboard

Issues with plotting the DecisionBoundaryDisplay

Open ETTAN93 opened this issue 9 months ago • 0 comments

When using the sklearn's Isolation forest model, I can use the DecisionBoundaryDisplay function to plot for all 3 different response methods, e.g. 'predict' and 'decision_function', without any issues. Example is given here.

This is how I initialize the models.

from sklearn.ensemble import IsolationForest
iforest_model = IsolationForest(
    n_estimators=100,
    contamination=0.005,
    random_state=24,
)

iforest_model.fit(x_train)

disp = DecisionBoundaryDisplay.from_estimator(
        estimator=iforest_model,
        X=x_df_to_plot,
        response_method='decision_function',
        alpha=0.5,
    )

However, if I use the IForest from PYOD and try to do the same, I get the error below

from pyod.models.iforest import IForest
iforest_model = IForest(
    n_estimators=100,
    contamination=0.005,
    random_state=24,
)

image

Is a different object returned entirely from IForest compared to sklearn's version? How would I plot the same plot in PYOD?

ETTAN93 avatar May 14 '24 18:05 ETTAN93