Changeset 16692 for branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs
- Timestamp:
- 03/18/19 17:24:30 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/stable/HeuristicLab.Algorithms.DataAnalysis/3.4 merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Algorithms.DataAnalysis/3.4 10321-10322 /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4 13329-15286 /branches/Benchmarking/sources/HeuristicLab.Algorithms.DataAnalysis/3.4 6917-7005 /branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4 9070-13099 /branches/CloningRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Algorithms.DataAnalysis/3.4 5815-6180 /branches/DataAnalysis/HeuristicLab.Algorithms.DataAnalysis/3.4 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Algorithms.DataAnalysis/3.4 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Algorithms.DataAnalysis/3.4 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Algorithms.DataAnalysis/3.4 5060 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Algorithms.DataAnalysis/3.4 11570-12508 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Algorithms.DataAnalysis/3.4 11130-12721 /branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4 13819-14091 /branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4 8116-8789 /branches/LogResidualEvaluator/HeuristicLab.Algorithms.DataAnalysis/3.4 10202-10483 /branches/NET40/sources/HeuristicLab.Algorithms.DataAnalysis/3.4 5138-5162 /branches/ParallelEngine/HeuristicLab.Algorithms.DataAnalysis/3.4 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Algorithms.DataAnalysis/3.4 7773-7810 /branches/QAPAlgorithms/HeuristicLab.Algorithms.DataAnalysis/3.4 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Algorithms.DataAnalysis/3.4 6828 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Algorithms.DataAnalysis/3.4 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Algorithms.DataAnalysis/3.4 5370-5682 /branches/Trunk/HeuristicLab.Algorithms.DataAnalysis/3.4 6829-6865 /branches/VNS/HeuristicLab.Algorithms.DataAnalysis/3.4 5594-5752 /branches/Weighted TSNE/3.4 15451-15531 /branches/histogram/HeuristicLab.Algorithms.DataAnalysis/3.4 5959-6341 /branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.4 14232-14825 /trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4 13331-15681
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs
r12509 r16692 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 37 37 [StorableClass] 38 38 [Item("SupportVectorMachineModel", "Represents a support vector machine model.")] 39 public sealed class SupportVectorMachineModel : NamedItem, ISupportVectorMachineModel { 39 public sealed class SupportVectorMachineModel : ClassificationModel, ISupportVectorMachineModel { 40 public override IEnumerable<string> VariablesUsedForPrediction { 41 get { return allowedInputVariables; } 42 } 43 40 44 41 45 private svm_model model; … … 83 87 84 88 [Storable] 85 private string targetVariable;86 [Storable]87 89 private string[] allowedInputVariables; 88 90 [Storable] … … 96 98 this.model = original.model; 97 99 this.rangeTransform = original.rangeTransform; 98 this.targetVariable = original.targetVariable;99 100 this.allowedInputVariables = (string[])original.allowedInputVariables.Clone(); 100 101 if (original.classValues != null) … … 106 107 } 107 108 public SupportVectorMachineModel(svm_model model, RangeTransform rangeTransform, string targetVariable, IEnumerable<string> allowedInputVariables) 108 : base( ) {109 : base(targetVariable) { 109 110 this.name = ItemName; 110 111 this.description = ItemDescription; 111 112 this.model = model; 112 113 this.rangeTransform = rangeTransform; 113 this.targetVariable = targetVariable;114 114 this.allowedInputVariables = allowedInputVariables.ToArray(); 115 115 } … … 123 123 return GetEstimatedValuesHelper(dataset, rows); 124 124 } 125 public SupportVectorRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {125 public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 126 126 return new SupportVectorRegressionSolution(this, new RegressionProblemData(problemData)); 127 127 } 128 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) {129 return CreateRegressionSolution(problemData);130 }131 128 #endregion 132 129 133 130 #region IClassificationModel Members 134 public IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {131 public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) { 135 132 if (classValues == null) throw new NotSupportedException(); 136 133 // return the original class value instead of the predicted value of the model … … 152 149 } 153 150 154 public SupportVectorClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {151 public override IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 155 152 return new SupportVectorClassificationSolution(this, new ClassificationProblemData(problemData)); 156 }157 IClassificationSolution IClassificationModel.CreateClassificationSolution(IClassificationProblemData problemData) {158 return CreateClassificationSolution(problemData);159 153 } 160 154 #endregion 161 155 private IEnumerable<double> GetEstimatedValuesHelper(IDataset dataset, IEnumerable<int> rows) { 162 156 // calculate predictions for the currently requested rows 163 svm_problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, targetVariable, allowedInputVariables, rows);157 svm_problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, TargetVariable, allowedInputVariables, rows); 164 158 svm_problem scaledProblem = rangeTransform.Scale(problem); 165 159
Note: See TracChangeset
for help on using the changeset viewer.