the big format
This commit is contained in:
@ -3,22 +3,28 @@ import logging
|
||||
from lib.irt.models.three_parameter_logistic import ThreeParameterLogistic
|
||||
from lib.errors.item_generation_error import ItemGenerationError
|
||||
|
||||
class ItemInformationFunction():
|
||||
def __init__(self, irt_model):
|
||||
self.model_data = irt_model
|
||||
|
||||
# determines the amount of information for a given question at a given theta (ability level)
|
||||
# further detailed on page 161, equation 4 here:
|
||||
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5978482/pdf/10.1177_0146621615613308.pdf
|
||||
def calculate(self, **kwargs):
|
||||
try:
|
||||
if self.model_data.model == '3PL':
|
||||
p = ThreeParameterLogistic(self.model_data, kwargs).result()
|
||||
q = 1 - p
|
||||
return (self.model_data.a_param * q * (p - self.model_data.c_param)**2) / (p * ((1 - self.model_data.c_param)**2))
|
||||
else:
|
||||
# potentially error out
|
||||
raise ItemGenerationError("irt model not supported or provided")
|
||||
except ZeroDivisionError as error:
|
||||
logging.error(error)
|
||||
raise ItemGenerationError("params not well formatted", error.args[0])
|
||||
class ItemInformationFunction():
|
||||
|
||||
def __init__(self, irt_model):
|
||||
self.model_data = irt_model
|
||||
|
||||
# determines the amount of information for a given question at a given theta (ability level)
|
||||
# further detailed on page 161, equation 4 here:
|
||||
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5978482/pdf/10.1177_0146621615613308.pdf
|
||||
def calculate(self, **kwargs):
|
||||
try:
|
||||
if self.model_data.model == '3PL':
|
||||
p = ThreeParameterLogistic(self.model_data, kwargs).result()
|
||||
q = 1 - p
|
||||
return (self.model_data.a_param * q *
|
||||
(p - self.model_data.c_param)**2) / (p * (
|
||||
(1 - self.model_data.c_param)**2))
|
||||
else:
|
||||
# potentially error out
|
||||
raise ItemGenerationError(
|
||||
"irt model not supported or provided")
|
||||
except ZeroDivisionError as error:
|
||||
logging.error(error)
|
||||
raise ItemGenerationError("params not well formatted",
|
||||
error.args[0])
|
||||
|
Reference in New Issue
Block a user