utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:datadog-anomaly-detector 作者: takuti 项目源码 文件源码
def aryule(c, k):
    """Solve Yule-Walker equation.

    Args:
        c (numpy array): Coefficients (i.e. autocorrelation)
        k (int): Assuming the AR(k) model

    Returns:
        numpy array: k model parameters
            Some formulations solve: C a = -c,
            but we actually solve C a = c.

    """
    a = np.zeros(k)

    # ignore a singular matrix
    C = toeplitz(c[:k])
    if not np.all(C == 0.0) and np.isfinite(ln.cond(C)):
        a = np.dot(ln.inv(C), c[1:])

    return a
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号