Search in sources :

Example 31 with OP_TYPE

use of org.kie.pmml.api.enums.OP_TYPE in project drools by kiegroup.

the class ModelUtils method getTargetFields.

/**
 * Return a <code>List&lt;KiePMMLNameOpType&gt;</code> of target fields
 * Please note that only <b>predicted/target</b>
 * <code>MiningField</code> are considered.
 * @param fields
 * @param model
 * @return
 */
public static List<KiePMMLNameOpType> getTargetFields(final List<Field<?>> fields, final Model model) {
    List<KiePMMLNameOpType> toReturn = new ArrayList<>();
    if (model.getMiningSchema() != null && model.getMiningSchema().getMiningFields() != null) {
        for (MiningField miningField : model.getMiningSchema().getMiningFields()) {
            if (MiningField.UsageType.TARGET.equals(miningField.getUsageType()) || MiningField.UsageType.PREDICTED.equals(miningField.getUsageType())) {
                OP_TYPE opType = getOpType(fields, model, miningField.getName().getValue());
                toReturn.add(new KiePMMLNameOpType(miningField.getName().getValue(), opType));
            }
        }
    }
    return toReturn;
}
Also used : KiePMMLNameOpType(org.kie.pmml.commons.model.tuples.KiePMMLNameOpType) MiningField(org.dmg.pmml.MiningField) ArrayList(java.util.ArrayList) OP_TYPE(org.kie.pmml.api.enums.OP_TYPE)

Aggregations

OP_TYPE (org.kie.pmml.api.enums.OP_TYPE)31 DATA_TYPE (org.kie.pmml.api.enums.DATA_TYPE)14 DataField (org.dmg.pmml.DataField)13 Test (org.junit.Test)13 MiningField (org.dmg.pmml.MiningField)12 DataDictionary (org.dmg.pmml.DataDictionary)8 MiningSchema (org.dmg.pmml.MiningSchema)8 OutputField (org.dmg.pmml.OutputField)8 CommonTestingUtils.getFieldsFromDataDictionary (org.kie.pmml.compiler.api.CommonTestingUtils.getFieldsFromDataDictionary)8 PMMLModelTestUtils.getDataField (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getDataField)8 PMMLModelTestUtils.getMiningField (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getMiningField)8 PMMLModelTestUtils.getRandomDataField (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomDataField)8 PMMLModelTestUtils.getRandomMiningField (org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getRandomMiningField)8 Model (org.dmg.pmml.Model)7 Target (org.dmg.pmml.Target)7 RegressionModel (org.dmg.pmml.regression.RegressionModel)7 FIELD_USAGE_TYPE (org.kie.pmml.api.enums.FIELD_USAGE_TYPE)7 DataType (org.dmg.pmml.DataType)6 DerivedField (org.dmg.pmml.DerivedField)6 ParameterField (org.dmg.pmml.ParameterField)6