Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/20/10 10:21:16 (14 years ago)
Author:
gkronber
Message:

Added views for support vector machine models and support vector regression solutions. #1009

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/SupportVectorMachine/SupportVectorMachineModel.cs

    r3842 r3853  
    4343    public SVM.Model Model {
    4444      get { return model; }
    45       set { model = value; }
     45      set {
     46        if (value != model) {
     47          if (value == null) throw new ArgumentNullException();
     48          model = value;
     49          OnChanged(EventArgs.Empty);
     50        }
     51      }
    4652    }
    4753
     
    5258    public SVM.RangeTransform RangeTransform {
    5359      get { return rangeTransform; }
    54       set { rangeTransform = value; }
     60      set {
     61        if (value != rangeTransform) {
     62          if (value == null) throw new ArgumentNullException();
     63          rangeTransform = value;
     64          OnChanged(EventArgs.Empty);
     65        }
     66      }
    5567    }
     68
     69    public SupportVectorMachineModel()
     70      : base() {
     71    }
     72
     73    #region events
     74    public event EventHandler Changed;
     75    private void OnChanged(EventArgs e) {
     76      var handlers = Changed;
     77      if (handlers != null)
     78        handlers(this, e);
     79    }
     80    #endregion
    5681
    5782    #region persistence
     
    99124
    100125    /// <summary>
    101     ///  Exports the <paramref name="model"/> in string representation to output stream <paramref name="s"/>
     126    ///  Exports the <paramref name="model"/> in string representation to stream <paramref name="s"/>
    102127    /// </summary>
    103128    /// <param name="model">The support vector regression model to export</param>
    104     /// <param name="s">The output stream to export the model to</param>
     129    /// <param name="s">The stream to export the model to</param>
    105130    public static void Export(SupportVectorMachineModel model, Stream s) {
    106131      StreamWriter writer = new StreamWriter(s);
    107132      writer.WriteLine("RangeTransform:");
    108       writer.Flush();
     133      writer.Flush(); 
    109134      using (MemoryStream memStream = new MemoryStream()) {
    110135        SVM.RangeTransform.Write(memStream, model.RangeTransform);
Note: See TracChangeset for help on using the changeset viewer.