- Timestamp:
- 10/20/09 11:20:13 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs
r2421 r2440 36 36 //Dataset infos 37 37 AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In)); 38 AddVariableInfo(new VariableInfo("TargetVariable", " Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));38 AddVariableInfo(new VariableInfo("TargetVariable", "Name of the target variable", typeof(StringData), VariableKind.In)); 39 39 AddVariableInfo(new VariableInfo("InputVariables", "List of allowed input variable names", typeof(ItemList), VariableKind.In)); 40 40 AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In)); … … 52 52 var inputVariableNames = from x in inputVariables 53 53 select ((StringData)x).Data; 54 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data; 54 string targetVariable = GetVariableValue<StringData>("TargetVariable", scope, true).Data; 55 int targetVariableIndex = dataset.GetVariableIndex(targetVariable); 55 56 int start = GetVariableValue<IntData>("SamplesStart", scope, true).Data; 56 57 int end = GetVariableValue<IntData>("SamplesEnd", scope, true).Data; … … 61 62 SVMModel modelData = GetVariableValue<SVMModel>("SVMModel", scope, true); 62 63 63 SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, targetVariable , inputVariableNames, start, end, minTimeOffset, maxTimeOffset);64 SVM.Problem problem = SVMHelper.CreateSVMProblem(dataset, targetVariableIndex, inputVariableNames, start, end, minTimeOffset, maxTimeOffset); 64 65 SVM.Problem scaledProblem = modelData.RangeTransform.Scale(problem); 65 66 66 67 double[,] values = new double[scaledProblem.Count, 2]; 67 68 for (int i = 0; i < scaledProblem.Count; i++) { 68 values[i, 0] = dataset.GetValue(start + i, targetVariable );69 values[i, 0] = dataset.GetValue(start + i, targetVariableIndex); 69 70 values[i, 1] = SVM.Prediction.Predict(modelData.Model, scaledProblem.X[i]); 70 71 }
Note: See TracChangeset
for help on using the changeset viewer.