get ability estimation from source
This commit is contained in:
23
app/lib/irt/models/rasch.py
Normal file
23
app/lib/irt/models/rasch.py
Normal file
@ -0,0 +1,23 @@
|
||||
import numpy as np
|
||||
|
||||
from girth import ability_mle
|
||||
|
||||
class Rasch:
|
||||
|
||||
def __init__(self, model_params, kwargs):
|
||||
self.model_params = model_params
|
||||
self.b_param = kwargs['b_param']
|
||||
self.e = 2.71828
|
||||
self.theta = kwargs['theta']
|
||||
|
||||
def result(self):
|
||||
return 0.0
|
||||
|
||||
@classmethod
|
||||
def ability_estimate(self, items) -> float:
|
||||
# we'll likely have to change this to something more robust
|
||||
# when we get into more complex response types
|
||||
responses = np.array([[int(item.response)] for item in items])
|
||||
difficulty = np.array([item.b_param for item in items])
|
||||
discrimination = np.linspace(1, 1, len(difficulty))
|
||||
return ability_mle(responses, difficulty, discrimination)
|
@ -16,3 +16,7 @@ class ThreeParameterLogistic:
|
||||
c = self.model_params.c_param
|
||||
return c + (1 - c) * (1 / (1 + self.e**(-a *
|
||||
(self.theta - self.b_param))))
|
||||
|
||||
@classmethod
|
||||
def ability_estimate(self) -> float:
|
||||
return 0.0
|
||||
|
Reference in New Issue
Block a user