45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
from pydantic import BaseModel
|
|
from typing import List
|
|
|
|
from lib.irt.test_information_function import TestInformationFunction
|
|
from lib.irt.test_response_function import TestResponseFunction
|
|
|
|
from models.item import Item
|
|
from models.irt_model import IRTModel
|
|
|
|
|
|
class Bundle(BaseModel):
|
|
id: int
|
|
count: int
|
|
items: List[Item]
|
|
type: str
|
|
|
|
def tif(self, irt_model: IRTModel, theta: float) -> float:
|
|
return 0.9
|
|
# return TestInformationFunction(irt_model).calculate(self.items,
|
|
# theta=theta)
|
|
|
|
def trf(self, irt_model: IRTModel, theta: float) -> float:
|
|
return 0.9
|
|
# return TestResponseFunction(irt_model).calculate(self.items,
|
|
# theta=theta)
|
|
|
|
def tif_trf_sum(self, solver_run):
|
|
return self.__trf_sum(solver_run) + self.__tif_sum(solver_run)
|
|
|
|
def __tif_sum(self, solver_run):
|
|
total = 0
|
|
|
|
for target in solver_run.objective_function.tcc_targets:
|
|
total += self.tif(solver_run.irt_model, target.theta)
|
|
|
|
return total
|
|
|
|
def __trf_sum(self, solver_run):
|
|
total = 0
|
|
|
|
for target in solver_run.objective_function.tcc_targets:
|
|
total += self.trf(solver_run.irt_model, target.theta)
|
|
|
|
return total
|