decision_function() returns None
Opened this issue · 0 comments
sugatc commented
Thanks for the package. When I try to implement LOF (or KNN) decision_function() on test data returns empty object. Is there a fix to this? Following is the code that replicates the issue (on GPU):
from pytod.models.lof import LOF
import torch
import numpy as np
x = np.array([[1, 2], [3, 4], [5, 6], [7, 8], [75,80]], dtype=np.float32)
x = torch.from_numpy(x)
y = np.array([[6, 5], [1, 2], [3, 4], [5, 1], [11,12]], dtype=np.float32)
y = torch.from_numpy(y)
lof = LOF(n_neighbors=2, device = 'cuda:0')
lof.fit(x)
print(lof.decision_function(y))