Changeset 14345 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
- Timestamp:
- 10/21/16 17:59:36 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r14282 r14345 126 126 private readonly object syncRoot = new object(); 127 127 public IEnumerable<double> GetSymbolicExpressionTreeValues(ISymbolicExpressionTree tree, IDataset dataset, IEnumerable<int> rows) { 128 if (!rows.Any()) return Enumerable.Empty<double>(); 128 129 if (CheckExpressionsWithIntervalArithmetic) 129 130 throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter."); … … 159 160 if (row < 0 || row >= dataset.Rows) instr.value = double.NaN; 160 161 var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode; 161 double variableValue = ((IList<double>)instr.data)[row]; 162 double x = variableValue - variableConditionTreeNode.Threshold; 163 double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x)); 164 165 double trueBranch = code[instr.childIndex].value; 166 double falseBranch = code[instr.childIndex + 1].value; 167 168 instr.value = trueBranch * p + falseBranch * (1 - p); 162 if (!variableConditionTreeNode.Symbol.IgnoreSlope) { 163 double variableValue = ((IList<double>)instr.data)[row]; 164 double x = variableValue - variableConditionTreeNode.Threshold; 165 double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x)); 166 167 double trueBranch = code[instr.childIndex].value; 168 double falseBranch = code[instr.childIndex + 1].value; 169 170 instr.value = trueBranch * p + falseBranch * (1 - p); 171 } else { 172 double variableValue = ((IList<double>)instr.data)[row]; 173 if (variableValue <= variableConditionTreeNode.Threshold) { 174 instr.value = code[instr.childIndex].value; 175 } else { 176 instr.value = code[instr.childIndex + 1].value; 177 } 178 } 169 179 } else if (instr.opCode == OpCodes.Add) { 170 180 double s = code[instr.childIndex].value; … … 411 421 for (int j = 1; j != seq.Length; ++j) 412 422 seq[j].skip = true; 413 }414 break;423 break; 424 } 415 425 } 416 426 #endregion
Note: See TracChangeset
for help on using the changeset viewer.