Changeset 3847
- Timestamp:
- 05/18/10 14:09:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModelEvaluator.cs
r3842 r3847 82 82 83 83 public override IOperation Apply() { 84 int targetVariableIndex = DataAnalysisProblemData.Dataset.GetVariableIndex(DataAnalysisProblemData.TargetVariable.Value);85 84 int start = SamplesStart.Value; 86 85 int end = SamplesEnd.Value; 87 86 88 SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(DataAnalysisProblemData, start, end); 89 SVM.Problem scaledProblem = SupportVectorMachineModel.RangeTransform.Scale(problem); 87 ValuesParameter.ActualValue = new DoubleMatrix(Evaluate(SupportVectorMachineModel, DataAnalysisProblemData, start, end)); 88 return base.Apply(); 89 } 90 91 public static double[,] Evaluate(SupportVectorMachineModel model, DataAnalysisProblemData problemData, int start, int end) { 92 SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(problemData, start, end); 93 SVM.Problem scaledProblem = model.RangeTransform.Scale(problem); 94 95 int targetVariableIndex = problemData.Dataset.GetVariableIndex(problemData.TargetVariable.Value); 90 96 91 97 double[,] values = new double[scaledProblem.Count, 2]; 92 98 for (int i = 0; i < scaledProblem.Count; i++) { 93 values[i, 0] = DataAnalysisProblemData.Dataset[start + i, targetVariableIndex];94 values[i, 1] = SVM.Prediction.Predict( SupportVectorMachineModel.Model, scaledProblem.X[i]);99 values[i, 0] = problemData.Dataset[start + i, targetVariableIndex]; 100 values[i, 1] = SVM.Prediction.Predict(model.Model, scaledProblem.X[i]); 95 101 } 96 102 97 ValuesParameter.ActualValue = new DoubleMatrix(values); 98 return base.Apply(); 103 return values; 99 104 } 100 105 }
Note: See TracChangeset
for help on using the changeset viewer.