- Timestamp:
- 12/20/11 13:54:57 (13 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 4 deleted
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisAnalyzer.cs
r5882 r7215 20 20 #endregion 21 21 22 using System.Collections.Generic;23 using System.Linq;24 22 using HeuristicLab.Common; 25 23 using HeuristicLab.Core; 26 using HeuristicLab.Data;27 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 25 using HeuristicLab.Operators; 26 using HeuristicLab.Optimization; 29 27 using HeuristicLab.Parameters; 30 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Optimization;32 29 33 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { … … 49 46 #endregion 50 47 #region properties 48 public virtual bool EnabledByDefault { 49 get { return true; } 50 } 51 51 public ItemArray<ISymbolicExpressionTree> SymbolicExpressionTree { 52 52 get { return SymbolicExpressionTreeParameter.ActualValue; } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationAnalyzer.cs
r5882 r7215 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 22 24 using System.Linq; 23 25 using HeuristicLab.Common; … … 26 28 using HeuristicLab.Parameters; 27 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using System.Collections.Generic;29 using System;30 30 using HeuristicLab.Random; 31 31 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Formatters/SymbolicDataAnalysisExpressionLatexFormatter.cs
r6975 r7215 58 58 constants.Clear(); 59 59 strBuilder.AppendLine("% needs \\usepackage{amsmath}"); 60 strBuilder.AppendLine("\\begin{align}"); 60 strBuilder.AppendLine("\\begin{align*}"); 61 strBuilder.AppendLine("\\nonumber"); 61 62 strBuilder.AppendLine(FormatRecursively(symbolicExpressionTree.Root)); 62 strBuilder.AppendLine("\\end{align }");63 strBuilder.AppendLine("\\end{align*}"); 63 64 return strBuilder.ToString(); 64 65 } … … 76 77 strBuilder.Append(FormatRecursively(node.GetSubtree(0))); 77 78 } 79 int i = 1; 78 80 foreach (SymbolicExpressionTreeNode subTree in node.Subtrees.Skip(1)) { 79 FormatSep(node, strBuilder );81 FormatSep(node, strBuilder, i); 80 82 // format the whole subtree 81 83 strBuilder.Append(FormatRecursively(subTree)); 84 i++; 82 85 } 83 86 … … 89 92 private void FormatBegin(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) { 90 93 if (node.Symbol is Addition) { 91 strBuilder.Append(@" \left( ");94 strBuilder.Append(@" ( "); 92 95 } else if (node.Symbol is Subtraction) { 93 96 if (node.SubtreeCount == 1) { 94 strBuilder.Append(@"- \left(");97 strBuilder.Append(@"- ( "); 95 98 } else { 96 strBuilder.Append(@" \left( ");99 strBuilder.Append(@" ( "); 97 100 } 98 101 } else if (node.Symbol is Multiplication) { … … 108 111 strBuilder.Append(@" \cfrac{1}{" + node.SubtreeCount + @"}"); 109 112 } 110 strBuilder.Append(@" \left(");113 strBuilder.Append(@" ( "); 111 114 } else if (node.Symbol is Logarithm) { 112 strBuilder.Append(@"\log \left(");115 strBuilder.Append(@"\log ( "); 113 116 } else if (node.Symbol is Exponential) { 114 strBuilder.Append(@"\exp \left(");117 strBuilder.Append(@"\exp ( "); 115 118 } else if (node.Symbol is Sine) { 116 strBuilder.Append(@"\sin \left(");119 strBuilder.Append(@"\sin ( "); 117 120 } else if (node.Symbol is Cosine) { 118 strBuilder.Append(@"\cos \left(");121 strBuilder.Append(@"\cos ( "); 119 122 } else if (node.Symbol is Tangent) { 120 strBuilder.Append(@"\tan \left(");123 strBuilder.Append(@"\tan ( "); 121 124 } else if (node.Symbol is GreaterThan) { 122 strBuilder.Append(@" \left( ");125 strBuilder.Append(@" ( "); 123 126 } else if (node.Symbol is LessThan) { 124 strBuilder.Append(@" \left( ");127 strBuilder.Append(@" ( "); 125 128 } else if (node.Symbol is And) { 126 strBuilder.Append(@" \left( \left( ");129 strBuilder.Append(@" ( "); 127 130 } else if (node.Symbol is Or) { 128 strBuilder.Append(@" \left( \left( ");131 strBuilder.Append(@" ( "); 129 132 } else if (node.Symbol is Not) { 130 strBuilder.Append(@" \neg \left( ");133 strBuilder.Append(@" \neg ( "); 131 134 } else if (node.Symbol is IfThenElse) { 132 strBuilder.Append(@" \left( \operatorname{if} \left( 0 < ");135 strBuilder.Append(@" \operatorname{if} ( 0 < "); 133 136 } else if (node.Symbol is Constant) { 134 137 strBuilder.Append("c_{" + constants.Count + "} "); … … 137 140 } else if (node.Symbol is LaggedVariable) { 138 141 var laggedVarNode = node as LaggedVariableTreeNode; 139 strBuilder.Append("c_{" + constants.Count + "} " + EscapeLatexString(laggedVarNode.VariableName)); 142 if (!laggedVarNode.Weight.IsAlmost(1.0)) { 143 strBuilder.Append("c_{" + constants.Count + "} \\cdot "); 144 constants.Add(laggedVarNode.Weight); 145 } 146 strBuilder.Append(EscapeLatexString(laggedVarNode.VariableName)); 140 147 strBuilder.Append(LagToString(currentLag + laggedVarNode.Lag)); 141 constants.Add(laggedVarNode.Weight); 142 } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Variable) {148 149 } else if (node.Symbol is Variable) { 143 150 var varNode = node as VariableTreeNode; 144 strBuilder.Append("c_{" + constants.Count + "} " + EscapeLatexString(varNode.VariableName)); 151 if (!varNode.Weight.IsAlmost((1.0))) { 152 strBuilder.Append("c_{" + constants.Count + "} \\cdot "); 153 constants.Add(varNode.Weight); 154 } 155 strBuilder.Append(EscapeLatexString(varNode.VariableName)); 145 156 strBuilder.Append(LagToString(currentLag)); 146 constants.Add(varNode.Weight);147 157 } else if (node.Symbol is ProgramRootSymbol) { 148 158 } else if (node.Symbol is Defun) { … … 151 161 } else if (node.Symbol is InvokeFunction) { 152 162 var invokeNode = node as InvokeFunctionTreeNode; 153 strBuilder.Append(invokeNode.Symbol.FunctionName + @" \left( ");163 strBuilder.Append(invokeNode.Symbol.FunctionName + @" ( "); 154 164 } else if (node.Symbol is StartSymbol) { 155 165 strBuilder.Append("Result & = "); … … 158 168 strBuilder.Append(" ARG+" + argSym.ArgumentIndex + " "); 159 169 } else if (node.Symbol is Derivative) { 160 strBuilder.Append(@" \cfrac{d \left(");170 strBuilder.Append(@" \cfrac{d ( "); 161 171 } else if (node.Symbol is TimeLag) { 162 172 var laggedNode = node as ILaggedTreeNode; 163 173 currentLag += laggedNode.Lag; 164 174 } else if (node.Symbol is Power) { 165 strBuilder.Append(@" \left(");175 strBuilder.Append(@" ( "); 166 176 } else if (node.Symbol is Root) { 167 strBuilder.Append(@" \left(");177 strBuilder.Append(@" ( "); 168 178 } else if (node.Symbol is Integral) { 169 179 // actually a new variable for t is needed in all subtrees (TODO) 170 180 var laggedTreeNode = node as ILaggedTreeNode; 171 strBuilder.Append(@"\sum_{t=" + (laggedTreeNode.Lag + currentLag) + @"}^0 \left(");181 strBuilder.Append(@"\sum_{t=" + (laggedTreeNode.Lag + currentLag) + @"}^0 ( "); 172 182 } else if (node.Symbol is VariableCondition) { 173 183 var conditionTreeNode = node as VariableConditionTreeNode; 174 string p = @"1 / \left( 1 + \exp \left(- c_{" + constants.Count + "} ";184 string p = @"1 / 1 + \exp - c_{" + constants.Count + "} "; 175 185 constants.Add(conditionTreeNode.Slope); 176 p += @" \cdot \left(" + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)";186 p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} "; 177 187 constants.Add(conditionTreeNode.Threshold); 178 strBuilder.Append(@" \left( " + p + @"\cdot ");188 strBuilder.Append(@" ( " + p + @"\cdot "); 179 189 } else { 180 190 throw new NotImplementedException("Export of " + node.Symbol + " is not implemented."); … … 182 192 } 183 193 184 private void FormatSep(ISymbolicExpressionTreeNode node, StringBuilder strBuilder ) {194 private void FormatSep(ISymbolicExpressionTreeNode node, StringBuilder strBuilder, int step) { 185 195 if (node.Symbol is Addition) { 186 196 strBuilder.Append(" + "); … … 190 200 strBuilder.Append(@" \cdot "); 191 201 } else if (node.Symbol is Division) { 192 strBuilder.Append(@" }{ \cfrac{ "); 202 if (step + 1 == node.SubtreeCount) 203 strBuilder.Append(@"}{"); 204 else 205 strBuilder.Append(@" }{ \cfrac{ "); 193 206 } else if (node.Symbol is Average) { 194 207 strBuilder.Append(@" + "); … … 208 221 strBuilder.Append(@" < "); 209 222 } else if (node.Symbol is And) { 210 strBuilder.Append(@" > 0 \right) \land \left(");223 strBuilder.Append(@" > 0 ) \land ("); 211 224 } else if (node.Symbol is Or) { 212 strBuilder.Append(@" > 0 \right) \lor \left(");225 strBuilder.Append(@" > 0 ) \lor ("); 213 226 } else if (node.Symbol is Not) { 214 227 throw new InvalidOperationException(); 215 228 } else if (node.Symbol is IfThenElse) { 216 strBuilder.Append(@" \right) , \left(");229 strBuilder.Append(@" ) , ("); 217 230 } else if (node.Symbol is ProgramRootSymbol) { 218 231 strBuilder.Append(@"\\" + Environment.NewLine); … … 223 236 strBuilder.Append(@"\\" + Environment.NewLine + " & "); 224 237 } else if (node.Symbol is Power) { 225 strBuilder.Append(@" \right) ^ { \operatorname{round} \left(");238 strBuilder.Append(@") ^ { \operatorname{round} ("); 226 239 } else if (node.Symbol is Root) { 227 strBuilder.Append(@" \right) ^ { \left( \cfrac{1}{ \operatorname{round} \left(");240 strBuilder.Append(@") ^ { \cfrac{1}{ \operatorname{round} ("); 228 241 } else if (node.Symbol is VariableCondition) { 229 242 var conditionTreeNode = node as VariableConditionTreeNode; 230 string p = @"1 / \left( 1 + \exp \left( - c_{" + constants.Count + "} ";243 string p = @"1 / ( 1 + \exp ( - c_{" + constants.Count + "} "; 231 244 constants.Add(conditionTreeNode.Slope); 232 p += @" \cdot \left(" + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} \right) \right) \right)";245 p += @" \cdot " + EscapeLatexString(conditionTreeNode.VariableName) + LagToString(currentLag) + " - c_{" + constants.Count + @"} ) ) ) "; 233 246 constants.Add(conditionTreeNode.Threshold); 234 strBuilder.Append(@" + \left( 1 - " + p + @" \right) \cdot ");247 strBuilder.Append(@" + ( 1 - " + p + @" ) \cdot "); 235 248 } else { 236 249 throw new NotImplementedException("Export of " + node.Symbol + " is not implemented."); … … 240 253 private void FormatEnd(ISymbolicExpressionTreeNode node, StringBuilder strBuilder) { 241 254 if (node.Symbol is Addition) { 242 strBuilder.Append(@" \right) ");255 strBuilder.Append(@" ) "); 243 256 } else if (node.Symbol is Subtraction) { 244 strBuilder.Append(@" \right) ");257 strBuilder.Append(@" ) "); 245 258 } else if (node.Symbol is Multiplication) { 246 259 } else if (node.Symbol is Division) { 247 strBuilder.Append("} "); 248 if (node.SubtreeCount > 1) 249 strBuilder.Append("{1} "); 250 for (int i = 1; i < node.SubtreeCount; i++) { 260 strBuilder.Append(" } "); 261 for (int i = 2; i < node.SubtreeCount; i++) 251 262 strBuilder.Append(" } "); 252 }253 263 } else if (node.Symbol is Average) { 254 strBuilder.Append(@" \right)");264 strBuilder.Append(@" ) "); 255 265 } else if (node.Symbol is Logarithm) { 256 strBuilder.Append(@" \right) ");266 strBuilder.Append(@" ) "); 257 267 } else if (node.Symbol is Exponential) { 258 strBuilder.Append(@" \right) ");268 strBuilder.Append(@" ) "); 259 269 } else if (node.Symbol is Sine) { 260 strBuilder.Append(@" \right) ");270 strBuilder.Append(@" ) "); 261 271 } else if (node.Symbol is Cosine) { 262 strBuilder.Append(@" \right) ");272 strBuilder.Append(@" ) "); 263 273 } else if (node.Symbol is Tangent) { 264 strBuilder.Append(@" \right) ");274 strBuilder.Append(@" ) "); 265 275 } else if (node.Symbol is GreaterThan) { 266 strBuilder.Append(@" \right) ");276 strBuilder.Append(@" ) "); 267 277 } else if (node.Symbol is LessThan) { 268 strBuilder.Append(@" \right) ");278 strBuilder.Append(@" ) "); 269 279 } else if (node.Symbol is And) { 270 strBuilder.Append(@" > 0 \right) \right) ");280 strBuilder.Append(@" > 0 ) ) "); 271 281 } else if (node.Symbol is Or) { 272 strBuilder.Append(@" > 0 \right) \right) ");282 strBuilder.Append(@" > 0 ) ) "); 273 283 } else if (node.Symbol is Not) { 274 strBuilder.Append(@" \right) ");284 strBuilder.Append(@" ) "); 275 285 } else if (node.Symbol is IfThenElse) { 276 strBuilder.Append(@" \right) \right) ");286 strBuilder.Append(@" ) ) "); 277 287 } else if (node.Symbol is Constant) { 278 288 } else if (node.Symbol is LaggedVariable) { 279 } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Variable) {289 } else if (node.Symbol is Variable) { 280 290 } else if (node.Symbol is ProgramRootSymbol) { 281 291 // output all constant values … … 290 300 } else if (node.Symbol is Defun) { 291 301 } else if (node.Symbol is InvokeFunction) { 292 strBuilder.Append(@" \right) ");302 strBuilder.Append(@" ) "); 293 303 } else if (node.Symbol is StartSymbol) { 294 304 } else if (node.Symbol is Argument) { 295 305 } else if (node.Symbol is Derivative) { 296 strBuilder.Append(@" \right) }{dt} ");306 strBuilder.Append(@" ) }{dt} "); 297 307 } else if (node.Symbol is TimeLag) { 298 308 var laggedNode = node as ILaggedTreeNode; 299 309 currentLag -= laggedNode.Lag; 300 310 } else if (node.Symbol is Power) { 301 strBuilder.Append(@" \right) } ");311 strBuilder.Append(@" ) } "); 302 312 } else if (node.Symbol is Root) { 303 strBuilder.Append(@" \right) } \right) } ");313 strBuilder.Append(@" ) } ) } "); 304 314 } else if (node.Symbol is Integral) { 305 315 var laggedTreeNode = node as ILaggedTreeNode; 306 strBuilder.Append(@" \right) ");316 strBuilder.Append(@" ) "); 307 317 } else if (node.Symbol is VariableCondition) { 308 318 strBuilder.Append(@"\left) "); … … 317 327 } else if (lag > 0) { 318 328 return "(t+" + lag + ")"; 319 } else return " (t)";329 } else return ""; 320 330 } 321 331 -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r6819 r7215 138 138 139 139 AddAllowedChildSymbol(powerSymbols, variableSymbol, 0); 140 AddAllowedChildSymbol(powerSymbols, laggedVariable, 0); 140 141 AddAllowedChildSymbol(powerSymbols, constant, 1); 141 142 … … 187 188 public void ConfigureAsDefaultClassificationGrammar() { 188 189 Symbols.Where(s => s is Average).First().Enabled = false; 190 Symbols.Where(s => s is VariableCondition).First().Enabled = false; 189 191 Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false; 190 192 Symbols.Where(s => s.Name == ExponentialFunctionsName).First().Enabled = false; … … 192 194 Symbols.Where(s => s.Name == TimeSeriesSymbolsName).First().Enabled = false; 193 195 } 194 195 public void ConfigureAsDefaultTimeSeriesPrognosisGrammar() {196 Symbols.Where(s => s is Variable).First().Enabled = false;197 Symbols.Where(s => s.Name == TrigonometricFunctionsName).First().Enabled = false;198 Symbols.Where(s => s.Name == PowerFunctionsName).First().Enabled = false;199 Symbols.Where(s => s.Name == ConditionalSymbolsName).First().Enabled = false;200 }201 196 } 202 197 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r6888 r7215 121 121 <Compile Include="Analyzers\SymbolicDataAnalysisVariableFrequencyAnalyzer.cs" /> 122 122 <Compile Include="Analyzers\SymbolicDataAnalysisAlleleFrequencyAnalyzer.cs" /> 123 <Compile Include="SymbolicDataAnalysisExpressionFullTreeCreator.cs" /> 123 <Compile Include="Creators\MultiSymbolicDataAnalysisExpressionCreator.cs" /> 124 <Compile Include="Creators\SymbolicDataAnalysisExpressionFullTreeCreator.cs" /> 125 <Compile Include="Creators\SymbolicDataAnalysisExpressionGrowTreeCreator.cs" /> 126 <Compile Include="Creators\SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator.cs" /> 127 <Compile Include="Creators\SymbolicDataAnalysisExpressionTreeCreator.cs" /> 124 128 <Compile Include="Plugin.cs" /> 125 <Compile Include="SymbolicDataAnalysisExpressionGrowTreeCreator.cs" />126 <Compile Include="SymbolicDataAnalysisExpressionRampedHalfAndHalfTreeCreator.cs" />127 129 <Compile Include="SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs" /> 128 130 <Compile Include="Formatters\SymbolicDataAnalysisExpressionLatexFormatter.cs" /> … … 131 133 <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionTreeInterpreter.cs" /> 132 134 <Compile Include="Interfaces\ISymbolicDataAnalysisProblem.cs" /> 133 <Compile Include="SymbolicDataAnalysisExpressionTreeCreator.cs" />134 135 <Compile Include="SymbolicDataAnalysisModel.cs"> 135 136 <SubType>Code</SubType> -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r6849 r7215 584 584 //to determine the relative amounts of the true and false branch see http://en.wikipedia.org/wiki/Logistic_function 585 585 case OpCodes.VariableCondition: { 586 throw new Not ImplementedException();587 } 588 default: throw new NotSupportedException( );586 throw new NotSupportedException("Interpretation of symbol " + currentInstr.dynamicNode.Symbol.Name + " is not supported by the SymbolicDataAnalysisTreeILEmittingInterpreter"); 587 } 588 default: throw new NotSupportedException("Interpretation of symbol " + currentInstr.dynamicNode.Symbol.Name + " is not supported by the SymbolicDataAnalysisTreeILEmittingInterpreter"); 589 589 } 590 590 } -
branches/HeuristicLab.Hive.Azure/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r6978 r7215 169 169 Parameters.Add(new FixedValueParameter<PercentValue>(RelativeNumberOfEvaluatedSamplesParameterName, RelativeNumberOfEvaluatedSamplesParameterDescription, new PercentValue(1))); 170 170 171 SolutionCreatorParameter.Hidden = true;172 171 SymbolicExpressionTreeInterpreterParameter.Hidden = true; 173 172 MaximumFunctionArgumentsParameter.Hidden = true;
Note: See TracChangeset
for help on using the changeset viewer.