Changeset 11542 for trunk/sources
- Timestamp:
- 11/12/14 17:07:06 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs
r11464 r11542 92 92 } 93 93 94 public static svm_parameter GridSearch( IDataAnalysisProblemData problemData, Dictionary<string, IEnumerable<double>> parameterRanges, int numberOfFolds, bool shuffleFolds = true, int maxDegreeOfParallelism = 1) {94 public static svm_parameter GridSearch(out double cvMse, IDataAnalysisProblemData problemData, Dictionary<string, IEnumerable<double>> parameterRanges, int numberOfFolds, bool shuffleFolds = true, int maxDegreeOfParallelism = 1) { 95 95 DoubleValue mse = new DoubleValue(Double.MaxValue); 96 96 var bestParam = DefaultParameters(); … … 108 108 109 109 double testMse = CalculateCrossValidationPartitions(partitions, parameters); 110 lock (locker) { 111 if (testMse < mse.Value) { 112 mse.Value = testMse; 113 bestParam = (svm_parameter)parameters.Clone(); 110 if (!double.IsNaN(testMse)) { 111 lock (locker) { 112 if (testMse < mse.Value) { 113 mse.Value = testMse; 114 bestParam = (svm_parameter)parameters.Clone(); 115 } 114 116 } 115 117 } 116 118 }); 119 cvMse = mse.Value; 117 120 return bestParam; 118 121 } … … 128 131 for (int i = 0; i < testSvmProblem.l; ++i) 129 132 calc.Add(testSvmProblem.y[i], svm.svm_predict(model, testSvmProblem.x[i])); 130 avgTestMse += calc.MeanSquaredError; 133 double mse = calc.ErrorState == OnlineCalculatorError.None ? calc.MeanSquaredError : double.NaN; 134 avgTestMse += mse; 131 135 } 132 136 avgTestMse /= partitions.Length;
Note: See TracChangeset
for help on using the changeset viewer.