Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2373 for trunk


Ignore:
Timestamp:
09/21/09 14:49:53 (15 years ago)
Author:
gkronber
Message:

Fixed #757 (Predictors generated by SVM for time-series prognosis have to store min/max time offset to allow later application to new data).

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

Legend:

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

    r2347 r2373  
    4141    private string targetVariable;
    4242    private int minTimeOffset;
     43    public int MinTimeOffset {
     44      get { return minTimeOffset; }
     45    }
    4346    private int maxTimeOffset;
     47    public int MaxTimeOffset {
     48      get { return maxTimeOffset; }
     49    }
    4450
    4551    public Predictor() : base() { } // for persistence
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs

    r2328 r2373  
    3939      AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of the training set", typeof(IntData), VariableKind.In));
    4040      AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of the training set", typeof(IntData), VariableKind.In));
     41      AddVariableInfo(new VariableInfo("MaxTimeOffset", "(optional) highest allowed time offset value", typeof(IntData), VariableKind.In));
     42      AddVariableInfo(new VariableInfo("MinTimeOffset", "(optional) lowest allowed time offset value", typeof(IntData), VariableKind.In));
    4143      AddVariableInfo(new VariableInfo("PunishmentFactor", "The punishment factor limits the range of predicted values", typeof(DoubleData), VariableKind.In));
    4244      AddVariableInfo(new VariableInfo("Predictor", "The predictor can be used to generate estimated values", typeof(IPredictor), VariableKind.New));
     
    5355      int start = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data;
    5456      int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
     57      IntData maxTimeOffsetData = GetVariableValue<IntData>("MaxTimeOffset", scope, true, false);
     58      int maxTimeOffset = maxTimeOffsetData == null ? 0 : maxTimeOffsetData.Data;
     59      IntData minTimeOffsetData = GetVariableValue<IntData>("MinTimeOffset", scope, true, false);
     60      int minTimeOffset = minTimeOffsetData == null ? 0 : minTimeOffsetData.Data;
    5561      double punishmentFactor = GetVariableValue<DoubleData>("PunishmentFactor", scope, true).Data;
    5662
     
    6369      double range = ds.GetRange(targetVariable, start, end);
    6470
    65       Predictor predictor = new Predictor(model, targetVariableName, variableNames);
     71      Predictor predictor = new Predictor(model, targetVariableName, variableNames, minTimeOffset, maxTimeOffset);
    6672      predictor.LowerPredictionLimit = mean - punishmentFactor * range;
    6773      predictor.UpperPredictionLimit = mean + punishmentFactor * range;
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorView.Designer.cs

    r2327 r2373  
    4949      this.upperLimitTextbox = new System.Windows.Forms.TextBox();
    5050      this.upperPredictionLimit = new System.Windows.Forms.Label();
     51      this.maxTimeOffsetTextBox = new System.Windows.Forms.TextBox();
     52      this.maxTimeOffsetLabel = new System.Windows.Forms.Label();
     53      this.minTimeOffsetTextBox = new System.Windows.Forms.TextBox();
     54      this.minTimeOffsetLabel = new System.Windows.Forms.Label();
    5155      this.SuspendLayout();
    5256      //
     
    5458      //
    5559      this.lowerPredictionLimit.AutoSize = true;
    56       this.lowerPredictionLimit.Location = new System.Drawing.Point(3, 137);
     60      this.lowerPredictionLimit.Location = new System.Drawing.Point(3, 189);
    5761      this.lowerPredictionLimit.Name = "lowerPredictionLimit";
    5862      this.lowerPredictionLimit.Size = new System.Drawing.Size(113, 13);
     
    6266      // lowerLimitTextbox
    6367      //
    64       this.lowerLimitTextbox.Location = new System.Drawing.Point(144, 134);
     68      this.lowerLimitTextbox.Location = new System.Drawing.Point(144, 186);
    6569      this.lowerLimitTextbox.Name = "lowerLimitTextbox";
    6670      this.lowerLimitTextbox.ReadOnly = true;
     
    7074      // upperLimitTextbox
    7175      //
    72       this.upperLimitTextbox.Location = new System.Drawing.Point(144, 160);
     76      this.upperLimitTextbox.Location = new System.Drawing.Point(144, 212);
    7377      this.upperLimitTextbox.Name = "upperLimitTextbox";
    7478      this.upperLimitTextbox.ReadOnly = true;
     
    7983      //
    8084      this.upperPredictionLimit.AutoSize = true;
    81       this.upperPredictionLimit.Location = new System.Drawing.Point(3, 163);
     85      this.upperPredictionLimit.Location = new System.Drawing.Point(3, 215);
    8286      this.upperPredictionLimit.Name = "upperPredictionLimit";
    8387      this.upperPredictionLimit.Size = new System.Drawing.Size(113, 13);
     
    8589      this.upperPredictionLimit.Text = "Upper Prediction Limit:";
    8690      //
     91      // maxTimeOffsetTextBox
     92      //
     93      this.maxTimeOffsetTextBox.Location = new System.Drawing.Point(144, 134);
     94      this.maxTimeOffsetTextBox.Name = "maxTimeOffsetTextBox";
     95      this.maxTimeOffsetTextBox.ReadOnly = true;
     96      this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(100, 20);
     97      this.maxTimeOffsetTextBox.TabIndex = 18;
     98      //
     99      // maxTimeOffsetLabel
     100      //
     101      this.maxTimeOffsetLabel.AutoSize = true;
     102      this.maxTimeOffsetLabel.Location = new System.Drawing.Point(3, 137);
     103      this.maxTimeOffsetLabel.Name = "maxTimeOffsetLabel";
     104      this.maxTimeOffsetLabel.Size = new System.Drawing.Size(81, 13);
     105      this.maxTimeOffsetLabel.TabIndex = 17;
     106      this.maxTimeOffsetLabel.Text = "Max time offset:";
     107      //
     108      // minTimeOffsetTextBox
     109      //
     110      this.minTimeOffsetTextBox.Location = new System.Drawing.Point(144, 160);
     111      this.minTimeOffsetTextBox.Name = "minTimeOffsetTextBox";
     112      this.minTimeOffsetTextBox.ReadOnly = true;
     113      this.minTimeOffsetTextBox.Size = new System.Drawing.Size(100, 20);
     114      this.minTimeOffsetTextBox.TabIndex = 20;
     115      //
     116      // minTimeOffsetLabel
     117      //
     118      this.minTimeOffsetLabel.AutoSize = true;
     119      this.minTimeOffsetLabel.Location = new System.Drawing.Point(3, 163);
     120      this.minTimeOffsetLabel.Name = "minTimeOffsetLabel";
     121      this.minTimeOffsetLabel.Size = new System.Drawing.Size(78, 13);
     122      this.minTimeOffsetLabel.TabIndex = 19;
     123      this.minTimeOffsetLabel.Text = "Min time offset:";
     124      //
    87125      // PredictorView
    88126      //
    89127      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    90128      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     129      this.Controls.Add(this.minTimeOffsetTextBox);
     130      this.Controls.Add(this.minTimeOffsetLabel);
     131      this.Controls.Add(this.maxTimeOffsetTextBox);
     132      this.Controls.Add(this.maxTimeOffsetLabel);
    91133      this.Controls.Add(this.upperLimitTextbox);
    92134      this.Controls.Add(this.upperPredictionLimit);
     
    94136      this.Controls.Add(this.lowerPredictionLimit);
    95137      this.Name = "PredictorView";
    96       this.Size = new System.Drawing.Size(291, 193);
     138      this.Size = new System.Drawing.Size(252, 240);
    97139      this.Controls.SetChildIndex(this.lowerPredictionLimit, 0);
    98140      this.Controls.SetChildIndex(this.lowerLimitTextbox, 0);
    99141      this.Controls.SetChildIndex(this.upperPredictionLimit, 0);
    100142      this.Controls.SetChildIndex(this.upperLimitTextbox, 0);
     143      this.Controls.SetChildIndex(this.maxTimeOffsetLabel, 0);
     144      this.Controls.SetChildIndex(this.maxTimeOffsetTextBox, 0);
     145      this.Controls.SetChildIndex(this.minTimeOffsetLabel, 0);
     146      this.Controls.SetChildIndex(this.minTimeOffsetTextBox, 0);
    101147      this.ResumeLayout(false);
    102148      this.PerformLayout();
     
    110156    private System.Windows.Forms.TextBox upperLimitTextbox;
    111157    private System.Windows.Forms.Label upperPredictionLimit;
     158    private System.Windows.Forms.TextBox maxTimeOffsetTextBox;
     159    private System.Windows.Forms.Label maxTimeOffsetLabel;
     160    private System.Windows.Forms.TextBox minTimeOffsetTextBox;
     161    private System.Windows.Forms.Label minTimeOffsetLabel;
    112162
    113163  }
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorView.cs

    r2327 r2373  
    3434    private Predictor predictor;
    3535
    36     public PredictorView() : base() {
     36    public PredictorView()
     37      : base() {
    3738      InitializeComponent();
    38     }   
     39    }
    3940
    4041    public PredictorView(Predictor predictor)
     
    4344      this.predictor = predictor;
    4445      UpdateControls();
    45     }
    46 
    47     protected override void UpdateControls() {
    48       base.UpdateControls();
    49       lowerLimitTextbox.Text = predictor.LowerPredictionLimit.ToString();
    50       upperLimitTextbox.Text = predictor.UpperPredictionLimit.ToString();
     46      lowerLimitTextbox.DataBindings.Add(new Binding("Text", predictor, "LowerPredictionLimit"));
     47      upperLimitTextbox.DataBindings.Add(new Binding("Text", predictor, "UpperPredictionLimit"));
     48      maxTimeOffsetTextBox.DataBindings.Add(new Binding("Text", predictor, "MaxTimeOffset"));
     49      minTimeOffsetTextBox.DataBindings.Add(new Binding("Text", predictor, "MinTimeOffset"));
    5150    }
    5251  }
Note: See TracChangeset for help on using the changeset viewer.