Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/16/16 12:04:56 (8 years ago)
Author:
pfleck
Message:

#2632

  • Added the name of the target variable in plots and charts (scatter, line, ...).
  • Renamed MathSymbolicDataAnalysisModelView and added two subclasses for regression and classification that shows the name of the target variable in the equation. (added and used a new Format method to the LatexFormatter that uses the actual target name when encountering the StartSymbol)
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionModelMathView.cs

    r14250 r14255  
    2020#endregion
    2121
    22 using System;
    23 using System.IO;
    24 using System.Windows.Forms;
    2522using HeuristicLab.MainForm;
    26 using HeuristicLab.MainForm.WindowsForms;
     23using HeuristicLab.Problems.DataAnalysis.Symbolic.Views;
    2724
    28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
     25namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views {
    2926  [View("Mathematical Representation")]
    30   [Content(typeof(ISymbolicDataAnalysisModel))]
    31   public partial class MathSymbolicDataAnalysisModelView : AsynchronousContentView {
    32     private SymbolicDataAnalysisExpressionLatexFormatter formatter = new SymbolicDataAnalysisExpressionLatexFormatter();
    33     public MathSymbolicDataAnalysisModelView()
    34       : base() {
    35       InitializeComponent();
    36       webBrowser.ScrollBarsEnabled = true;
    37       webBrowser.ScriptErrorsSuppressed = false;
     27  [Content(typeof(ISymbolicRegressionModel))]
     28  public partial class SymbolicRegressionModelMathView : SymbolicDataAnalysisModelMathView {
    3829
    39       // update for the first time after page has loaded
    40       webBrowser.DocumentCompleted += (sender, args) => RefreshHtmlPage();
     30    public SymbolicRegressionModelMathView() : base() { }
    4131
    42       string hlDir = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory);
    43       webBrowser.Navigate("file://" + Path.Combine(hlDir, "displayModelFrame.html"));
    44     }
    45 
    46     public new ISymbolicDataAnalysisModel Content {
    47       get { return (ISymbolicDataAnalysisModel)base.Content; }
     32    public new ISymbolicRegressionModel Content {
     33      get { return (ISymbolicRegressionModel)base.Content; }
    4834      set { base.Content = value; }
    4935    }
    5036
    51     protected override void OnContentChanged() {
    52       base.OnContentChanged();
    53       RefreshHtmlPage();
    54     }
    55 
    56     private void RefreshHtmlPage() {
    57       // only update if the page has loaded already
    58       if (webBrowser.Document == null || webBrowser.Document.Body == null) return;
    59 
    60       if (Content != null) {
    61         HtmlElement newElement = webBrowser.Document.GetElementById("model");
    62         newElement.InnerText = formatter.Format(Content.SymbolicExpressionTree);
    63         webBrowser.Document.InvokeScript("refreshModel");
    64       } else {
    65         HtmlElement newElement = webBrowser.Document.GetElementById("model");
    66         newElement.InnerText = string.Empty;
    67       }
     37    protected override string GetFormattedTree() {
     38      return Formatter.Format(Content.SymbolicExpressionTree, Content.TargetVariable);
    6839    }
    6940  }
Note: See TracChangeset for help on using the changeset viewer.