Difference between revisions of "WeightedGrader"
Line 298:  Line 298:  
\( \displaystyle V = \int_a^b \) 
\( \displaystyle V = \int_a^b \) 

\{NAMED_ANS_RULE('optional1',50)\} 
\{NAMED_ANS_RULE('optional1',50)\} 

−  \{NAMED_POP_UP_LIST('optional2', 
+  \{NAMED_POP_UP_LIST('optional2',''=>'?','dx'=>'dx','dy'=>'dy')\} 
$ECENTER 
$ECENTER 

$BR 
$BR 

Line 319:  Line 319:  
<p> 
<p> 

<b>Main Text:</b> 
<b>Main Text:</b> 

−  The answer box for the credit answer (the actual volume) is as usual; however, the other answer boxes are not as usual. In particular, you must use <code>\{ NAMED_ANS_RULE( 'label', width ) \}</code> or an appropriate variation for all answer boxes other than the credit answer. 
+  The answer box for the credit answer (the actual volume) is as usual; however, the other answer boxes are not as usual. In particular, you must use <code>\{ NAMED_ANS_RULE( 'label', width ) \}</code> or an appropriate variation for all answer boxes other than the credit answer. 
+  </p> 

+  <p> 

+  The second argument ' '=>'?' in <code> NAMED_POP_UP_LIST('optional2', ...)</code> is a "value=>tag" pair which ensures that if the tag '?' is selected the popup returns a blank value, so '?' doesn't count as an incorrect answer when CREDIT_ANS is evaluated. 

</p> 
</p> 

<p> 
<p> 
Latest revision as of 17:19, 14 September 2021
Weighted Graders
If a question has n answer blanks, the default grader, which is the average problem grader (avg_problem_grader), will use 1/n as the weight for each answer. We describe several different ways to weight answers differently.
 The standard problem grader assigns full credit if all answers are correct, and zero credit otherwise. This allornothing grader should always be used for matching, multiple choice, and true / false questions, otherwise students will be able to deduce how many answers are correct by the partial credit reported by webwork.
 The fullpartial grader gives full credit if the last answer is correct, no matter what the other answers are, and partial credit (like the average problem grader) otherwise.
 The weighted grader allows you to assign a weight to each answer blank in a problem.
 The weighted grader with the credit answer option allows you to specify one answer blank to be the final answer which, if answered correctly, will provide full credit for all other answer blanks in the problem.
 The incremental weighted grader, which awards a certain amount of credit for answering a certain number of parts correctly, is described in Example 1 (answer evaluation section) on the page PopUpListsLong
Standard Problem Grader: give full credit if all answers are correct and zero credit otherwise.
PG problem file  Explanation 

####################### # Initialization loadMacros("PGstandard.pl"); # Usual setup and main text go here ####################### # Answer evaluation install_problem_grader(~~&std_problem_grader); $showPartialCorrectAnswers = 0; ANS($a>cmp()); ANS($b>cmp()); ANS($c>cmp()); 
Initialization:
Be sure to load
Answer Evaluation: We use

FullPartial Grader: give full credit if the last answer is correct, no matter what the other answers are, and partial credit (like the average problem grader) otherwise.
PG problem file  Explanation 

####################### # Initialization loadMacros( "PGstandard.pl", "PGgraders.pl", ); # Usual setup and main text go here ####################### # Answer evaluation install_problem_grader(~~&full_partial_grader); $showPartialCorrectAnswers = 1; ANS($a>cmp()); ANS($b>cmp()); ANS($c>cmp()); 
Initialization:
Be sure to load
Answer Evaluation:
Use 
Weighted Grader: assign different weights (percentages) to each answer in a problem.
PG problem file  Explanation 

DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "weightedGrader.pl", "PGcourse.pl", ); install_weighted_grader(); TEXT(beginproblem()); 
Initialization:
We need to include the 
Context("Numeric"); Context()>variables>add(t=>"Real"); Context()>strings>add(A=>{},B=>{}); $r = random(2,4,1); $answer1 = Real("pi * $r**2"); $answer2 = Formula("($r  1) * x**2 * t") > reduce; $answer3 = String("A"); 
Setup: To show how this works with MathObjects, we add some variables and strings to the context. 
Context()>texStrings; BEGIN_TEXT Enter \( \pi $r^2 \): \{ans_rule(10)\} Enter \( $answer2 \): \{ans_rule(10)\} Enter A: \{ans_rule(10)\} END_TEXT Context()>normalStrings; 
Main Text: Answer boxes are as usual. 
$showPartialCorrectAnswers = 0; WEIGHTED_ANS( ($answer1)>cmp(), 40 ); WEIGHTED_ANS( ($answer2)>cmp(), 40 ); WEIGHTED_ANS( ($answer3)>cmp(), 20 ); ENDDOCUMENT(); 
Answer Evaluation:
Use 
Weighted Grader with Credit Answer Option: assign different weights (percentages) to each answer in a problem, and provide one answer blank that, if correct, will supersede all other answer blanks and award full credit.
PG problem file  Explanation 

DOCUMENT(); loadMacros( "PGchoicemacros.pl", "PGanswermacros.pl", "PGauxiliaryFunctions.pl", "weightedGrader.pl" ); install_weighted_grader(); $showPartialCorrectAnswers = 1; TEXT(beginproblem()); 
Initialization:
We need to include the 
# problem set up $a = random(2,9,1); # $region will already be in displaymath mode $region = "x = $a y, \quad y^3 = x \quad (\mbox{with } y\geq 0)"; $lineofrotation = "the yaxis"; 
Setup: Everything is as usual. 
BEGIN_TEXT The volume of the solid obtained by rotating the region enclosed by \[ $region \] about $lineofrotation can be computed using the method of disks or washers via an integral $BR $BCENTER \( \displaystyle V = \int_a^b \) \{NAMED_ANS_RULE('optional1',50)\} \{NAMED_POP_UP_LIST('optional2',''=>'?','dx'=>'dx','dy'=>'dy')\} $ECENTER $BR with limits of integration \( a = \) \{NAMED_ANS_RULE('optional3',10)\} and \( b = \) \{NAMED_ANS_RULE('optional4',10)\}. $BR $BR The volume is \( V = \) \{ans_rule(50)\} cubic units. $PAR ${BITALIC} Note: You can earn full credit if the last question is correct and all other questions are either blank or correct. ${EITALIC} END_TEXT 
Main Text:
The answer box for the credit answer (the actual volume) is as usual; however, the other answer boxes are not as usual. In particular, you must use
The second argument ' '=>'?' in At the bottom of the text of the problem, include a note to students that explains how they can earn credit. 
# answers below are incorrect to maintain # the integrity of the original problem $integrand="pi*x**2"; $differential="dx"; $lowerlimit="3"; $upperlimit="5"; $volume = pi*$a**3; NAMED_WEIGHTED_ANS( 'optional1', fun_cmp($integrand, vars=>['x','y'], limits=>[[1,2],[1,2]]), 50 ); NAMED_WEIGHTED_ANS( 'optional2', str_cmp($differential), 2 ); NAMED_WEIGHTED_ANS( 'optional3', num_cmp($lowerlimit), 4 ); NAMED_WEIGHTED_ANS( 'optional4', num_cmp($upperlimit), 4 ); CREDIT_ANS( num_cmp($volume), ['optional1','optional2','optional3','optional4'], 40 ); COMMENT('Gives partial credit for correct answers to initial questions or full credit for answering only the the final question correctly.'); ENDDOCUMENT(); 
Answer Evaluation:
For the noncredit answers, use
Since weighted answers with the credit answer option are nonstandard, insert a 