저는 Von Mises 분포의 매개 변수를 직접 계산하고 Scipy Von Mises 적합 함수와 비교하려고합니다.Von Mises 분포 파라미터 - 일치하지 않는 응답
나는 fit 함수에서 일치하지 않는 결과를 얻고 있습니다. 다음
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 = 0.8pi, 0.9pi] 및 D2 = 0.2pi, 0.1pi]
내 파이썬 기능은 아래와 같다이다 :
출력 :
>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 그러나 매우 비슷합니다.
왜 이러한 불일치가 발생하는지 잘 모르겠습니다. 나는 손으로 내 견적에 문제가 있는지 궁금 하네. Bishop 's Pattern recognition 텍스트 북 108 페이지에서 M.L.E 추정을 사용하고 있습니다. 모든 통찰력이 인정됩니다.