You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

噪声信号中非稳定样本识别:现有算法优化方案咨询

噪声信号稳定状态异常值检测算法优化咨询

我需要识别噪声信号中的异常值,这类异常值对应信号未达到足够稳定状态的样本。我已实现如下检测算法:

def count_outliers(series, window_size=5, stability_threshold=0.1):
    rolling_min = series.rolling(window=window_size, min_periods=1, center=True).min()
    rolling_max = series.rolling(window=window_size, min_periods=1, center=True).max()
    rolling_mean = series.rolling(window=window_size, min_periods=1, center=True).mean()

    # Calculate the max-min over a rolling window
    max_min_difference = rolling_max - rolling_min

    # Calculate the mean over the rolling window
    mean_over_window = rolling_mean

    # Create a binary vector based on the condition
    # if the gap is high (transition/instability)
    outliers = ((max_min_difference > stability_threshold * mean_over_window) & ( abs(series - mean_over_window) > stability_threshold * mean_over_window)).astype(int)

    return outliers

但该算法效果未达预期,以下通过两个典型示例说明问题:

示例1:
使用如下测试序列:

test_vec=pd.Series([0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 
                7.03, 6.21, 15.84, 16.81, 17.78,
                30.16, 29.23, 28.3, 28.215, 28.13, 
                28.195, 28.245, 28.305, 28.305, 28.345])

期望将索引10至14(含)的样本标记为异常值,后续两个样本是否标记可依阈值调整,此点非关键。

示例2:
使用如下测试序列:

test_vec=pd.Series([0, 0, 0, 0, 0,
                0, 26.09, 11.36, 6.04, 0,
                0, 5.2, 26.15, 27.825, 29.5,
                0, 0, 5.32, 26.18, 27.37,
                28.56, 0, 0, 0, 0,
                0])

所有非零样本均应被标记为异常值,因信号始终未达足够稳定状态。

请问后续可尝试哪些优化方案?


内容的提问来源于stack exchange,提问作者MysteryGuy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 21:37:17