added iif and tif functions
This commit is contained in:
parent
258915b08f
commit
3b83aad6bd
@ -0,0 +1,14 @@
|
|||||||
|
from lib.irt.models.three_parameter_logistic import ThreeParameterLogistic
|
||||||
|
|
||||||
|
class ItemInformationFunction():
|
||||||
|
def __init__(self, irt_model):
|
||||||
|
self.model_data = irt_model
|
||||||
|
|
||||||
|
def calculate(self, **kwargs):
|
||||||
|
if self.model_data.model == '3PL':
|
||||||
|
p = ThreeParameterLogistic(self.model_data, kwargs).result()
|
||||||
|
q = 1 - p
|
||||||
|
return self.model_data.a_param**2 * ((q / p) * ((p - (self.model_data.c_param**2)) / (1 - (self.model_data.c_param**2))))
|
||||||
|
else:
|
||||||
|
# potentially error out
|
||||||
|
return None
|
@ -0,0 +1,16 @@
|
|||||||
|
from lib.irt.item_information_function import ItemInformationFunction
|
||||||
|
|
||||||
|
class TestInformationFunction():
|
||||||
|
def __init__(self, irt_model):
|
||||||
|
self.irt_model = irt_model
|
||||||
|
self.iif = ItemInformationFunction(irt_model)
|
||||||
|
|
||||||
|
def calculate(self, items, **kwargs):
|
||||||
|
sum = 0
|
||||||
|
|
||||||
|
for item in items:
|
||||||
|
result = self.iif.calculate(b_param=item.b_param, theta=kwargs['theta'])
|
||||||
|
item.iif = result
|
||||||
|
sum += item.iif
|
||||||
|
|
||||||
|
return sum
|
@ -8,7 +8,7 @@ from sqs_listener.daemon import Daemon
|
|||||||
|
|
||||||
print("Starting Solver Service (v0.3.1)...")
|
print("Starting Solver Service (v0.3.1)...")
|
||||||
|
|
||||||
# # listen to the solver queue
|
# listen to the solver queue
|
||||||
while True:
|
while True:
|
||||||
msg = aws_helper.receive_message(os.environ['SOLVER_SQS_INGEST_QUEUE'])
|
msg = aws_helper.receive_message(os.environ['SOLVER_SQS_INGEST_QUEUE'])
|
||||||
|
|
||||||
|
@ -8,3 +8,4 @@ class Item(BaseModel):
|
|||||||
attributes: List[Attribute]
|
attributes: List[Attribute]
|
||||||
b_param: int
|
b_param: int
|
||||||
irf: float = 0.00
|
irf: float = 0.00
|
||||||
|
iif: float = 0.00
|
||||||
|
@ -9,6 +9,9 @@ from models.solver_run import SolverRun
|
|||||||
from models.solution import Solution
|
from models.solution import Solution
|
||||||
from models.form import Form
|
from models.form import Form
|
||||||
|
|
||||||
|
from lib.irt.test_response_function import TestResponseFunction
|
||||||
|
from lib.irt.test_information_function import TestInformationFunction
|
||||||
|
|
||||||
from services.base import Base
|
from services.base import Base
|
||||||
|
|
||||||
class LoftService(Base):
|
class LoftService(Base):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user