Changeset 5524
- Timestamp:
- 02/21/11 16:33:35 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationProblem.cs
r5445 r5524 279 279 FunctionTreeGrammar.RemoveSymbol(symbol); 280 280 foreach (var varSymbol in FunctionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable>()) { 281 varSymbol.VariableNames = ClassificationProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value); 282 } 283 foreach (var varSymbol in FunctionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.VariableCondition>()) { 281 284 varSymbol.VariableNames = ClassificationProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value); 282 285 } -
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"); -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableConditionTreeNode.cs
r5467 r5524 88 88 89 89 public override string ToString() { 90 return variableName + " > " + threshold.ToString("E4") + Environment.NewLine +91 "slope: " + slope.ToString("E4");90 string thresholdString = threshold > 0 ? "+" + threshold.ToString("E4") : threshold.ToString("E4"); 91 return "Sigmoid " + "(" + slope.ToString("E4") + ", " + variableName + thresholdString + ")"; 92 92 } 93 93 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/VariableFrequencyAnalyser.cs
r5445 r5524 112 112 var variableNames = from node in tree.IterateNodesPrefix().OfType<VariableTreeNode>() 113 113 select node.VariableName; 114 var variableNamesInConditions = from node in tree.IterateNodesPrefix().OfType<VariableConditionTreeNode>() 115 select node.VariableName; 114 116 115 foreach (var variableName in variableNames ) {117 foreach (var variableName in variableNames.Concat(variableNamesInConditions)) { 116 118 if (!references.ContainsKey(variableName)) { 117 119 references[variableName] = 1;
Note: See TracChangeset
for help on using the changeset viewer.