Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/02/12 11:40:31 (13 years ago)
Author:
sforsten
Message:

#1708: merged r7209 from trunk

  • adjusted GUI
  • added toggle for the different series
  • X Axis labels are rounded to useful values
  • added ToolTip
Location:
branches/RegressionBenchmarks
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/RegressionBenchmarks

  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAnalyzer.cs

    r5882 r7255  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
    26 using HeuristicLab.Data;
    2724using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2825using HeuristicLab.Operators;
     26using HeuristicLab.Optimization;
    2927using HeuristicLab.Parameters;
    3028using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    31 using HeuristicLab.Optimization;
    3229
    3330namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    4946    #endregion
    5047    #region properties
     48    public virtual bool EnabledByDefault {
     49      get { return true; }
     50    }
    5151    public ItemArray<ISymbolicExpressionTree> SymbolicExpressionTree {
    5252      get { return SymbolicExpressionTreeParameter.ActualValue; }
  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs

    r5882 r7255  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using System.Linq;
    2325using HeuristicLab.Common;
     
    2628using HeuristicLab.Parameters;
    2729using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using System.Collections.Generic;
    29 using System;
    3030using HeuristicLab.Random;
    3131
  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs

    r7085 r7255  
    7777        strBuilder.Append(FormatRecursively(node.GetSubtree(0)));
    7878      }
     79      int i = 1;
    7980      foreach (SymbolicExpressionTreeNode subTree in node.Subtrees.Skip(1)) {
    80         FormatSep(node, strBuilder);
     81        FormatSep(node, strBuilder, i);
    8182        // format the whole subtree
    8283        strBuilder.Append(FormatRecursively(subTree));
     84        i++;
    8385      }
    8486
     
    9092    private void FormatBegin(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
    9193      if (node.Symbol is Addition) {
    92         strBuilder.Append(@" ");
     94        strBuilder.Append(@" ( ");
    9395      } else if (node.Symbol is Subtraction) {
    9496        if (node.SubtreeCount == 1) {
    95           strBuilder.Append(@"- ");
     97          strBuilder.Append(@"- ( ");
    9698        } else {
    97           strBuilder.Append(@" ");
     99          strBuilder.Append(@" ( ");
    98100        }
    99101      } else if (node.Symbol is Multiplication) {
     
    109111          strBuilder.Append(@" \cfrac{1}{" + node.SubtreeCount + @"}");
    110112        }
    111         strBuilder.Append(@" ");
     113        strBuilder.Append(@" ( ");
    112114      } else if (node.Symbol is Logarithm) {
    113         strBuilder.Append(@"\log ");
     115        strBuilder.Append(@"\log ( ");
    114116      } else if (node.Symbol is Exponential) {
    115         strBuilder.Append(@"\exp ");
     117        strBuilder.Append(@"\exp ( ");
    116118      } else if (node.Symbol is Sine) {
    117         strBuilder.Append(@"\sin ");
     119        strBuilder.Append(@"\sin ( ");
    118120      } else if (node.Symbol is Cosine) {
    119         strBuilder.Append(@"\cos ");
     121        strBuilder.Append(@"\cos ( ");
    120122      } else if (node.Symbol is Tangent) {
    121         strBuilder.Append(@"\tan ");
     123        strBuilder.Append(@"\tan ( ");
    122124      } else if (node.Symbol is GreaterThan) {
    123         strBuilder.Append(@"  ");
     125        strBuilder.Append(@"  ( ");
    124126      } else if (node.Symbol is LessThan) {
    125         strBuilder.Append(@"  ");
     127        strBuilder.Append(@"  ( ");
    126128      } else if (node.Symbol is And) {
    127         strBuilder.Append(@"   ");
     129        strBuilder.Append(@"   ( ");
    128130      } else if (node.Symbol is Or) {
    129         strBuilder.Append(@"   ");
     131        strBuilder.Append(@"   ( ");
    130132      } else if (node.Symbol is Not) {
    131         strBuilder.Append(@" \neg ");
     133        strBuilder.Append(@" \neg ( ");
    132134      } else if (node.Symbol is IfThenElse) {
    133         strBuilder.Append(@" \operatorname{if}  0 < ");
     135        strBuilder.Append(@" \operatorname{if}  ( 0 < ");
    134136      } else if (node.Symbol is Constant) {
    135137        strBuilder.Append("c_{" + constants.Count + "} ");
     
    159161      } else if (node.Symbol is InvokeFunction) {
    160162        var invokeNode = node as InvokeFunctionTreeNode;
    161         strBuilder.Append(invokeNode.Symbol.FunctionName + @" ");
     163        strBuilder.Append(invokeNode.Symbol.FunctionName + @" ( ");
    162164      } else if (node.Symbol is StartSymbol) {
    163165        strBuilder.Append("Result & = ");
     
    166168        strBuilder.Append(" ARG+" + argSym.ArgumentIndex + " ");
    167169      } else if (node.Symbol is Derivative) {
    168         strBuilder.Append(@" \cfrac{d ");
     170        strBuilder.Append(@" \cfrac{d ( ");
    169171      } else if (node.Symbol is TimeLag) {
    170172        var laggedNode = node as ILaggedTreeNode;
    171173        currentLag += laggedNode.Lag;
    172174      } else if (node.Symbol is Power) {
    173         strBuilder.Append(@"");
     175        strBuilder.Append(@" ( ");
    174176      } else if (node.Symbol is Root) {
    175         strBuilder.Append(@"");
     177        strBuilder.Append(@" ( ");
    176178      } else if (node.Symbol is Integral) {
    177179        // actually a new variable for t is needed in all subtrees (TODO)
    178180        var laggedTreeNode = node as ILaggedTreeNode;
    179         strBuilder.Append(@"\sum_{t=" + (laggedTreeNode.Lag + currentLag) + @"}^0 ");
     181        strBuilder.Append(@"\sum_{t=" + (laggedTreeNode.Lag + currentLag) + @"}^0 ( ");
    180182      } else if (node.Symbol is VariableCondition) {
    181183        var conditionTreeNode = node as VariableConditionTreeNode;
     
    184186        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"}   ";
    185187        constants.Add(conditionTreeNode.Threshold);
    186         strBuilder.Append(@" " + p + @"\cdot ");
     188        strBuilder.Append(@" ( " + p + @"\cdot ");
    187189      } else {
    188190        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    190192    }
    191193
    192     private void FormatSep(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
     194    private void FormatSep(ISymbolicExpressionTreeNode node, StringBuilder strBuilder, int step) {
    193195      if (node.Symbol is Addition) {
    194196        strBuilder.Append(" + ");
     
    198200        strBuilder.Append(@" \cdot ");
    199201      } else if (node.Symbol is Division) {
    200         strBuilder.Append(@" }{ \cfrac{ ");
     202        if (step + 1 == node.SubtreeCount)
     203          strBuilder.Append(@"}{");
     204        else
     205          strBuilder.Append(@" }{ \cfrac{ ");
    201206      } else if (node.Symbol is Average) {
    202207        strBuilder.Append(@" + ");
     
    216221        strBuilder.Append(@" < ");
    217222      } else if (node.Symbol is And) {
    218         strBuilder.Append(@" > 0  \land ");
     223        strBuilder.Append(@" > 0  ) \land (");
    219224      } else if (node.Symbol is Or) {
    220         strBuilder.Append(@" > 0  \lor ");
     225        strBuilder.Append(@" > 0  ) \lor (");
    221226      } else if (node.Symbol is Not) {
    222227        throw new InvalidOperationException();
    223228      } else if (node.Symbol is IfThenElse) {
    224         strBuilder.Append(@" , ");
     229        strBuilder.Append(@" ) , (");
    225230      } else if (node.Symbol is ProgramRootSymbol) {
    226231        strBuilder.Append(@"\\" + Environment.NewLine);
     
    231236        strBuilder.Append(@"\\" + Environment.NewLine + " & ");
    232237      } else if (node.Symbol is Power) {
    233         strBuilder.Append(@" ^ { \operatorname{round} ");
     238        strBuilder.Append(@") ^ { \operatorname{round} (");
    234239      } else if (node.Symbol is Root) {
    235         strBuilder.Append(@" ^ {  \cfrac{1}{ \operatorname{round} ");
     240        strBuilder.Append(@") ^ {  \cfrac{1}{ \operatorname{round} (");
    236241      } else if (node.Symbol is VariableCondition) {
    237242        var conditionTreeNode = node as VariableConditionTreeNode;
    238         string p = @"1 /  1 + \exp - c_{" + constants.Count + "} ";
     243        string p = @"1 / ( 1 + \exp ( - c_{" + constants.Count + "} ";
    239244        constants.Add(conditionTreeNode.Slope);
    240         p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"}   ";
     245        p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} ) ) )   ";
    241246        constants.Add(conditionTreeNode.Threshold);
    242         strBuilder.Append(@" +  1 - " + p + @" \cdot ");
     247        strBuilder.Append(@" +  ( 1 - " + p + @" ) \cdot ");
    243248      } else {
    244249        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    248253    private void FormatEnd(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) {
    249254      if (node.Symbol is Addition) {
    250         strBuilder.Append(@" ");
     255        strBuilder.Append(@" ) ");
    251256      } else if (node.Symbol is Subtraction) {
    252         strBuilder.Append(@" ");
     257        strBuilder.Append(@" ) ");
    253258      } else if (node.Symbol is Multiplication) {
    254259      } else if (node.Symbol is Division) {
    255         strBuilder.Append("} ");
    256         if (node.SubtreeCount > 1)
    257           strBuilder.Append("{1} ");
    258         for (int i = 1; i < node.SubtreeCount; i++) {
     260        strBuilder.Append(" } ");
     261        for (int i = 2; i < node.SubtreeCount; i++)
    259262          strBuilder.Append(" } ");
    260         }
    261263      } else if (node.Symbol is Average) {
    262         strBuilder.Append(@" ");
     264        strBuilder.Append(@" ) ");
    263265      } else if (node.Symbol is Logarithm) {
    264         strBuilder.Append(@" ");
     266        strBuilder.Append(@" ) ");
    265267      } else if (node.Symbol is Exponential) {
    266         strBuilder.Append(@" ");
     268        strBuilder.Append(@" ) ");
    267269      } else if (node.Symbol is Sine) {
    268         strBuilder.Append(@" ");
     270        strBuilder.Append(@" ) ");
    269271      } else if (node.Symbol is Cosine) {
    270         strBuilder.Append(@" ");
     272        strBuilder.Append(@" ) ");
    271273      } else if (node.Symbol is Tangent) {
    272         strBuilder.Append(@" ");
     274        strBuilder.Append(@" ) ");
    273275      } else if (node.Symbol is GreaterThan) {
    274         strBuilder.Append(@" ");
     276        strBuilder.Append(@" ) ");
    275277      } else if (node.Symbol is LessThan) {
    276         strBuilder.Append(@" ");
     278        strBuilder.Append(@" ) ");
    277279      } else if (node.Symbol is And) {
    278         strBuilder.Append(@" > 0   ");
     280        strBuilder.Append(@" > 0 ) ) ");
    279281      } else if (node.Symbol is Or) {
    280         strBuilder.Append(@" > 0   ");
     282        strBuilder.Append(@" > 0 ) ) ");
    281283      } else if (node.Symbol is Not) {
    282         strBuilder.Append(@" ");
     284        strBuilder.Append(@" ) ");
    283285      } else if (node.Symbol is IfThenElse) {
    284         strBuilder.Append(@"   ");
     286        strBuilder.Append(@" ) ) ");
    285287      } else if (node.Symbol is Constant) {
    286288      } else if (node.Symbol is LaggedVariable) {
     
    298300      } else if (node.Symbol is Defun) {
    299301      } else if (node.Symbol is InvokeFunction) {
    300         strBuilder.Append(@" ");
     302        strBuilder.Append(@" ) ");
    301303      } else if (node.Symbol is StartSymbol) {
    302304      } else if (node.Symbol is Argument) {
    303305      } else if (node.Symbol is Derivative) {
    304         strBuilder.Append(@" }{dt} ");
     306        strBuilder.Append(@" ) }{dt} ");
    305307      } else if (node.Symbol is TimeLag) {
    306308        var laggedNode = node as ILaggedTreeNode;
    307309        currentLag -= laggedNode.Lag;
    308310      } else if (node.Symbol is Power) {
    309         strBuilder.Append(@" } ");
     311        strBuilder.Append(@" ) } ");
    310312      } else if (node.Symbol is Root) {
    311         strBuilder.Append(@" } } ");
     313        strBuilder.Append(@" ) } ) } ");
    312314      } else if (node.Symbol is Integral) {
    313315        var laggedTreeNode = node as ILaggedTreeNode;
    314         strBuilder.Append(@" ");
     316        strBuilder.Append(@" ) ");
    315317      } else if (node.Symbol is VariableCondition) {
    316318        strBuilder.Append(@"\left) ");
  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs

    r7085 r7255  
    194194      Symbols.Where(s => s.Name == TimeSeriesSymbolsName).First().Enabled = false;
    195195    }
    196 
    197     public void ConfigureAsDefaultTimeSeriesPrognosisGrammar() {
    198       Symbols.Where(s => s is Variable).First().Enabled = false;
    199       Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false;
    200       Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false;
    201       Symbols.Where(s => s.Name == ConditionalSymbolsName).First().Enabled = false;
    202     }
    203196  }
    204197}
  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs

    r5914 r7255  
    3232  [StorableClass]
    3333  public abstract class SymbolicDataAnalysisModel : NamedItem, ISymbolicDataAnalysisModel {
    34     public override Image ItemImage {
     34    public static new Image StaticItemImage {
    3535      get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
    3636    }
  • branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r7085 r7255  
    102102    #region properties
    103103    public string Filename { get; set; }
    104     public override Image ItemImage { get { return VSImageLibrary.Type; } }
     104    public static new Image StaticItemImage { get { return VSImageLibrary.Type; } }
    105105
    106106    IDataAnalysisProblemData IDataAnalysisProblem.ProblemData {
Note: See TracChangeset for help on using the changeset viewer.