Open
Description
Describe the bug
LOF
as well as PyODAdapter(LOF())
does not seem to be producing same output for fit_predict()
as compared to fit().predict()
.
See #2818
Steps/Code to reproduce the bug
import numpy as np
from aeon.testing.testing_data import FULL_TEST_DATA_DICT
from aeon.base._base import _clone_estimator
from aeon.anomaly_detection import LOF
est = LOF(leaf_size=10, n_neighbors=5, stride=2)
est1 = _clone_estimator(est, random_state=42)
est2 = _clone_estimator(est, random_state=42)
datatype = 'UnivariateSeries-None'
X = FULL_TEST_DATA_DICT[datatype]['train'][0]
y = FULL_TEST_DATA_DICT[datatype]['train'][1]
est1.fit(X, y)
y_pred = est1.predict(X)
y_pred
>>> array([0.99658101, 0.99658101, 0.98995043, 0.98995043, 0.99216063,
0.99216063, 0.98995043, 0.98995043, 0.99127655, 0.99127655,
0.98862432, 0.98862432, 0.98995043, 0.98995043, 0.98774024,
0.98774024, 0.98995043, 0.98995043, 0.98331986, 0.98331986])
y_pred2 = est2.fit_predict(X, y)
y_pred2
>>> array([1.03501792, 1.03501792, 1.02085908, 1.02085908, 1.01276639,
1.01276639, 1.00540476, 1.00540476, 1.00364001, 1.00364001,
0.99330039, 0.99330039, 0.98995043, 0.98995043, 0.98774024,
0.98774024, 0.98995043, 0.98995043, 0.98331986, 0.98331986])
Expected results
np.allclose(y_pred, y_pred2)
>>> True
Actual results
np.allclose(y_pred, y_pred2)
>>> False
Versions
No response