construct based irt library and add item response function
This commit is contained in:
parent
98f316da1e
commit
dd3188b798
0
app/lib/irt/item_information_function.py
Normal file
0
app/lib/irt/item_information_function.py
Normal file
12
app/lib/irt/item_response_function.py
Normal file
12
app/lib/irt/item_response_function.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from models.three_parameter_logitistc import ThreeParameterLogistic
|
||||||
|
|
||||||
|
class ItemResponseFunction():
|
||||||
|
def __init__(self, irt_model):
|
||||||
|
self.model_data = irt_model
|
||||||
|
|
||||||
|
def calculate(self, **kwargs):
|
||||||
|
if self.model_data.model == '3PL':
|
||||||
|
return ThreeParameterLogistic.new(self.model_data, kwargs).result
|
||||||
|
else:
|
||||||
|
# potentially error out
|
||||||
|
return None
|
13
app/lib/irt/models/three_parameter_logistic.py
Normal file
13
app/lib/irt/models/three_parameter_logistic.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class ThreeParameterLogistic:
|
||||||
|
def __init__(self, model_params, kwargs):
|
||||||
|
self.model_params = model_params
|
||||||
|
# check if exists, if not error out
|
||||||
|
self.b_param = kwargs['b_param']
|
||||||
|
self.e = 2.71828
|
||||||
|
self.theta = kwargs['theta']
|
||||||
|
|
||||||
|
def result(self):
|
||||||
|
a = self.model_params.a
|
||||||
|
c = self.model_params.c
|
||||||
|
|
||||||
|
return c + (1 - c) * (1 / (1 + e**(-a * (self.theta - self.b_param))))
|
0
app/lib/irt/test_information_function.py
Normal file
0
app/lib/irt/test_information_function.py
Normal file
0
app/lib/irt/test_response_function.py
Normal file
0
app/lib/irt/test_response_function.py
Normal file
Loading…
x
Reference in New Issue
Block a user