use of org.dmg.pmml.TargetValue in project shifu by ShifuML.
the class NNPmmlModelCreator method createTargets.
public Targets createTargets() {
Targets targets = new Targets();
if (modelConfig.isClassification() && ModelTrainConf.MultipleClassification.NATIVE.equals(modelConfig.getTrain().getMultiClassifyMethod())) {
List<Target> targetList = createMultiClassTargets();
targets.addTargets(targetList.toArray(new Target[targetList.size()]));
} else {
Target target = new Target();
target.setOpType(OpType.CONTINUOUS);
target.setField(new FieldName(modelConfig.getTargetColumnName()));
List<TargetValue> targetValueList = new ArrayList<TargetValue>();
if (CollectionUtils.isNotEmpty(modelConfig.getPosTags())) {
for (String posTagValue : modelConfig.getPosTags()) {
TargetValue pos = new TargetValue();
pos.setValue(posTagValue);
pos.setDisplayValue("Positive");
targetValueList.add(pos);
}
}
if (CollectionUtils.isNotEmpty(modelConfig.getNegTags())) {
for (String negTagValue : modelConfig.getNegTags()) {
TargetValue neg = new TargetValue();
neg.setValue(negTagValue);
neg.setDisplayValue("Negative");
targetValueList.add(neg);
}
}
target.addTargetValues(targetValueList.toArray(new TargetValue[targetValueList.size()]));
targets.addTargets(target);
}
return targets;
}
use of org.dmg.pmml.TargetValue in project shifu by ShifuML.
the class TreeEnsemblePmmlCreator method createTargets.
protected Targets createTargets(ModelConfig modelConfig) {
Targets targets = new Targets();
Target target = new Target();
target.setOpType(OpType.CATEGORICAL);
target.setField(new FieldName(modelConfig.getTargetColumnName()));
List<TargetValue> targetValueList = new ArrayList<TargetValue>();
for (String posTagValue : modelConfig.getPosTags()) {
TargetValue pos = new TargetValue();
pos.setValue(posTagValue);
pos.setDisplayValue("Positive");
targetValueList.add(pos);
}
for (String negTagValue : modelConfig.getNegTags()) {
TargetValue neg = new TargetValue();
neg.setValue(negTagValue);
neg.setDisplayValue("Negative");
targetValueList.add(neg);
}
target.addTargetValues(targetValueList.toArray(new TargetValue[targetValueList.size()]));
targets.addTargets(target);
return targets;
}
use of org.dmg.pmml.TargetValue in project drools by kiegroup.
the class KiePMMLTargetValueInstanceFactoryTest method getKiePMMLTargetValue.
@Test
public void getKiePMMLTargetValue() {
final TargetValue toConvert = getRandomTargetValue();
KiePMMLTargetValue retrieved = KiePMMLTargetValueInstanceFactory.getKiePMMLTargetValue(toConvert);
commonVerifyKiePMMLTargetValue(retrieved, toConvert);
}
use of org.dmg.pmml.TargetValue in project drools by kiegroup.
the class PMMLModelTestUtils method getRandomTargetValue.
public static TargetValue getRandomTargetValue() {
Random random = new Random();
TargetValue toReturn = new TargetValue();
toReturn.setValue(random.nextDouble());
toReturn.setDisplayValue(RandomStringUtils.random(6, true, false));
toReturn.setDefaultValue(random.nextFloat());
toReturn.setPriorProbability((double) random.nextInt(100) / 13);
return toReturn;
}
use of org.dmg.pmml.TargetValue in project shifu by ShifuML.
the class TreeModelPmmlElementCreator method createTargets.
protected Targets createTargets(ModelConfig modelConfig) {
Targets targets = new Targets();
Target target = new Target();
target.setOpType(OpType.CATEGORICAL);
target.setField(new FieldName(modelConfig.getTargetColumnName()));
List<TargetValue> targetValueList = new ArrayList<TargetValue>();
for (String posTagValue : modelConfig.getPosTags()) {
TargetValue pos = new TargetValue();
pos.setValue(posTagValue);
pos.setDisplayValue("Positive");
targetValueList.add(pos);
}
for (String negTagValue : modelConfig.getNegTags()) {
TargetValue neg = new TargetValue();
neg.setValue(negTagValue);
neg.setDisplayValue("Negative");
targetValueList.add(neg);
}
target.addTargetValues(targetValueList.toArray(new TargetValue[targetValueList.size()]));
targets.addTargets(target);
return targets;
}
Aggregations