- Timestamp:
- 02/21/11 16:33:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeMATLABFormatter.cs
r5433 r5524 84 84 foreach (string variableName in variableNames) 85 85 stringBuilder.AppendLine(" " + variableName + " = Data(:, ???);"); 86 stringBuilder.AppendLine(" for " +CurrentIndexVariable+" = size(Data,1):-1:1");87 stringBuilder.AppendLine(" Target_estimated(" +CurrentIndexVariable+") = " + FormatRecursively(node.SubTrees[0]) + ";");86 stringBuilder.AppendLine(" for " + CurrentIndexVariable + " = size(Data,1):-1:1"); 87 stringBuilder.AppendLine(" Target_estimated(" + CurrentIndexVariable + ") = " + FormatRecursively(node.SubTrees[0]) + ";"); 88 88 stringBuilder.AppendLine(" end"); 89 89 stringBuilder.AppendLine("end"); … … 98 98 stringBuilder.AppendLine(" y = (f0 + 2*f1 - 2*f3 - f4) / 8;"); 99 99 stringBuilder.AppendLine("end"); 100 stringBuilder.AppendLine("function y = sigmoid(slope, x, threshold, a, b)"); 101 stringBuilder.AppendLine(" p = 1.0 / (1 + exp(-slope * (x - threshold)));"); 102 stringBuilder.AppendLine(" y = p * a + (1-p) * b;"); 103 stringBuilder.AppendLine("end"); 104 100 105 return stringBuilder.ToString(); 101 106 } … … 269 274 stringBuilder.Append(FormatRecursively(node.SubTrees[0])); 270 275 currentLag -= laggedNode.Lag; 276 } else if (symbol is VariableCondition) { 277 var varConditionNode = node as VariableConditionTreeNode; 278 stringBuilder.AppendLine(" sigmoid(" + varConditionNode.Slope.ToString(CultureInfo.InvariantCulture) + ", " + 279 varConditionNode.VariableName + LagToString(currentLag) + ", " + 280 varConditionNode.Threshold.ToString(CultureInfo.InvariantCulture) + ", " + 281 FormatRecursively(varConditionNode.SubTrees[0]) + ", " + 282 FormatRecursively(varConditionNode.SubTrees[1]) + ")"); 271 283 } else { 272 284 stringBuilder.Append("ERROR");
Note: See TracChangeset
for help on using the changeset viewer.