sum the Item iif and irf as well as the Bundle tif and trf
This commit is contained in:
parent
c8bbe9583b
commit
b3c5808849
@ -21,3 +21,19 @@ class Bundle(BaseModel):
|
||||
def trf(self, irt_model: IRTModel, theta: float) -> float:
|
||||
return TestResponseFunction(irt_model).calculate(self.items,
|
||||
theta=theta)
|
||||
|
||||
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
|
||||
|
@ -6,7 +6,6 @@ from models.attribute import Attribute
|
||||
from lib.irt.item_response_function import ItemResponseFunction
|
||||
from lib.irt.item_information_function import ItemInformationFunction
|
||||
|
||||
|
||||
class Item(BaseModel):
|
||||
id: int
|
||||
passage_id: Optional[int]
|
||||
@ -35,3 +34,19 @@ class Item(BaseModel):
|
||||
) == ref_attribute.value.lower():
|
||||
return True
|
||||
return False
|
||||
|
||||
def iif_sum(self, solver_run):
|
||||
total = 0
|
||||
|
||||
for target in solver_run.objective_function.tif_targets:
|
||||
total += self.iif(solver_run, target.theta)
|
||||
|
||||
return total
|
||||
|
||||
def irf_sum(self, solver_run):
|
||||
total = 0
|
||||
|
||||
for target in solver_run.objective_function.tif_targets:
|
||||
total += self.irf(solver_run, target.theta)
|
||||
|
||||
return total
|
||||
|
@ -1,7 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Target(BaseModel):
|
||||
theta: float
|
||||
value: float
|
||||
|
@ -168,9 +168,8 @@ class LoftService(Base):
|
||||
form_items = service_helper.solution_items(problem.variables(), self.solver_run)
|
||||
|
||||
# add form to solution
|
||||
solution.forms.append(
|
||||
Form.create(form_items, self.solver_run,
|
||||
LpStatus[problem.status]))
|
||||
solution.forms.append(Form.create(form_items, self.solver_run, LpStatus[problem.status]))
|
||||
|
||||
logging.info('Form generated and added to solution...')
|
||||
|
||||
# successfull form, increment
|
||||
|
Loading…
x
Reference in New Issue
Block a user