- Timestamp:
- 09/03/09 15:00:23 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs
r2319 r2328 37 37 AddVariableInfo(new VariableInfo("TargetVariable", "The target variable", typeof(StringData), VariableKind.In)); 38 38 AddVariableInfo(new VariableInfo("InputVariables", "The input variable names", typeof(StringData), VariableKind.In)); 39 AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of the training set", typeof(IntData), VariableKind.In)); 40 AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of the training set", typeof(IntData), VariableKind.In)); 41 AddVariableInfo(new VariableInfo("PunishmentFactor", "The punishment factor limits the range of predicted values", typeof(DoubleData), VariableKind.In)); 39 42 AddVariableInfo(new VariableInfo("Predictor", "The predictor can be used to generate estimated values", typeof(IPredictor), VariableKind.New)); 40 43 } … … 48 51 SVMModel model = GetVariableValue<SVMModel>("SVMModel", scope, true); 49 52 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data; 53 int start = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 54 int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 55 double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data; 56 50 57 string targetVariableName = ds.GetVariableName(targetVariable); 51 58 ItemList inputVariables = GetVariableValue<ItemList>("InputVariables", scope, true); … … 53 60 for (int i = 0; i < ds.Columns; i++) variableNames[ds.GetVariableName(i)] = i; 54 61 55 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), new Predictor(model, targetVariableName, variableNames))); 62 double mean = ds.GetMean(targetVariable, start, end); 63 double range = ds.GetRange(targetVariable, start, end); 64 65 Predictor predictor = new Predictor(model, targetVariableName, variableNames); 66 predictor.LowerPredictionLimit = mean - punishmentFactor * range; 67 predictor.UpperPredictionLimit = mean + punishmentFactor * range; 68 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), predictor)); 56 69 return null; 57 70 }
Note: See TracChangeset
for help on using the changeset viewer.