1
$\begingroup$

Given that I have a very sparse data matrix with continuous features, like this dataframe for example

 Feature_A  Feature_B  Feature_C....Feature_Z  
 0.3            0       0.1            0
 0.5            0.5     0              0
 0              0       1.0            0
 1.0            0       0              0  
 0.7            0       0              0
 1.0            0       0              0
 0.1            0       0.22          0.43

what is the best way to perform unsupervised anomaly detection on this kind of data? my initial idea was to perform some kind of dimensionality reduction first (e.g SVD or NMF) then do a simple anomaly detection technique on the resultant dense matrix (e.g Isolation Forest) but I'm not sure this is the best way to go.

$\endgroup$

1 Answer 1

1
$\begingroup$

If you do have sparse data, filling it with 0 could affect your model. It is possible to fill the gaps by interpolation or collaborative filtering. That being said, if you naturally have a lot of zeros in your dataset, any Anomaly Detection model can work with that.

Depending on how many dimensions and samples you have, you most likely don't need special tricks. It becomes necessary when the number of dimensions is greater than the number of samples. Or when you have a lot of dimensions (I mean, hundreds) and performance is an issue.

Dimension reduction is never lossless (except in trivial cases) and leads to difficult situations: Is 5% information loss acceptable? 1%? What if anomalies are compressed away? Is it acceptable to miss some anomalies?

For AD, models from sklearn are a really good start.

Having a sample of anomalies is important for any validation of the method you are using, even if unsupervised.

Good luck in your AD journey

$\endgroup$
3
  • $\begingroup$ What do you mean when you say "If you do have sparse data, filling it with 0 could affect your model"? The term "sparse data" used here to denote data that has a large proportion of zeros in it, so it's not clear how OP would be filling in any values with zero. $\endgroup$
    – Sycorax
    Commented Oct 26, 2020 at 22:18
  • 1
    $\begingroup$ @Sycorax Null data and 0 values are very different cases. In my answer, I tried to address both, but I would be very happy to have more inputs from the OP to improve my answer. $\endgroup$
    – Julien M
    Commented Oct 27, 2020 at 11:05
  • $\begingroup$ @JulienM the data came already filled with zeroes, the zero here means that the corresponding feature didn't occur $\endgroup$
    – greghouse1
    Commented Oct 27, 2020 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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