したがって、アルファのベクトルが 1 つ、ベータのベクトルが 1 つあり、すべての推定値 (アルファの i から n およびベータの i から n) の合計が 60 になるときのシータを見つけようとしています。
math.exp(alpha[i] * (theta - beta[i])) / (1 + math.exp(alpha[i] * (theta - beta[i])
基本的に私がしたことは、theta = 0.0001 から開始し、これらすべての合計を計算して反復し、60 未満の場合は毎回 0.0001 を追加して続行し、60 を超えることを意味します。
この方法でシータの値を見つけました。問題は、Python を使用して 0.456 のシータを見つけるのに約 60 秒かかったということです。
このシータを見つけるためのより迅速なアプローチは何ですか (これを他のデータに適用したいため)?
def CalcTheta(score, alpha, beta):
theta = 0.0001
estimate = [score-1]
while(sum(estimate) < score):
theta += 0.00001
for x in range(len(beta)):
if x == 0:
estimate = []
estimate.append(math.exp(alpha[x] * (theta - beta[x])) / (1 + math.exp(alpha[x] * (theta - beta[x]))))
return(theta)