Changeset 5649 for branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs
- Timestamp:
- 03/10/11 10:00:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs
r5626 r5649 88 88 public SupportVectorClassification() 89 89 : base() { 90 Problem = new ClassificationProblem(); 91 90 92 List<StringValue> svrTypes = (from type in new List<string> { "NU_SVC", "EPSILON_SVC" } 91 93 select new StringValue(type).AsReadOnly()) … … 95 97 select new StringValue(type).AsReadOnly()) 96 98 .ToList(); 97 ItemSet<StringValue> kernelTypeSet = new ItemSet<StringValue>( svrTypes);99 ItemSet<StringValue> kernelTypeSet = new ItemSet<StringValue>(kernelTypes); 98 100 Parameters.Add(new ConstrainedValueParameter<StringValue>(SvmTypeParameterName, "The type of SVM to use.", svrTypeSet, svrTypes[0])); 99 101 Parameters.Add(new ConstrainedValueParameter<StringValue>(KernelTypeParameterName, "The kernel type to use for the SVM.", kernelTypeSet, kernelTypes[3])); … … 112 114 protected override void Run() { 113 115 IClassificationProblemData problemData = Problem.ProblemData; 114 IEnumerable<string> selectedInputVariables = problemData. InputVariables.CheckedItems.Select(x => x.Value);116 IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables; 115 117 var solution = CreateSupportVectorClassificationSolution(problemData, selectedInputVariables, SvmType.Value, KernelType.Value, Cost.Value, Nu.Value, Gamma.Value); 116 118 … … 140 142 SVM.RangeTransform rangeTransform = SVM.RangeTransform.Compute(problem); 141 143 SVM.Problem scaledProblem = SVM.Scaling.Scale(rangeTransform, problem); 142 var model = new SupportVectorMachineModel(); 143 model.Model = SVM.Training.Train(scaledProblem, parameter); 144 model.RangeTransform = rangeTransform; 144 var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables); 145 145 146 return new SupportVectorClassificationSolution(model, problemData , allowedInputVariables, double.NegativeInfinity, double.PositiveInfinity);146 return new SupportVectorClassificationSolution(model, problemData); 147 147 } 148 148 #endregion
Note: See TracChangeset
for help on using the changeset viewer.