about summary refs log tree commit diff
path: root/sourcecodes/parameter_learning/kfoldCrossValid.m
diff options
context:
space:
mode:
authorziejd22021-02-24 14:36:59 -0600
committerziejd22021-02-24 14:36:59 -0600
commit25b843f6bbacb1937bdb960777b73acbece64115 (patch)
tree88645b9d1d8a0eea19d7229555bf8805571bc8b7 /sourcecodes/parameter_learning/kfoldCrossValid.m
parent33cedf36248f616aa37d1462c69a4a3058a5d92e (diff)
downloadBNW-25b843f6bbacb1937bdb960777b73acbece64115.tar.gz
GENENET8 update
Diffstat (limited to 'sourcecodes/parameter_learning/kfoldCrossValid.m')
-rw-r--r--sourcecodes/parameter_learning/kfoldCrossValid.m21
1 files changed, 13 insertions, 8 deletions
diff --git a/sourcecodes/parameter_learning/kfoldCrossValid.m b/sourcecodes/parameter_learning/kfoldCrossValid.m
index 02f34866..40b72c61 100644
--- a/sourcecodes/parameter_learning/kfoldCrossValid.m
+++ b/sourcecodes/parameter_learning/kfoldCrossValid.m
@@ -117,7 +117,7 @@ end
 filename = strcat(pre,'kfoldCV.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 %Calculate RMSEP (root mean square error of prediction) and q^2
 %First, calculate TSS (total sum of squares) and
@@ -136,19 +136,22 @@ end
 rmsep = sqrt(press/ncases);
 q_squared = 1 - press/tss;
 
-%% Print rmseq and q^2
-fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
-fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
+%% Print rmsep and q^2
+%fprintf(fileID,'RMS error of predictions: %6.4f\n',rmsep);
+%fprintf(fileID,'Q^2 of predictions: %6.4f\n\n',q_squared);
 
 
 %%Print the predictions
-fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
+%%fprintf(fileID,'Predicted mean and standard deviation for each case:\n');
 fprintf(fileID,'CaseRow\tFoldNumber\tActualValue\tPredictionMean\tPredictionStDev\n');
 for i = 1:ncases
      fprintf(fileID,'%i\t%i\t%6.4f\t',i,kfold_index(i),case_adj(i));
      fprintf(fileID,'%6.4f\t%6.4f\n',kfoldPredictions(i,:));
 end
 
+%%Print rmse and q^2
+fprintf(fileID,'k-fold CV for %s; RMSE= %6.4f; Q^2= %6.4f\n',predict_label,rmsep,q_squared);
+
 fflush(fileID);
 fclose(fileID);
 
@@ -267,14 +270,14 @@ accuracy = correct/ncases;
 filename = strcat(pre,'kfoldCV.txt');
 fileID = fopen(filename,'w');
 
-fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
+%fprintf(fileID,'Variable that was predicted: %s\n\n',predict_label);
 
 
 %%Print the accuracy
-fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
+%fprintf(fileID,'Fraction of accurate predictions: %6.4f\n\n',accuracy);
 
 %%Print the predictions
-fprintf(fileID,'Predicted likelihood of each state for each case:\n');
+%fprintf(fileID,'Predicted likelihood of each state for each case:\n');
 fprintf(fileID,'%s\t%s\t%s\t','CaseRow','FoldNumber','ActualState');
 fprintf(fileID,'%s\t',pred_levels{1:end-1});
 fprintf(fileID,'%s\n',pred_levels{end});
@@ -286,6 +289,8 @@ for i = 1:ncases
      fprintf(fileID,'%6.4f\n',kfoldPredictions(i,end));
 end
 
+fprintf(fileID,'k-fold CV for %s; Fraction of accurate predictions= %6.4f\n',predict_label,accuracy);
+
 fflush(fileID);
 fclose(fileID);