Search in sources :

Example 1 with KiePMMLDiscretizeBin

use of org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin in project drools by kiegroup.

the class KiePMMLDiscretizeBinInstanceFactory method getKiePMMLDiscretizeBin.

static KiePMMLDiscretizeBin getKiePMMLDiscretizeBin(final DiscretizeBin discretizeBin) {
    KiePMMLInterval interval = KiePMMLIntervalInstanceFactory.getKiePMMLInterval(discretizeBin.getInterval());
    String binValue = discretizeBin.getBinValue() != null ? discretizeBin.getBinValue().toString() : null;
    return new KiePMMLDiscretizeBin(UUID.randomUUID().toString(), getKiePMMLExtensions(discretizeBin.getExtensions()), binValue, interval);
}
Also used : KiePMMLDiscretizeBin(org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin) KiePMMLInterval(org.kie.pmml.commons.model.expressions.KiePMMLInterval)

Example 2 with KiePMMLDiscretizeBin

use of org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin in project drools by kiegroup.

the class KiePMMLDiscretizeBinInstanceFactoryTest method getKiePMMLDiscretizeBin.

@Test
public void getKiePMMLDiscretizeBin() {
    DiscretizeBin toConvert = getRandomDiscretizeBin();
    KiePMMLDiscretizeBin retrieved = KiePMMLDiscretizeBinInstanceFactory.getKiePMMLDiscretizeBin(toConvert);
    commonVerifyKiePMMLDiscretizeBin(retrieved, toConvert);
}
Also used : KiePMMLDiscretizeBin(org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin) InstanceFactoriesTestCommon.commonVerifyKiePMMLDiscretizeBin(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLDiscretizeBin) KiePMMLDiscretizeBin(org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin) DiscretizeBin(org.dmg.pmml.DiscretizeBin) InstanceFactoriesTestCommon.commonVerifyKiePMMLDiscretizeBin(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLDiscretizeBin) PMMLModelTestUtils.getRandomDiscretizeBin(org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomDiscretizeBin) Test(org.junit.Test)

Example 3 with KiePMMLDiscretizeBin

use of org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin in project drools by kiegroup.

the class KiePMMLDiscretizeInstanceFactory method getKiePMMLDiscretize.

static KiePMMLDiscretize getKiePMMLDiscretize(final Discretize discretize) {
    List<KiePMMLDiscretizeBin> discretizeBins = discretize.hasDiscretizeBins() ? getKiePMMLDiscretizeBins(discretize.getDiscretizeBins()) : Collections.emptyList();
    String mapMissingTo = discretize.getMapMissingTo() != null ? discretize.getMapMissingTo().toString() : null;
    String defaultValue = discretize.getDefaultValue() != null ? discretize.getDefaultValue().toString() : null;
    DATA_TYPE dataType = discretize.getDataType() != null ? DATA_TYPE.byName(discretize.getDataType().value()) : null;
    return new KiePMMLDiscretize(discretize.getField().getValue(), getKiePMMLExtensions(discretize.getExtensions()), discretizeBins, mapMissingTo, defaultValue, dataType);
}
Also used : KiePMMLDiscretizeBin(org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin) DATA_TYPE(org.kie.pmml.api.enums.DATA_TYPE) KiePMMLDiscretize(org.kie.pmml.commons.model.expressions.KiePMMLDiscretize)

Aggregations

KiePMMLDiscretizeBin (org.kie.pmml.commons.model.expressions.KiePMMLDiscretizeBin)3 DiscretizeBin (org.dmg.pmml.DiscretizeBin)1 Test (org.junit.Test)1 DATA_TYPE (org.kie.pmml.api.enums.DATA_TYPE)1 KiePMMLDiscretize (org.kie.pmml.commons.model.expressions.KiePMMLDiscretize)1 KiePMMLInterval (org.kie.pmml.commons.model.expressions.KiePMMLInterval)1 PMMLModelTestUtils.getRandomDiscretizeBin (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomDiscretizeBin)1 InstanceFactoriesTestCommon.commonVerifyKiePMMLDiscretizeBin (org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLDiscretizeBin)1