Package: pcla-elo
pcla-eloImplementation of the Elo AlgorithmThis package provides two functionalities:Running the Elo algorithm on a dataset of students, items, and scores for a given weighting parameterkFitting a dataset of students, items, and scores by running the elo algorithm iteratively and searching for the optimal weighting parameterk.Running the Elo algorithmUse therun_elofunction:run_elo(student_item_scores, k=1):This runs the elo algorithm for a given list of students, items, and scores and a weighting parameter k and returns the ability of each student,
the difficulty of each item, and the Root Mean Squared Error (RMSE) of the predictions.student_item_scores: a numpy array of shape mxn, where the first column is the student's name, the second column is the item's name and the third
column is the student's score on that item. A score of 1 is correct and a score of 0 is incorrect.k: an optional parameter that informs the algorithm how much weight to put on predictions. The range of k is [0, 1], with default value of k 1.run_eloreturns: a dictionary of the abilities of students, a dictionary of the difficulties or items, and the Root Mean Squared Error (RMSE) of predictions.
"""Example:student_item_scores = np.array([['good-1', 'easy-1', 1],
                                ['good-2', 'med-1', 1],
                                ['good-3', 'hard-1', 1],
                                ['med-2', 'hard-2', 0],
                                ['med-3', 'easy-1', 1],
                                ['med-3', 'med-1', 0],
                                ['med-3', 'med-2', 1],
                                ['bad-1', 'med-1', 0],
                                ['bad-1', 'med-2', 0],])k=0.5abilities, difficulties, rmse = run_elo(student_item_scores, k)abilitiesgood-1good-2good-3med-2med-3bad-10.250.250.25-0.250.172423-0.49509difficultieseasy-1med-1hard-1hard-2med-2-0.4689120.30037-0.250.25-0.008791rmse=0.49197252665675867Fitting a datasetUse thefit_elofunction:fit_elo(student_item_scores, step=0.01):This searches the optimal k for a given list of students, items, and scores and returns student abilities, item difficulties, the optimal k and
the Root Mean Squared Error (RMSE) of predictions for that optimal k. This function iteratively calls the run_elo function by varying the values of k
between 0 and 1, with a default step of 0.01.student_item_scores: a numpy array of shape mxn, where the first column is the student's name, the second column is the item's name and the third
column is the student's score on that item. A score of 1 is correct and a score of 0 is incorrect.step: an optional parameter that informs the algorithm by how much to increase k on each iteration. The default value of step is 0.01.fit_eloreturns a dictionary of the abilities of students, a dictionary of the difficulties or items, the optimal k, and
the Root Mean Squared Error (RMSE) of predictions.Examplestudent_item_scores = np.array([['good-1', 'easy-1', 1],
                                ['good-2', 'med-1', 1],
                                ['good-3', 'hard-1', 1],
                                ['med-2', 'hard-2', 0],
                                ['med-3', 'easy-1', 1],
                                ['med-3', 'med-1', 0],
                                ['med-3', 'med-2', 1],
                                ['bad-1', 'med-1', 0],
                                ['bad-1', 'med-2', 0],])step=0.05abilities, difficulties, optimal_k, rmse = fit_elo(student_item_scores, step)abilitiesgood-1good-2good-3med-2med-3bad-10.4750.4750.475-0.4750.246386-0.932702difficultieseasy-1med-1hard-1hard-2med-2-0.8392620.618782-0.4750.475-0.043206optimal_k=0.9500000000000003rmse=0.4839302619103182