Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/31/10 16:07:20 (14 years ago)
Author:
gkronber
Message:

Changed cross-validation in SVM.NET to return the MSE instead of the correlation coefficient. #1009

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.LibSVM/1.6.3/LibSVM-1.6.3/Training.cs

    r2645 r3879  
    5050            int total_correct = 0;
    5151            double total_error = 0;
    52             double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0;
     52            //double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0;
    5353            if (parameters.SvmType == SvmType.EPSILON_SVR || parameters.SvmType == SvmType.NU_SVR)
    5454            {
     
    5858                    double v = target[i];
    5959                    total_error += (v - y) * (v - y);
    60                     sumv += v;
    61                     sumy += y;
    62                     sumvv += v * v;
    63                     sumyy += y * y;
    64                     sumvy += v * y;
     60                    //sumv += v;
     61                    //sumy += y;
     62                    //sumvv += v * v;
     63                    //sumyy += y * y;
     64                    //sumvy += v * y;
    6565                }
    66                 return(problem.Count * sumvy - sumv * sumy) / (Math.Sqrt(problem.Count * sumvv - sumv * sumv) * Math.Sqrt(problem.Count * sumyy - sumy * sumy));
     66                return total_error / problem.Count; // return MSE
     67              // (problem.Count * sumvy - sumv * sumy) / (Math.Sqrt(problem.Count * sumvv - sumv * sumv) * Math.Sqrt(problem.Count * sumyy - sumy * sumy));
    6768            }
    6869            else
Note: See TracChangeset for help on using the changeset viewer.