[LON-CAPA-cvs] cvs: modules /gerd evaluate.pl

www lon-capa-cvs@mail.lon-capa.org
Thu, 30 Mar 2006 17:54:15 -0000


www		Thu Mar 30 12:54:15 2006 EDT

  Modified files:              
    /modules/gerd	evaluate.pl 
  Log:
  Seems to work
  
  
Index: modules/gerd/evaluate.pl
diff -u modules/gerd/evaluate.pl:1.3 modules/gerd/evaluate.pl:1.4
--- modules/gerd/evaluate.pl:1.3	Thu Mar 30 10:12:03 2006
+++ modules/gerd/evaluate.pl	Thu Mar 30 12:54:07 2006
@@ -17,12 +17,54 @@
 }
 close(IN);
 my %discussion;
+my %solution;
+my %math;
+my %physics;
+my %surface;
+my %procedural;
+my %conceptual;
 foreach my $user (keys %totals) {
     foreach my $number (1..8) {
 	foreach my $char ('a'..'d') {
 	    $discussion{$user.':'.$number.$char}=$evals{$user.':'.$number.$char}/$totals{$user};
 	}
     }
+    $solution{$user}=$discussion{$user.':3b'}
+                    +$discussion{$user.':4b'}
+                    +$discussion{$user.':5b'}
+                    +$discussion{$user.':6b'}
+                    +$discussion{$user.':7b'}
+                    +$discussion{$user.':8b'};
+    $math{$user}    =$discussion{$user.':3c'}
+                    +$discussion{$user.':4c'}
+                    +$discussion{$user.':5c'}
+                    +$discussion{$user.':6c'}
+                    +$discussion{$user.':7c'}
+                    +$discussion{$user.':8c'};
+    $physics{$user} =$discussion{$user.':3d'}
+                    +$discussion{$user.':4d'}
+                    +$discussion{$user.':5d'}
+                    +$discussion{$user.':6d'}
+                    +$discussion{$user.':7d'}
+                    +$discussion{$user.':8d'};
+    $surface{$user} =$discussion{$user.':3b'}
+                    +$discussion{$user.':4b'}
+                    +$discussion{$user.':3c'}
+                    +$discussion{$user.':4c'}
+                    +$discussion{$user.':3d'}
+                    +$discussion{$user.':4d'};
+    $procedural{$user} =$discussion{$user.':5b'}
+                    +$discussion{$user.':6b'}
+                    +$discussion{$user.':5c'}
+                    +$discussion{$user.':6c'}
+                    +$discussion{$user.':5d'}
+                    +$discussion{$user.':6d'};
+    $conceptual{$user} =$discussion{$user.':7b'}
+                    +$discussion{$user.':8b'}
+                    +$discussion{$user.':7c'}
+                    +$discussion{$user.':8c'}
+                    +$discussion{$user.':7d'}
+                    +$discussion{$user.':8d'};
 }
 # Read the other info
 open(IN,'compiled.csv');
@@ -84,33 +126,80 @@
 # mpexpost
 # grade
 # fcigain
+# conceptual
+# procedural
+# surface
+# physics
+# math
+# solution
 
 # Sample is everybody who got a grade in the course
 my @userkeys=sort keys %grade;
 
