Changeset 2413


Ignore:
Timestamp:
10/06/09 10:49:30 (13 years ago)
Author:
gkronber
Message:

Show input variable names, max/min time offset and upper/lower prediction limits in SVMModelView. #772

Location:
trunk/sources/HeuristicLab.SupportVectorMachines/3.2
Files:
3 edited

Legend:

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

    r2412 r2413  
    2424using System.Text;
    2525using System.Xml;
     26using System.Linq;
    2627using HeuristicLab.Core;
    2728using System.Globalization;
     
    9495
    9596    public override IEnumerable<string> GetInputVariables() {
    96       return variableNames.Keys;
     97      return from pair in variableNames
     98             orderby pair.Value
     99             select pair.Key;
    97100    }
    98101
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorView.cs

    r2373 r2413  
    4141    public PredictorView(Predictor predictor)
    4242      : base(predictor.Model) {
     43      this.predictor = predictor;
    4344      InitializeComponent();
    44       this.predictor = predictor;
    45       UpdateControls();
    4645      lowerLimitTextbox.DataBindings.Add(new Binding("Text", predictor, "LowerPredictionLimit"));
    4746      upperLimitTextbox.DataBindings.Add(new Binding("Text", predictor, "UpperPredictionLimit"));
    4847      maxTimeOffsetTextBox.DataBindings.Add(new Binding("Text", predictor, "MaxTimeOffset"));
    4948      minTimeOffsetTextBox.DataBindings.Add(new Binding("Text", predictor, "MinTimeOffset"));
     49      UpdateControls();
     50    }
     51
     52    protected override string GetModelString() {
     53      StringBuilder builder = new StringBuilder();
     54      builder.Append("LowerPredictionLimit: ").AppendLine(predictor.LowerPredictionLimit.ToString());
     55      builder.Append("UpperPredictionLimit: ").AppendLine(predictor.UpperPredictionLimit.ToString());
     56      builder.Append("MaxTimeOffset: ").AppendLine(predictor.MaxTimeOffset.ToString());
     57      builder.Append("MinTimeOffset: ").AppendLine(predictor.MinTimeOffset.ToString());
     58      builder.Append("InputVariables :");
     59      builder.Append(predictor.GetInputVariables().First());
     60      foreach (string variable in predictor.GetInputVariables().Skip(1)) {
     61        builder.Append("; ").Append(variable);
     62      }
     63      builder.AppendLine();
     64      builder.Append(base.GetModelString());
     65      return builder.ToString();
    5066    }
    5167  }
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SVMModelView.cs

    r2411 r2413  
    4949      kernelType.DataBindings.Add(new Binding("Text", model.Model.Parameter, "KernelType"));
    5050      gamma.DataBindings.Add(new Binding("Text", model.Model.Parameter, "Gamma"));
     51    }
     52
     53    protected override void UpdateControls() {
     54      base.UpdateControls();
     55      textBox.Text = GetModelString();
     56    }
     57
     58    protected virtual string GetModelString() {
    5159      StringBuilder builder = new StringBuilder();
    5260      builder.AppendLine("RangeTransform:");
     
    6472        builder.AppendLine(reader.ReadToEnd());
    6573      }
    66 
    67       textBox.Text = builder.ToString();
     74      return builder.ToString();
    6875    }
    6976  }
Note: See TracChangeset for help on using the changeset viewer.