Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/03/09 15:00:23 (15 years ago)
Author:
gkronber
Message:

this is the remaining part of changeset r2327.
Applied changes in modeling plugins that are necessary for the new model analyzer (#722)

  • predictor has properties for the lower and upper limit of the predicted value
  • added views for predictors that show the limits (also added a new view for GeneticProgrammingModel that shows the size and height of the model)
  • Reintroduced TreeEvaluatorInjectors that read a PunishmentFactor and calculate the lower and upper limits for estimated values (limits are set in the tree evaluators)
  • Added operators to create Predictors. Changed modeling algorithms to use the predictors for the calculation of final model qualities and variable impacts (to be compatible with the new model analyzer the predictors use a very large PunishmentFactor)
  • replaced all private implementations of double.IsAlmost and use HL.Commons instead (see #733 r2324)
  • Implemented operator SolutionExtractor and moved BestSolutionStorer from HL.Logging to HL.Modeling (fixes #734)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs

    r2319 r2328  
    3737      AddVariableInfo(new VariableInfo("TargetVariable", "The target variable", typeof(StringData), VariableKind.In));
    3838      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));
    3942      AddVariableInfo(new VariableInfo("Predictor", "The predictor can be used to generate estimated values", typeof(IPredictor), VariableKind.New));
    4043    }
     
    4851      SVMModel model = GetVariableValue<SVMModel>("SVMModel", scope, true);
    4952      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
    5057      string targetVariableName = ds.GetVariableName(targetVariable);
    5158      ItemList inputVariables = GetVariableValue<ItemList>("InputVariables", scope, true);
     
    5360      for (int i = 0; i < ds.Columns; i++) variableNames[ds.GetVariableName(i)] = i;
    5461
    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));
    5669      return null;
    5770    }
Note: See TracChangeset for help on using the changeset viewer.