def onepl_jml(dataset, options=None)
Estimates parameters in an 1PL IRT Model.
dataset
options
discrimination
difficulty
def onepl_jml(dataset, options=None):
""" Estimates parameters in an 1PL IRT Model.
Args:
dataset: [items x participants] matrix of True/False Values
options: dictionary with updates to default options
Returns:
discrimination: (float) estimate of test discrimination
difficulty: (1d array) estimates of item diffiulties
Options:
* max_iteration: int
"""
options = validate_estimation_options(options)
# Defines item parameter update function
def _item_min_func(n_items, alphas, thetas,
betas, the_sign, counts):
# pylint: disable=cell-var-from-loop
def _alpha_min(estimate):
# Initialize cost evaluation to zero
cost = 0
for ndx in range(n_items):
# pylint: disable=cell-var-from-loop
scalar = the_sign[ndx, :] * estimate
def _beta_min(beta):
otpt = 1.0 / (1.0 + np.exp(scalar *
(thetas - beta)))
return -np.log(otpt).dot(counts)
# Solves for the difficulty parameter for a given item at
# a specific discrimination parameter
betas[ndx] = fminbound(_beta_min, -6, 6)
cost += _beta_min(betas[ndx])
return cost
min_alpha = fminbound(_alpha_min, 0.25, 5)
alphas[:] = min_alpha
return alphas, betas
result = _jml_abstract(dataset, _item_min_func, discrimination=1,
max_iter=options['max_iteration'])
return result[0][0], result[1]