+print "\nGrade/Solution: ".&hashcorrelate(\%grade,'',\%solution,'',\@userkeys,'',0.01);
+print "\nGrade/Math: ".&hashcorrelate(\%grade,'',\%math,'',\@userkeys,'',0.01);
+print "\nGrade/Physics: ".&hashcorrelate(\%grade,'',\%physics,'',\@userkeys,'',0.01);
+print "\nGrade/Surface: ".&hashcorrelate(\%grade,'',\%surface,'',\@userkeys,'',0.01);
+print "\nGrade/Procedural: ".&hashcorrelate(\%grade,'',\%procedural,'',\@userkeys,'',0.01);
+print "\nGrade/Conceptual: ".&hashcorrelate(\%grade,'',\%conceptual,'',\@userkeys,'',0.01);
+
+print "\nFCIg/Solution: ".&hashcorrelate(\%fcigain,'',\%solution,'',\@userkeys,'',0.01);
+print "\nFCIg/Math: ".&hashcorrelate(\%fcigain,'',\%math,'',\@userkeys,'',0.01);
+print "\nFCIg/Physics: ".&hashcorrelate(\%fcigain,'',\%physics,'',\@userkeys,'',0.01);
+print "\nFCIg/Surface: ".&hashcorrelate(\%fcigain,'',\%surface,'',\@userkeys,'',0.01);
+print "\nFCIg/Procedural: ".&hashcorrelate(\%fcigain,'',\%procedural,'',\@userkeys,'',0.01);
+print "\nFCIg/Conceptual: ".&hashcorrelate(\%fcigain,'',\%conceptual,'',\@userkeys,'',0.01);
+
+
 foreach my $mpexidx (1..34) {
    print "\n$mpexidx - ";
-   print "FCI: ".join(",",&hashcorrelate(\%fci,'',\%mpex,$mpexidx,\@userkeys)).
-         " Grade: ".join(",",&hashcorrelate(\%grade,'',\%mpex,$mpexidx,\@userkeys)).' - ';
+   print &hashcorrelate(\%fci,'',\%mpex,$mpexidx,\@userkeys,'FCI').
+         &hashcorrelate(\%fcipre,'',\%mpex,$mpexidx,\@userkeys,'FCIInit').
+         &hashcorrelate(\%fcipost,'',\%mpex,$mpexidx,\@userkeys,'FCIFinal').
+         &hashcorrelate(\%fcipre,'',\%mpexpre,$mpexidx,\@userkeys,'FCIInitPre').
+         &hashcorrelate(\%fcipost,'',\%mpexpost,$mpexidx,\@userkeys,'FCIFinalPost').
+         &hashcorrelate(\%fcigain,'',\%mpex,$mpexidx,\@userkeys,'FCIGain').
+         &hashcorrelate(\%grade,'',\%mpex,$mpexidx,\@userkeys,'Grade').
+         &hashcorrelate(\%grade,'',\%mpexpre,$mpexidx,\@userkeys,'GradePre').
+         &hashcorrelate(\%grade,'',\%mpexpost,$mpexidx,\@userkeys,'GradePost');
    foreach my $number (1..8) {
       foreach my $char ('a'..'d') {
-         my ($c,$n)=&hashcorrelate(\%discussion,$number.$char,\%mpex,$mpexidx,\@userkeys);
-         if ($c) {
-             print " $number$char: $c,$n";
-         }
+	  print &hashcorrelate(\%discussion,$number.$char,\%mpex,$mpexidx,\@userkeys,$number.$char).
+	        &hashcorrelate(\%discussion,$number.$char,\%mpexpre,$mpexidx,\@userkeys,$number.$char.'Pre').
+                &hashcorrelate(\%discussion,$number.$char,\%mpexpost,$mpexidx,\@userkeys,$number.$char.'Post');
       }
-   }
+  }
+   print &hashcorrelate(\%solution,'',\%mpex,$mpexidx,\@userkeys,'Sol').
+       &hashcorrelate(\%solution,'',\%mpexpre,$mpexidx,\@userkeys,'SolPre').
+       &hashcorrelate(\%solution,'',\%mpexpost,$mpexidx,\@userkeys,'SolPost');
+   print &hashcorrelate(\%math,'',\%mpex,$mpexidx,\@userkeys,'Math').
+       &hashcorrelate(\%math,'',\%mpexpre,$mpexidx,\@userkeys,'MathPre').
+       &hashcorrelate(\%math,'',\%mpexpost,$mpexidx,\@userkeys,'MathPost');
+   print &hashcorrelate(\%physics,'',\%mpex,$mpexidx,\@userkeys,'Phys').
+       &hashcorrelate(\%physics,'',\%mpexpre,$mpexidx,\@userkeys,'PhysPre').
+       &hashcorrelate(\%physics,'',\%mpexpost,$mpexidx,\@userkeys,'PhysPost');
+   print &hashcorrelate(\%surface,'',\%mpex,$mpexidx,\@userkeys,'Surf').
+       &hashcorrelate(\%surface,'',\%mpexpre,$mpexidx,\@userkeys,'SurfPre').
+       &hashcorrelate(\%surface,'',\%mpexpost,$mpexidx,\@userkeys,'SurfPost');
+   print &hashcorrelate(\%procedural,'',\%mpex,$mpexidx,\@userkeys,'Proc').
+       &hashcorrelate(\%procedural,'',\%mpexpre,$mpexidx,\@userkeys,'ProcPre').
+       &hashcorrelate(\%procedural,'',\%mpexpost,$mpexidx,\@userkeys,'ProcPost');
+   print &hashcorrelate(\%conceptual,'',\%mpex,$mpexidx,\@userkeys,'Conc').
+       &hashcorrelate(\%conceptual,'',\%mpexpre,$mpexidx,\@userkeys,'ConcPre').
+       &hashcorrelate(\%conceptual,'',\%mpexpost,$mpexidx,\@userkeys,'ConcPost');
 }
+print "\n";
 exit;
 #
 # Calculate correlation between two hashes
 #
 sub hashcorrelate {
-   my ($array1,$arrayidx1,$array2,$arrayidx2,$userkeys)=@_;
+   my ($array1,$arrayidx1,$array2,$arrayidx2,$userkeys,$label,$threshold)=@_;
+   unless ($threshold) { $threshold=0.29; }
    my ($c,$n)=&correlation(&buildarrays($array1,$arrayidx1,$array2,$arrayidx2,$userkeys));
-   unless (abs($c)>0.2) { return ('',''); }
+   unless (abs($c)>$threshold) { return ('',''); }
    $c=int($c*100+0.5)/100;
-   return ($c,$n);
+   return " $label: $c ($n)";
 }
 
 #