int att = splitAtt.get(index); ContinuousFeature feature = (ContinuousFeature)schema.getFeature(att - 1);
Predicate rightPredicate; Feature feature = schema.getFeature(var - 1);
Feature feature = schema.getFeature(split.featureIndex());
private void encodeNode(org.dmg.pmml.tree.Node parent, int index, Schema schema){ parent.setId(String.valueOf(index + 1)); Node node = allNodes.get(index); if(!node.isLeaf()){ int splitIndex = node.getFeatureIndex(); Feature feature = schema.getFeature(splitIndex); org.dmg.pmml.tree.Node leftChild = new org.dmg.pmml.tree.Node() .setPredicate(encodePredicate(feature, node, true)); encodeNode(leftChild, node.getLeftChild().getId(), schema); org.dmg.pmml.tree.Node rightChild = new org.dmg.pmml.tree.Node() .setPredicate(encodePredicate(feature, node, false)); encodeNode(rightChild, node.getRightChild().getId(), schema); parent.addNodes(leftChild, rightChild); boolean defaultLeft = false; parent.setDefaultChild(defaultLeft ? leftChild.getId() : rightChild.getId()); } else { float value = (float)node.getValue(); parent.setScore(ValueUtil.formatValue(value)); } }
Feature feature = schema.getFeature(splitVarIndex - 1);
Feature feature = schema.getFeature(this.split_feature_real_[index]);
int splitIndex = node.split_index(); Feature feature = schema.getFeature(splitIndex);
Feature feature = schema.getFeature(splitVar - 1);
int splitIndex = node.split_index(); Feature feature = schema.getFeature(splitIndex);
Feature feature = schema.getFeature(index);
Feature feature = schema.getFeature(featureIndex);
boolean leftward = (naSplitDir == NaSplitDir.NALeft.value()) || (naSplitDir == NaSplitDir.Left.value()); Feature feature = schema.getFeature(colId);
Feature feature = schema.getFeature(var);
@Override public NaiveBayesModel encodeModel(Schema schema){ int[] shape = getThetaShape(); int numberOfClasses = shape[0]; int numberOfFeatures = shape[1]; List<? extends Number> theta = getTheta(); List<? extends Number> sigma = getSigma(); CategoricalLabel categoricalLabel = (CategoricalLabel)schema.getLabel(); BayesInputs bayesInputs = new BayesInputs(); for(int i = 0; i < numberOfFeatures; i++){ Feature feature = schema.getFeature(i); List<? extends Number> means = CMatrixUtil.getColumn(theta, numberOfClasses, numberOfFeatures, i); List<? extends Number> variances = CMatrixUtil.getColumn(sigma, numberOfClasses, numberOfFeatures, i); ContinuousFeature continuousFeature = feature.toContinuousFeature(); BayesInput bayesInput = new BayesInput(continuousFeature.getName()) .setTargetValueStats(encodeTargetValueStats(categoricalLabel.getValues(), means, variances)); bayesInputs.addBayesInputs(bayesInput); } List<Integer> classCount = getClassCount(); BayesOutput bayesOutput = new BayesOutput(categoricalLabel.getName(), null) .setTargetValueCounts(encodeTargetValueCounts(categoricalLabel.getValues(), classCount)); NaiveBayesModel naiveBayesModel = new NaiveBayesModel(0d, MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(categoricalLabel), bayesInputs, bayesOutput) .setOutput(ModelUtil.createProbabilityOutput(DataType.DOUBLE, categoricalLabel)); return naiveBayesModel; }