I have a problem where I want to identify Vendors with unusual high amount invoices. What would be the best way to identify such invoices?

I am trying to use Isolation Forest but having trouble in grouping by the result by Vendor.

Any help will be appreciated.

Data is in below format .

Vendor ID      Amount 
1                456
2                1000
1                489
3                 896
2                4576
  • $\begingroup$ maybe split data by vendor and create vendor-specific iForests? $\endgroup$
    – Nikos M.
    Mar 20 '21 at 19:35
  • $\begingroup$ Why doesn't a simple threshold based model work here (e.g. >100 invoices will be flagged as anomalous)? $\endgroup$
    – WBM
    Mar 20 '21 at 19:56
  • $\begingroup$ Else if all vendors are typical you can drop the vendor ID altogether and simply model all invoices together (since if vendors dont differ significantly, they are all "typical", then same rules apply to all) $\endgroup$
    – Nikos M.
    Mar 21 '21 at 10:31
  • $\begingroup$ How do you define unusual? { V1:[100, 120, 15000], V2:[15000, 16000, 14000] }. Which one is unusual high out of the two examples? $\endgroup$
    – 10xAI
    Mar 21 '21 at 14:26
  • $\begingroup$ @NikosM. All Vendors arent typical. your 1st point is what I intend to implement but facing issues with the out put that's being generated $\endgroup$ Mar 22 '21 at 17:07

Since the dataset has only a single dimension, I believe you can apply the simple Outlier detection technique for each vendor.

  • The quantile method
  • The MAD method [Read Here ]

If you want a single model,
Then define the vendor-wise standard deviation as feature and then apply the above method.

e.g. for { V1:[100, 120, 15000], V2:[15000, 16000, 14000] }
Feature value will be - 7019, 816

import numpy as np
arr_1 = np.array([100, 120, 15000]) 
arr_2 = np.array([15000, 16000, 14000])


Output - (7019.218063447112, 816.496580927726)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.