gradelib.policies.drops
- Drop low-scoring assignments
- gradelib.policies.drops.drop_most_favorable(gradebook: Gradebook, n: int, within: Collection[str] | None = None)
Drop the lowest n grades within a group of assignments.
If all assignments are worth the same number of points, dropping the assignment with the lowest score is most advantageous to the student. However, if the assignments are not worth the same number of points, the best strategy for the student is not necessarily to drop to assignment with the smallest score. In this case, the problem of determining the optimal set of assignments to drop in order to maximize the overall score is non-trivial.
In this implementation, dropping assignments is performed via a brute-force algorithm: each possible combination of kept assignments is tested, and the one which yields the largest total_points / maximum_points_possible is used. The time complexity of this approach is combinatorial, and therefore it is not recommended beyond small problem sizes. For a better algorithm, see: http://cseweb.ucsd.edu/~dakane/droplowest.pdf
If an assignment has already been marked as dropped, it won’t be considered for dropping. This is useful, for instance, when a student’s assignment is dropped due to an external circumstance.
Modifies the input gradebook.
- Parameters:
gradebook (Gradebook) – The gradebook that will be modified.
n (int) – The number of grades to drop.
within (Optional[Collection[str]]) – A collection of assignment names; the lowest score among them will be dropped. If None, all assignments will be used. Default: None
- Raises:
ValueError – If within is empty, or if n is not a positive integer.