use of org.knime.base.node.mine.treeensemble.model.TreeNodeNumericCondition in project knime-core by knime.
the class TreeNumericColumnData method updateChildMemberships.
@Override
public void updateChildMemberships(final TreeNodeCondition childCondition, final double[] parentMemberships, final double[] childMembershipsToUpdate) {
final TreeNodeNumericCondition numCondition = (TreeNodeNumericCondition) childCondition;
final NumericOperator numOperator = numCondition.getNumericOperator();
final double splitValue = numCondition.getSplitValue();
for (int i = 0; i < m_originalIndexInColumnList.length; i++) {
final double value = getSorted(i);
final int originalColIndex = m_originalIndexInColumnList[i];
boolean matches;
switch(numOperator) {
case LessThanOrEqual:
matches = value <= splitValue;
break;
case LargerThan:
matches = value > splitValue;
break;
default:
throw new IllegalStateException("Unknown operator " + numOperator);
}
if (!matches) {
childMembershipsToUpdate[originalColIndex] = 0.0;
} else {
assert childMembershipsToUpdate[originalColIndex] == parentMemberships[originalColIndex];
}
}
}
Aggregations