尝试使用TensorFlow中的优化器对Rasch模型参数进行估计。TF估计出的数值与使用 Joint Maximum Likelihood Estimation (JMLE)的估计结果差距有些大。Likelihood为
$$ L = \sum_{j = 1}^{N} r_j*\theta_j - \sum_{i}^{n} s_i*\beta_i - \sum_{j = 1}^{N} \sum_{i = 1}^{n} log[1 + exp^{(\theta_j - \beta_i)}] $$
其中 \(\theta) 是学生能力值,\(\beta) 是题目难度,\(\r_j) 是得分情况。例如,10道题目,\(\r_j) 分数为1到9(0,10分在JML中不算模型估计中)。\(\s_i) 是每道题目正确率,比如有1000个人考试,第一道题目有多少人答对。根据以上信息,可以写出Likelihood的估计方式
raw_score_fq = tf.constant([[53, 85, 127, 148, 163, 120, 135, 95, 50]],
dtype = tf.float32)
item_score_fq = tf.constant([[497,622,366,522,508,381,436,526,400,628]],
dtype = tf.float32)
J = tf.constant([[1, 2, 3, 4, 5, 6, 7, 8, 9]],
dtype = tf.float32)
theta = tf.Variable(initial_value = tf.math.log(J/(10 - J)) ,
trainable=True,
dtype=tf.float32)
diff = tf.Variable(initial_value = tf.reshape(tf.math.log((976 - item_score_fq)/item_score_fq), shape = (10, 1)),
trainable=True,
dtype=tf.float32)
def cost_(theta, diff):
ll = tf.reduce_sum(Jtheta) - tf.reduce_sum(tf.reshape(item_score_fq, shape = (10, 1))diff) \
- tf.reduce_sum(tf.math.log(1 + tf.math.exp(theta - diff)))
return(-ll)
opt = tf.keras.optimizers.Adam(learning_rate = 0.001)
loss_fn = lambda: cost_(theta, diff)
var_list = [diff, theta]
for _ in range(1000):
opt.minimize(loss_fn, var_list)
想询问一下大家,通过优化器求解的值和JML方式求解的值差异较大。。这两种方式估计的数值哪种更合适呢?