Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/12 15:47:26 (13 years ago)
Author:
spimming
Message:

#1680: merged changes from trunk into branch

Location:
branches/HeuristicLab.Hive.Azure
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure

  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r7215 r7669  
    101101  </PropertyGroup>
    102102  <ItemGroup>
    103     <Reference Include="ALGLIB-3.1.0, Version=3.1.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    104       <HintPath>..\..\bin\ALGLIB-3.1.0.dll</HintPath>
     103    <Reference Include="ALGLIB-3.4.0, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     104      <HintPath>..\..\bin\ALGLIB-3.4.0.dll</HintPath>
    105105      <Private>False</Private>
    106106    </Reference>
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r7270 r7669  
    112112      SymbolicRegressionSolution solution = new SymbolicRegressionSolution(new SymbolicRegressionModel(tree, new SymbolicDataAnalysisExpressionTreeInterpreter()), (IRegressionProblemData)problemData.Clone());
    113113      solution.Model.Name = "Linear Regression Model";
     114      solution.Name = "Linear Regression Solution";
    114115      return solution;
    115116    }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs

    r7270 r7669  
    7373      kdTree.curdist = original.kdTree.curdist;
    7474      kdTree.debugcounter = original.kdTree.debugcounter;
    75       kdTree.distmatrixtype = original.kdTree.distmatrixtype;
    7675      kdTree.idx = (int[])original.kdTree.idx.Clone();
    7776      kdTree.kcur = original.kdTree.kcur;
     
    241240    }
    242241    [Storable]
    243     public int KDTreeDistMatrixType {
    244       get { return kdTree.distmatrixtype; }
    245       set { kdTree.distmatrixtype = value; }
    246     }
    247     [Storable]
    248242    public int[] KDTreeIdx {
    249243      get { return kdTree.idx; }
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame

    r7270 r7669  
    2828  [Plugin("HeuristicLab.Algorithms.DataAnalysis", "Provides wrappers for data analysis algorithms implemented in external libraries (linear regression, linear discriminant analysis, k-means clustering, support vector classification and regression)", "3.4.2.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.DataAnalysis-3.4.dll", PluginFileType.Assembly)]
    30   [PluginDependency("HeuristicLab.ALGLIB", "3.1.0")]
     30  [PluginDependency("HeuristicLab.ALGLIB", "3.4.0")]
    3131  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3232  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r7270 r7669  
    113113      IClassificationProblemData problemData = Problem.ProblemData;
    114114      IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables;
    115       var solution = CreateSupportVectorClassificationSolution(problemData, selectedInputVariables, SvmType.Value, KernelType.Value, Cost.Value, Nu.Value, Gamma.Value);
     115      double trainingAccuracy, testAccuracy;
     116      int nSv;
     117      var solution = CreateSupportVectorClassificationSolution(problemData, selectedInputVariables,
     118        SvmType.Value, KernelType.Value, Cost.Value, Nu.Value, Gamma.Value,
     119        out trainingAccuracy, out testAccuracy, out nSv);
    116120
    117121      Results.Add(new Result("Support vector classification solution", "The support vector classification solution.", solution));
     122      Results.Add(new Result("Training accuracy", "The accuracy of the SVR solution on the training partition.", new DoubleValue(trainingAccuracy)));
     123      Results.Add(new Result("Test R²", "The accuracy of the SVR solution on the test partition.", new DoubleValue(testAccuracy)));
     124      Results.Add(new Result("Number of support vectors", "The number of support vectors of the SVR solution.", new IntValue(nSv)));
    118125    }
    119126
    120127    public static SupportVectorClassificationSolution CreateSupportVectorClassificationSolution(IClassificationProblemData problemData, IEnumerable<string> allowedInputVariables,
    121       string svmType, string kernelType, double cost, double nu, double gamma) {
     128      string svmType, string kernelType, double cost, double nu, double gamma,
     129      out double trainingAccuracy, out double testAccuracy, out int nSv) {
    122130      Dataset dataset = problemData.Dataset;
    123131      string targetVariable = problemData.TargetVariable;
     
    148156      SVM.RangeTransform rangeTransform = SVM.RangeTransform.Compute(problem);
    149157      SVM.Problem scaledProblem = SVM.Scaling.Scale(rangeTransform, problem);
    150       var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables, problemData.ClassValues);
     158      var svmModel = SVM.Training.Train(scaledProblem, parameter);
     159      var model = new SupportVectorMachineModel(svmModel, rangeTransform, targetVariable, allowedInputVariables, problemData.ClassValues);
     160      var solution = new SupportVectorClassificationSolution(model, (IClassificationProblemData)problemData.Clone());
    151161
    152       return new SupportVectorClassificationSolution(model, (IClassificationProblemData)problemData.Clone());
     162      nSv = svmModel.SupportVectorCount;
     163      trainingAccuracy = solution.TrainingAccuracy;
     164      testAccuracy = solution.TestAccuracy;
     165
     166      return solution;
    153167    }
    154168    #endregion
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs

    r7270 r7669  
    121121      IRegressionProblemData problemData = Problem.ProblemData;
    122122      IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables;
    123       var solution = CreateSupportVectorRegressionSolution(problemData, selectedInputVariables, SvmType.Value, KernelType.Value, Cost.Value, Nu.Value, Gamma.Value, Epsilon.Value);
     123      double trainR2, testR2;
     124      int nSv;
     125      var solution = CreateSupportVectorRegressionSolution(problemData, selectedInputVariables, SvmType.Value,
     126        KernelType.Value, Cost.Value, Nu.Value, Gamma.Value, Epsilon.Value,
     127        out trainR2, out testR2, out nSv);
    124128
    125129      Results.Add(new Result("Support vector regression solution", "The support vector regression solution.", solution));
     130      Results.Add(new Result("Training R²", "The Pearson's R² of the SVR solution on the training partition.", new DoubleValue(trainR2)));
     131      Results.Add(new Result("Test R²", "The Pearson's R² of the SVR solution on the test partition.", new DoubleValue(testR2)));
     132      Results.Add(new Result("Number of support vectors", "The number of support vectors of the SVR solution.", new IntValue(nSv)));
    126133    }
    127134
    128135    public static SupportVectorRegressionSolution CreateSupportVectorRegressionSolution(IRegressionProblemData problemData, IEnumerable<string> allowedInputVariables,
    129       string svmType, string kernelType, double cost, double nu, double gamma, double epsilon) {
     136      string svmType, string kernelType, double cost, double nu, double gamma, double epsilon,
     137      out double trainingR2, out double testR2, out int nSv) {
    130138      Dataset dataset = problemData.Dataset;
    131139      string targetVariable = problemData.TargetVariable;
     
    147155      SVM.RangeTransform rangeTransform = SVM.RangeTransform.Compute(problem);
    148156      SVM.Problem scaledProblem = SVM.Scaling.Scale(rangeTransform, problem);
    149       var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables);
    150       return new SupportVectorRegressionSolution(model, (IRegressionProblemData)problemData.Clone());
     157      var svmModel = SVM.Training.Train(scaledProblem, parameter);
     158      nSv = svmModel.SupportVectorCount;
     159      var model = new SupportVectorMachineModel(svmModel, rangeTransform, targetVariable, allowedInputVariables);
     160      var solution = new SupportVectorRegressionSolution(model, (IRegressionProblemData)problemData.Clone());
     161      trainingR2 = solution.TrainingRSquared;
     162      testR2 = solution.TestRSquared;
     163      return solution;
    151164    }
    152165    #endregion
Note: See TracChangeset for help on using the changeset viewer.