use proper numpy eulers constant, better irt model abstraction
This commit is contained in:
parent
6fbafcc1ec
commit
375db5f1c2
14
app/lib/irt/models/base.py
Normal file
14
app/lib/irt/models/base.py
Normal file
@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
|
||||
class Base:
|
||||
|
||||
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 = np.exp
|
||||
self.theta = kwargs['theta']
|
||||
|
||||
@classmethod
|
||||
def ability_estimate(self) -> float:
|
||||
return 0.0
|
@ -1,14 +1,8 @@
|
||||
import numpy as np
|
||||
|
||||
from girth import ability_mle
|
||||
|
||||
class Rasch:
|
||||
from lib.irt.models.base import *
|
||||
|
||||
def __init__(self, model_params, kwargs):
|
||||
self.model_params = model_params
|
||||
self.b_param = kwargs['b_param']
|
||||
self.e = 2.71828
|
||||
self.theta = kwargs['theta']
|
||||
class Rasch(Base):
|
||||
|
||||
def result(self):
|
||||
return 0.0
|
||||
|
@ -1,11 +1,6 @@
|
||||
class ThreeParameterLogistic:
|
||||
from lib.irt.models.base import *
|
||||
|
||||
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']
|
||||
class ThreeParameterLogistic(Base):
|
||||
|
||||
# contains the primary 3pl function, determining the probably of an inidividual
|
||||
# that an individual at a certain theta would get a particular question correct
|
||||
@ -14,9 +9,5 @@ class ThreeParameterLogistic:
|
||||
def result(self):
|
||||
a = self.model_params.a_param
|
||||
c = self.model_params.c_param
|
||||
return c + (1 - c) * (1 / (1 + self.e**(-a *
|
||||
return c + (1 - c) * (1 / (1 + self.e(-a *
|
||||
(self.theta - self.b_param))))
|
||||
|
||||
@classmethod
|
||||
def ability_estimate(self) -> float:
|
||||
return 0.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user