Changeset 11464


Ignore:
Timestamp:
10/14/14 09:59:45 (5 years ago)
Author:
bburlacu
Message:

#2234: Moved lock object inside the GridSearch method. Added scaling for the svm partitions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineUtil.cs

    r11427 r11464  
    3434namespace HeuristicLab.Algorithms.DataAnalysis {
    3535  public class SupportVectorMachineUtil {
    36     private static readonly object locker = new object();
    37 
    38 
    3936    /// <summary>
    4037    /// Transforms <paramref name="problemData"/> into a data structure as needed by libSVM.
     
    10198      var setters = parameterRanges.Keys.Select(GenerateSetter).ToList();
    10299      var partitions = GenerateSvmPartitions(problemData, numberOfFolds, shuffleFolds);
     100
     101      var locker = new object(); // for thread synchronization
    103102      Parallel.ForEach(crossProduct, new ParallelOptions { MaxDegreeOfParallelism = maxDegreeOfParallelism },
    104103      parameterCombination => {
     
    144143        var testRows = folds[i];
    145144        var trainingSvmProblem = CreateSvmProblem(problemData.Dataset, targetVariable, problemData.AllowedInputVariables, trainingRows);
    146         var testSvmProblem = CreateSvmProblem(problemData.Dataset, targetVariable, problemData.AllowedInputVariables, testRows);
    147         partitions[i] = new Tuple<svm_problem, svm_problem>(trainingSvmProblem, testSvmProblem);
     145        var rangeTransform = RangeTransform.Compute(trainingSvmProblem);
     146        var testSvmProblem = rangeTransform.Scale(CreateSvmProblem(problemData.Dataset, targetVariable, problemData.AllowedInputVariables, testRows));
     147        partitions[i] = new Tuple<svm_problem, svm_problem>(rangeTransform.Scale(trainingSvmProblem), testSvmProblem);
    148148      }
    149149      return partitions;
Note: See TracChangeset for help on using the changeset viewer.