aeon icon indicating copy to clipboard operation
aeon copied to clipboard

[BUG] Squaring weights in `KNeighborsTimeSeriesRegressor`

Open AnonymousCodes911 opened this issue 1 year ago • 0 comments

Describe the bug

refer: #1234 and #1240 see this we dont need to square the weights here !

Steps/Code to reproduce the bug

in class KNeighborsTimeSeriesRegressor(BaseRegressor):

        if self.weights == "distance":
            ws = distances[closest_idx]
            ws = ws**2 # after removing this

            # Using epsilon ~= 0 to avoid division by zero
            ws = 1 / (ws + np.finfo(float).eps)

Expected results

the test_time_series_neighbors.py should return : Expected predictions: [-216.06541863 -4.54133078 -324.7624233 ]

Actual results

But it returns :

AssertionError: assert 94.78595550443961 < 1e-06

and Actual predictions : [-144.41037008 -25.55876587 -229.9764678 ]

Versions

No response

AnonymousCodes911 avatar Mar 27 '24 20:03 AnonymousCodes911