欢迎来到RankFan的Blogs

扩大
缩小

numdifftools

官方文档: numdifftools

numdiff-入门

Hession Matrix 中 step 对于结果影响很大。

有时会返回负数,直接 abs 处理是有问题的,

def cal_std(p, args, step=1e-5):
    h = ndt.Hessian(simpleGM, step=step, method='central')(p, args)
    T = args[1].shape[0]
    inv = np.linalg.pinv(h / T)
    se_p = np.sqrt(np.diag(abs(inv + 1e-6) / T))

    return se_p

posted on 2022-10-25 15:55  RankFan  阅读(21)  评论(0编辑  收藏  举报

导航