私はフォンミーゼス分布のパラメータを手で計算しており、シピフォンミーゼスフィット関数と比較したいと考えました。フォンミーゼス分布のスカラー量の推定 - 不一致の回答
fit関数の結果が矛盾しています。
私の2つのデータセットは、D1 = [0.8pi、0.9pi]およびD2 =である[0.2pi、0.1pi]
マイPythonの機能は以下である:
def calc(data):
'''Takes a 1-D dataset and uses the scipy von mises to learn parameters and also calculates them by hand
using the regular M.L estimation for mean and the bannerjee et al (2005) approximation for concentraion factor
params: 1-D dataset in radians
'''
res = vonmises.fit(data, fscale=1)
mu = np.arctan(sum(np.sin(data))/sum(np.cos(data)))
A = sum(np.cos(data))*(1/len(data))*np.cos(mu)+sum(np.sin(data))*np.sin(mu)*(1/len(data))
k = A*(2-A**2)/(1-A**2)
print('mu and k by hand: ', mu, k)
print('mu and k from fit function', res[1],res[0])
次のように私の結果は次のとおり
出力:
>d1:
mu and k by hand: 0.471238898038 41.3480495503
mu and k from fit function 0.471238858132 40.8666881759
>d2:
mu and k by hand: -0.471238898038 -41.3480495503
mu and k from fit function 2.67035368203 40.8666556123
あなたは、番目のを見ることができるようにd2のe muは異なる。 kには異なる符号があります。しかし、 d1は非常に似ています。
この不一致がなぜ発生しているのかわかりません。私の見積もりに手作業で問題があるのだろうかと思っています。私はビショップのパターン認識のテキストブック109ページからM.L.Eの推定を使用しています。どんな洞察も感謝しています。