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/Predictor.cs

    r2290 r2328  
    3232
    3333namespace HeuristicLab.SupportVectorMachines {
    34   public class Predictor : ItemBase, IPredictor {
     34  public class Predictor : PredictorBase {
    3535    private SVMModel svmModel;
     36    public SVMModel Model {
     37      get { return svmModel; }
     38    }
     39
    3640    private Dictionary<string, int> variableNames = new Dictionary<string, int>();
    3741    private string targetVariable;
     
    4650    }
    4751
    48     public double[] Predict(Dataset input, int start, int end) {
     52    public override double[] Predict(Dataset input, int start, int end) {
    4953      if (start < 0 || end <= start) throw new ArgumentException("start must be larger than zero and strictly smaller than end");
    5054      if (end > input.Rows) throw new ArgumentOutOfRangeException("number of rows in input is smaller then end");
     
    6468      double[] result = new double[rows];
    6569      for (int row = 0; row < rows; row++) {
    66         result[row] = SVM.Prediction.Predict(model, scaledProblem.X[row]);
     70        result[row] = Math.Max(Math.Min(SVM.Prediction.Predict(model, scaledProblem.X[row]), UpperPredictionLimit), LowerPredictionLimit);
    6771      }
    6872      return result;
     
    7074
    7175    public override IView CreateView() {
    72       return svmModel.CreateView();
     76      return new PredictorView(this);
    7377    }
    7478
Note: See TracChangeset for help on using the changeset viewer.