use of org.dmg.pmml.PMMLObject in project jpmml-sparkml by jpmml.
the class TreeModelCompactor method getParentNode.
private Node getParentNode() {
Deque<PMMLObject> parents = getParents();
PMMLObject parent = parents.peekFirst();
if (parent instanceof Node) {
return (Node) parent;
}
return null;
}
use of org.dmg.pmml.PMMLObject in project jpmml-sparkml by jpmml.
the class TreeModelCompactor method isCategoricalField.
private boolean isCategoricalField(FieldName name) {
Deque<PMMLObject> parents = getParents();
for (PMMLObject parent : parents) {
if (parent instanceof Node) {
Node node = (Node) parent;
Predicate predicate = node.getPredicate();
if (predicate instanceof SimpleSetPredicate) {
SimpleSetPredicate simpleSetPredicate = (SimpleSetPredicate) predicate;
FieldName categoricalField = simpleSetPredicate.getField();
if ((name).equals(categoricalField)) {
return true;
}
} else if (predicate instanceof True) {
True truePredicate = (True) predicate;
FieldName categoricalField = this.categoricalFields.get(truePredicate);
if ((name).equals(categoricalField)) {
return true;
}
}
} else {
return false;
}
}
return false;
}
Aggregations