use of org.knime.base.node.mine.treeensemble.model.TreeNodeNominalCondition in project knime-core by knime.
the class TreeNominalColumnData method updateChildMemberships.
/**
* {@inheritDoc}
*/
@Override
public void updateChildMemberships(final TreeNodeCondition childCondition, final double[] parentMemberships, final double[] childMembershipsToUpdate) {
TreeNodeNominalCondition nomCondition = (TreeNodeNominalCondition) childCondition;
String value = nomCondition.getValue();
int att = -1;
for (NominalValueRepresentation rep : getMetaData().getValues()) {
if (rep.getNominalValue().equals(value)) {
att = rep.getAssignedInteger();
break;
}
}
if (att == -1) {
throw new IllegalStateException("Unknown value: " + value);
}
final int[] originalIndexInColumnList = m_orginalIndexInColumnList;
int start = 0;
for (int a = 0; a < att; a++) {
start += m_nominalValueCounts[a];
}
int end = start + m_nominalValueCounts[att];
Arrays.fill(childMembershipsToUpdate, 0.0);
for (int index = start; index < end; index++) {
final int indexInColumn = originalIndexInColumnList[index];
final double weight = parentMemberships[indexInColumn];
childMembershipsToUpdate[indexInColumn] = weight;
}
}
use of org.knime.base.node.mine.treeensemble.model.TreeNodeNominalCondition in project knime-core by knime.
the class NominalSplitCandidate method getChildConditions.
/**
* {@inheritDoc}
*/
@Override
public TreeNodeCondition[] getChildConditions() {
TreeNominalColumnMetaData columnMeta = getColumnData().getMetaData();
NominalValueRepresentation[] values = columnMeta.getValues();
List<TreeNodeCondition> resultList = new ArrayList<TreeNodeCondition>(values.length);
for (int i = 0; i < values.length; i++) {
if (m_sumWeightsAttributes[i] >= TreeColumnData.EPSILON) {
resultList.add(new TreeNodeNominalCondition(columnMeta, i));
}
}
return resultList.toArray(new TreeNodeCondition[resultList.size()]);
}
Aggregations