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

www lon-capa-cvs@mail.lon-capa.org
Mon, 22 May 2006 03:13:55 -0000


www		Sun May 21 23:13:55 2006 EDT

  Modified files:              
    /modules/gerd	newevaluate.pl 
  Log:
  Show correlations
  
  
Index: modules/gerd/newevaluate.pl
diff -u modules/gerd/newevaluate.pl:1.1 modules/gerd/newevaluate.pl:1.2
--- modules/gerd/newevaluate.pl:1.1	Sun May 21 22:33:27 2006
+++ modules/gerd/newevaluate.pl	Sun May 21 23:13:53 2006
@@ -92,6 +92,8 @@
 my %fcigain=();
 my %fci=();
 my %clusterscore=();
+my %clustersum=();
+my %clusternum=();
 
 $line=<IN>; # header
 while ($line=<IN>) {
@@ -125,12 +127,12 @@
 	    $mpexpost{$user.':'.$mp}=($entries[103+$mp]-1)/4;
 	}
     }
-    &calcscore($user,'independence',\@indcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore);
-    &calcscore($user,'coherence',\@cohcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore);
-    &calcscore($user,'concepts',\@concluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore);
-    &calcscore($user,'realitylink',\@reacluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore);
-    &calcscore($user,'mathlink',\@matcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore);
-    &calcscore($user,'effort',\@effcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore);
+    &calcscore($user,'independence',\@indcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore,\%clustersum,\%clusternum);
+    &calcscore($user,'coherence',\@cohcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore,\%clustersum,\%clusternum);
+    &calcscore($user,'concepts',\@concluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore,\%clustersum,\%clusternum);
+    &calcscore($user,'realitylink',\@reacluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore,\%clustersum,\%clusternum);
+    &calcscore($user,'mathlink',\@matcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore,\%clustersum,\%clusternum);
+    &calcscore($user,'effort',\@effcluster,\%mpexpre,\%mpexpost,\@expert,\%clusterscore,\%clustersum,\%clusternum);
 }
 close(IN);
 #
@@ -152,7 +154,32 @@
 
 # Sample is everybody who got a grade in the course
 my @userkeys=sort keys %grade;
-
+foreach my $idx ('independence','coherence','concepts',
+                 'realitylink','mathlink','effort') {
+    print "\n==== $idx ====\n";
+    my $preave=$clustersum{'pre_'.$idx}/$clusternum{'pre_'.$idx};
+    my $postave=$clustersum{'post_'.$idx}/$clusternum{'post_'.$idx};
+    print "\n Pre: $preave  Post: $postave";
+    print "\n".&hashcorrelate(\%grade,'',\%clusterscore,'pre_'.$idx,\@userkeys,'Grade Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%grade,'',\%clusterscore,'post_'.$idx,\@userkeys,'Grade Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%fci,'',\%clusterscore,'pre_'.$idx,\@userkeys,'FCI Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%fci,'',\%clusterscore,'post_'.$idx,\@userkeys,'FCI Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%solution,'',\%clusterscore,'pre_'.$idx,\@userkeys,'Solution Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%solution,'',\%clusterscore,'post_'.$idx,\@userkeys,'Solution Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%solution,'',\%clusterscore,'gain_'.$idx,\@userkeys,'Solution Gain '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%procedural,'',\%clusterscore,'pre_'.$idx,\@userkeys,'Procedural Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%procedural,'',\%clusterscore,'post_'.$idx,\@userkeys,'Procedural Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%procedural,'',\%clusterscore,'gain_'.$idx,\@userkeys,'Procedural Gain '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%conceptual,'',\%clusterscore,'pre_'.$idx,\@userkeys,'Conceptual Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%conceptual,'',\%clusterscore,'post_'.$idx,\@userkeys,'Conceptual Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%conceptual,'',\%clusterscore,'gain_'.$idx,\@userkeys,'Conceptual Gain '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%surface,'',\%clusterscore,'pre_'.$idx,\@userkeys,'Surface Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%surface,'',\%clusterscore,'post_'.$idx,\@userkeys,'Surface Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%surface,'',\%clusterscore,'gain_'.$idx,\@userkeys,'Surface Gain '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%math,'',\%clusterscore,'pre_'.$idx,\@userkeys,'Math Pre '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%math,'',\%clusterscore,'post_'.$idx,\@userkeys,'Math Post '.$idx,0.01,100);
+    print "\n".&hashcorrelate(\%math,'',\%clusterscore,'gain_'.$idx,\@userkeys,'Math Gain '.$idx,0.01,100);
+}
 exit;
 #
 # Calculate correlation between two hashes
@@ -198,7 +225,7 @@
 #
 
 sub calcscore {
-    my ($user,$idx,$cluster,$mpexpre,$mpexpost,$expert,$clusterscore)=@_;
+    my ($user,$idx,$cluster,$mpexpre,$mpexpost,$expert,$clusterscore,$clustersum,$clusternum)=@_;
     my $presum=0;
     my $prenum=0;
     my $postsum=0;
@@ -217,9 +244,13 @@
     }
     if ($prenum>0) {
 	$$clusterscore{$user.':pre_'.$idx}=$presum/$prenum;
+        $$clusternum{'pre_'.$idx}++;
+        $$clustersum{'pre_'.$idx}+=$presum/$prenum;
     }
     if ($postnum>0) {
 	$$clusterscore{$user.':post_'.$idx}=$postsum/$postnum;
+        $$clusternum{'post_'.$idx}++;
+        $$clustersum{'post_'.$idx}+=$postsum/$postnum;
     }
     if (($postnum>0) && ($prenum>0)) {
 	$$clusterscore{$user.':gain_'.$idx}=