anomatools
anomatools copied to clipboard
Prediction logic
Hello,
I have this code written below, where x represents total water usage in specific period of day in litres. Now 80L and 200L are water leaks.
x = np.array([10, 10, 10, 12, 10, 11, 12, 13, 15, 10, 9, 0, 0, 0, 0, 80, 200]).reshape(-1, 1)
y = np.array([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1])
predict = np.array([0, 10, 75, 100]).reshape(-1, 1)
model = SSDO(k=7)
model.fit(x, y)
print(model.decision_function(predict))
print(model.predict(predict))
Now this prints:
[3.51776522e-04 3.89124379e-06 4.58417899e-01 4.98306538e-01]
[-1 -1 -1 -1]
Am I missing something or why does the algorithm think that 75L and 100L are normal water usages, as clearly they are very far away from normal usages? Because those values are indeed anomalous. Thanks.