irt_evaluation

def irt_evaluation(difficulty, discrimination, thetas)

Evaluation of unidimensional IRT model.

Evaluates an IRT model and returns the exact values. This function supports only unidimemsional models

Assumes the model P(theta) = 1.0 / (1 + exp(discrimination * (theta - difficulty)))

Args

difficulty
(1d array) item difficulty parameters
discrimination
(1d array | number) item discrimination parameters
thetas
(1d array) person abilities

Returns

probabilities
(2d array) evaluation of sigmoid for given inputs
Expand source code
def irt_evaluation(difficulty, discrimination, thetas):
    """ Evaluation of unidimensional IRT model.

    Evaluates an IRT model and returns the exact values.  This function
    supports only unidimemsional models

    Assumes the model
        P(theta) = 1.0 / (1 + exp(discrimination * (theta - difficulty)))

    Args:
        difficulty: (1d array) item difficulty parameters
        discrimination:  (1d array | number) item discrimination parameters
        thetas: (1d array) person abilities

    Returns:
        probabilities: (2d array) evaluation of sigmoid for given inputs
    """
    # If discrimination is a scalar, make it an array
    if np.atleast_1d(discrimination).size == 1:
        discrimination = np.full_like(difficulty, discrimination,
                                      dtype='float')

    kernel = difficulty[:, None] - thetas
    kernel *= discrimination[:, None]
    return 1.0 / (1 + np.exp(kernel))