  Recent semi-supervised anomaly detection methods that are trained using small
labeled anomaly examples and large unlabeled data (mostly normal data) have
shown largely improved performance over unsupervised methods. However, these
methods often focus on fitting abnormalities illustrated by the given anomaly
examples only (i.e.,, seen anomalies), and consequently they fail to generalize
to those that are not, i.e., new types/classes of anomaly unseen during
training. To detect both seen and unseen anomalies, we introduce a novel deep
weakly-supervised approach, namely Pairwise Relation prediction Network
(PReNet), that learns pairwise relation features and anomaly scores by
predicting the relation of any two randomly sampled training instances, in
which the pairwise relation can be anomaly-anomaly, anomaly-unlabeled, or
unlabeled-unlabeled. Since unlabeled instances are mostly normal, the relation
prediction enforces a joint learning of anomaly-anomaly, anomaly-normal, and
normal-normal pairwise discriminative patterns, respectively. PReNet can then
detect any seen/unseen abnormalities that fit the learned pairwise abnormal
patterns, or deviate from the normal patterns. Further, this pairwise approach
also seamlessly and significantly augments the training anomaly data. Empirical
results on 12 real-world datasets show that PReNet significantly outperforms
nine competing methods in detecting seen and unseen anomalies. We also
theoretically and empirically justify the robustness of our model w.r.t.
anomaly contamination in the unlabeled data. The code is available at
https://github.com/mala-lab/PReNet.
