Contextual anomaly detection aims to identify abnormal behavior conditional on context variables, but practical deployments often face highly imbalanced context distributions where rare regimes can be critical information. Under such frequency bias, context-conditioned models can produce unstable decisions and excessive false alarms in rare contexts. We propose Rarity-Gated Feature-wise Linear Modulation (RGFiLM), a rarity-aware conditioning module that combines feature-wise modulation (i.e., context-conditioned scaling and shifting of hidden features) with a gate controlled by a data-driven rarity score. The rarity score is estimated from the empirical distribution of context variables and regulates how strongly context modulates intermediate representations: the gate becomes more decisive under rare contexts while remaining conservative under frequent contexts. We evaluate RGFiLM on maritime trajectory anomaly detection using AIS motion sequences with ERA5 environmental context in an environment-sensitive detour scenario. When instantiated in a sequential anomaly scoring pipeline, RGFiLM achieves the best mean F1--False Positive Rate (FPR) trade-off among the compared context-agnostic and context-conditioned methods. These results suggest that explicitly accounting for context rarity is an effective approach for reducing false alarms in context-sensitive anomaly detection.
翻译:上下文异常检测旨在根据上下文变量识别异常行为,但实际部署中常面临高度不平衡的上下文分布,其中稀有模式可能包含关键信息。在这种频率偏差下,上下文条件模型可能在稀有上下文中产生不稳定的决策和过多的误报。我们提出稀有性门控特征线性调制(RGFiLM),这是一种稀有性感知的条件模块,将特征级调制(即基于上下文对隐藏特征进行缩放和平移)与由数据驱动的稀有性分数控制的门控相结合。稀有性分数从上下文变量的经验分布中估计,并调节上下文对中间表示的影响强度:在稀有上下文中门控更为果断,而在常见上下文中保持保守。我们在环境敏感绕行场景中,利用AIS运动序列结合ERA5环境上下文评估了RGFiLM在海事轨迹异常检测中的表现。在序列异常评分流程中实例化后,RGFiLM在比较的无上下文与上下文条件方法中实现了最佳的F1分数与误报率(FPR)权衡。这些结果表明,显式考虑上下文稀有性是减少上下文敏感异常检测中误报的有效方法。