Changeset 6975
- Timestamp:
- 11/09/11 14:32:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r6803 r6975 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 22 25 using System.Text; 23 using System.Linq; 26 using HeuristicLab.Common; 27 using HeuristicLab.Core; 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 24 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;26 using System.Collections.Generic;27 using System;28 using HeuristicLab.Core;29 using HeuristicLab.Common;30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 137 137 } else if (node.Symbol is LaggedVariable) { 138 138 var laggedVarNode = node as LaggedVariableTreeNode; 139 strBuilder.Append("c_{" + constants.Count + "} " + laggedVarNode.VariableName);139 strBuilder.Append("c_{" + constants.Count + "} " + EscapeLatexString(laggedVarNode.VariableName)); 140 140 strBuilder.Append(LagToString(currentLag + laggedVarNode.Lag)); 141 141 constants.Add(laggedVarNode.Weight); 142 142 } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Variable) { 143 143 var varNode = node as VariableTreeNode; 144 strBuilder.Append("c_{" + constants.Count + "} " + varNode.VariableName);144 strBuilder.Append("c_{" + constants.Count + "} " + EscapeLatexString(varNode.VariableName)); 145 145 strBuilder.Append(LagToString(currentLag)); 146 146 constants.Add(varNode.Weight); … … 174 174 string p = @"1 / \left( 1 + \exp \left( - c_{" + constants.Count + "} "; 175 175 constants.Add(conditionTreeNode.Slope); 176 p += @" \cdot \left(" + conditionTreeNode.VariableName+ LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)";176 p += @" \cdot \left(" + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)"; 177 177 constants.Add(conditionTreeNode.Threshold); 178 178 strBuilder.Append(@"\left( " + p + @"\cdot "); … … 230 230 string p = @"1 / \left( 1 + \exp \left( - c_{" + constants.Count + "} "; 231 231 constants.Add(conditionTreeNode.Slope); 232 p += @" \cdot \left(" + conditionTreeNode.VariableName+ LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)";232 p += @" \cdot \left(" + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)"; 233 233 constants.Add(conditionTreeNode.Threshold); 234 234 strBuilder.Append(@" + \left( 1 - " + p + @" \right) \cdot "); … … 311 311 } 312 312 } 313 313 314 private string LagToString(int lag) { 314 315 if (lag < 0) { … … 318 319 } else return "(t)"; 319 320 } 321 322 private string EscapeLatexString(string s) { 323 return s.Replace(@"_", @"\_"); 324 } 320 325 } 321 326 }
Note: See TracChangeset
for help on using the changeset viewer.