Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Natural weighting: Difference between revisions

From MoodleDocs
Line 47: Line 47:
=== Category editing ===
=== Category editing ===


;Legacy screen
;Legacy screen Optional Natural Weights Forced Natural Weights
 
[[File:LegacyNaturalWeights.png]] [[File:OptionalNaturalWeights]] [[File:ForcedNaturalWeights]]
;Optional Natural Weights
 
;Forced Natural Weights


=== Admin settings ===
=== Admin settings ===

Revision as of 17:50, 12 July 2014

Natural Weighting
Project state Specification
Tracker issue https://tracker.moodle.org/browse/MDL-43378
Discussion https://moodle.org/mod/forum/discuss.php?d=245442
Assignee Moodle HQ

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.



Natural weighting is a modification to how grades are combined.

When 'Sum of Grades' aggregation is chosen (and natural weighting is active), there will be a weight column with form fields, looking exactly like "Weighted mean" is now. By default, the weight column shows the natural weights given to all categories and items based on gradebook structure (exactly as Simple weighted mean does now).

Weights can be overridden by modifying the values in the form fields. All the numbers in a category will be automatically normalised (on save) to add up to 100%.

A "Reset weights" button in each category resets the weights to their defaults.

link Natural Weights Screen

Rationale

This interface is expected to suit the needs of most teachers, and will allow them to avoid using other aggregations. Admins can therefore hide the aggregation menu and simplify the interface. If it turns out that this is enough for everyone then we can potentially remove quite a lot of aggregation code from the gradebook at a later stage, improving speed and readability.

Sum of grades
Leave all the weightings to be the same
Mean of grades
Set all weights equal
Weighted mean of grades
Adjust natural weights as desired (same as legacy)
Simple weighted mean of grades
Leave all the weights to be the same (same as Sum except it now provides for accurate category and course totals)
Mean of grades (with extra credits)
Any aggregation scheme here can allow for extra credit under this method. Extra credit has a natural weight that takes the total container (category/ course) weight above 100% (hence, 'extra')
Median of grades
In the five years since Moodle 1.95 came out I've asked many groups for a valid pedagogical use case for this method and never been given a response.
Lowest grade
If the instructor can't figure this out for themselves with a glance they should not be instructing. Still available through a calculation.
Highest grade
Same as Lowest grade. Keep in mind, aggregation methods operate on 'A USER'S' grades, not across users.
Mode of grades
Once again, in the five years since Moodle 1.95 came out I've asked many groups for a valid pedagogical use case for this method and never been given a response.

Implementation stages

To be safe, we plan to implement this in stages:

STAGE 1) Implement natural weighting as part of the Sum of Grades aggregation type, with admin settings that allow them to disable all other aggregations if they choose. (Moodle 2.8)

STAGE 2) Once people have been using this for a while, explore the possibility of removing other aggregation code or making them into optional plugins. (Moodle 3.0 perhaps)


Interfaces

Category editing

Legacy screen Optional Natural Weights Forced Natural Weights

LegacyNaturalWeights.png File:OptionalNaturalWeights File:ForcedNaturalWeights

Admin settings

New setting to "Force Natural Weighting", "Optional Natural Weighting" or "Disable Natural Weighting"

- Force Natural Weighting - this will hide the aggregation menu and all new categories will default to "Sum of grades" and natural weights. It will not affect existing gradebooks with other aggregations set, so we probably need some sort of upgrade script that can detect, display and optionally convert any other aggregations to this one as required.
- Optional Natural Weighting - Allows the instructor to choose, if all categories and course are Sum of grades they will get the weight adjustment column. The Aggregation pull-down does not disappear under this setting
- Disable Natural Weighting - legacy behavior

Upgrade changes

None

Database changes

Adds two fields to grade_items
  1. extracredit, tinyint, notnull, default: 0
  2. weight, decimal(10,5), notnull, default: 0
Adds one field to grade_grades
  1. weight, decimal(10,5), notnull, default: 0
This effectively does away with that hideous condition of having the field aggregationcoef represent both extra credit and weight

Unit test changes

Functional test changes

Logic changes

Sum of Grades aggregation must be fixed to respect hidden items setting and to Exclude non-graded items (new terminology)

Determination of range (in Grader and User report) and Max grade (in Setup screen) must be fixed to exclude extra credit items

Natural weights must be saved and applied to the form.

Natural weights are calculated for the Setup screen, the Grader report, and the User report. The calculation for the User report is different than that used for the Setup screen and Grader report.

Weights should be stored in grade_items for the Setup screen and the Grader report and in the grade_grades table for the User report.

Example - Category 1 contains seven items
  1. Item A = 20 points
  2. Item B = 10 points is extra credit
  3. Item C = 30 points
  4. Item D = 40 points is extra credit
  5. Item E = 50 points is hidden
  6. Item F = 50 points is ungraded
  7. Item G = 10 points whose natural weight has been adjusted to 50% of the category grade
In the Setup screen and the Grader report the following conditions will exist
- Category grademax = 120 (10 + 50 + 30 + 10 + 20)
- Remainder minus adjusted weights = 110 (50 + 30 + 10 + 20) the 10 points adjusted out represent 50% of the final category grade
- Multiplicator for each weight calculation to adjust for the 50% of weight already accounted for = .5 (50% / 100%)
- A weight = 8.33% (20 / 120 * .5)
- B weight = 4.16% (10 / 120 * .5)
- C weight = 12.5% (30 / 120 * .5)
- D weight = 33.33% (40 / 120) extra credit is not adjust, retains its value regardless of weights being overridden
- E weight = 0%
- F weight = 25% (50 / 120 * .5)
- G weight = 50% (adjusted)
In the User report the following conditions will exist
- Category grademax = 70 (10 + 30 + 10 + 20)
- Remainder minus adjusted weights = 60 (30 + 10 + 20) the 10 points adjusted out represent 50% of the final category grade
- Multiplicator for each weight calculation to adjust for the 50% of weight already accounted for = .5 (50% / 100%)
- A weight = 16.66% (20 / 60 * .5)
- B weight = 8.33% (10 / 60 * .5)
- C weight = 25% (30 / 60 * .5)
- D weight = 66.66% (40 / 60) extra credit is not adjust, retains its value regardless of weights being overridden
- E weight = 0%
- F weight = 0%
- G weight = 50% (adjusted)

EXPLANATION OF FORMULAS

The sum of weights for all containers (categories and course) add up to 100% except in the case where extra credit is used in which case 100% is exceeded by the weight of the extra credit
Setup screen and Grader report
- For the purposes of the calculations below the total category or course points is its total maximum points - (all of the below)
    1. extra credit items' points
    2. hidden items' points (unless hidetotalsthatcontainhiddenitems = GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN)
    3. all points associated with contained items or categories who've had their weights overridden
User report
- For the purposes of the calculations below the total category or course points is its total maximum points - (all of the below)
    1. extra credit items' points
    2. hidden items' points (unless hidetotalsthatcontainhiddenitems = GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN)
    3. ungraded items' points (if aggregateonlygraded is on))
    4. any items dropped through container's drop lowest or keep highest conditions
    5. all points associated with contained items or categories who've had their weights overridden
A multiplicator is used when some natural weights have been manually adjusted = sum(all adjusted weights) / 100
The natural weight for each item contained in a category or course (including extra credit items) is 'item maximum points' / 'total category or course points' (in which the item is contained) * multiplicator (if any)
The natural weight for each category (including extra credit categories) is 'total category points' / 'total category or course points' (in which the category is contained) * multiplicator (if any)

See also