Search in sources :

Example 1 with DataType

use of org.dmg.pmml.DataType in project knime-core by knime.

the class PMMLStringConversionTranslator method createDerivedFields.

private DerivedField[] createDerivedFields() {
    DATATYPE.Enum dataType = PMMLDataDictionaryTranslator.getPMMLDataType(m_parseType);
    OPTYPE.Enum optype = PMMLDataDictionaryTranslator.getOptype(m_parseType);
    int num = m_includeCols.size();
    DerivedField[] derivedFields = new DerivedField[num];
    for (int i = 0; i < num; i++) {
        DerivedField df = DerivedField.Factory.newInstance();
        String name = m_includeCols.get(i);
        df.setDisplayName(name);
        /* The field name must be retrieved before creating a new derived
             * name for this derived field as the map only contains the
             * current mapping. */
        String fieldName = m_mapper.getDerivedFieldName(name);
        df.setName(m_mapper.createDerivedFieldName(name));
        df.setDataType(dataType);
        df.setOptype(optype);
        FieldRef fieldRef = df.addNewFieldRef();
        fieldRef.setField(fieldName);
        derivedFields[i] = df;
    }
    return derivedFields;
}
Also used : DATATYPE(org.dmg.pmml.DATATYPE) FieldRef(org.dmg.pmml.FieldRefDocument.FieldRef) OPTYPE(org.dmg.pmml.OPTYPE) DerivedField(org.dmg.pmml.DerivedFieldDocument.DerivedField)

Example 2 with DataType

use of org.dmg.pmml.DataType in project knime-core by knime.

the class PMMLStringConversionTranslator method createDerivedFields.

private DerivedField[] createDerivedFields() {
    DATATYPE.Enum dataType = PMMLDataDictionaryTranslator.getPMMLDataType(m_parseType);
    OPTYPE.Enum optype = PMMLDataDictionaryTranslator.getOptype(m_parseType);
    int num = m_includeCols.size();
    DerivedField[] derivedFields = new DerivedField[num];
    for (int i = 0; i < num; i++) {
        DerivedField df = DerivedField.Factory.newInstance();
        String name = m_includeCols.get(i);
        df.setDisplayName(name);
        /* The field name must be retrieved before creating a new derived
             * name for this derived field as the map only contains the
             * current mapping. */
        String fieldName = m_mapper.getDerivedFieldName(name);
        df.setName(m_mapper.createDerivedFieldName(name));
        df.setDataType(dataType);
        df.setOptype(optype);
        FieldRef fieldRef = df.addNewFieldRef();
        fieldRef.setField(fieldName);
        derivedFields[i] = df;
    }
    return derivedFields;
}
Also used : DATATYPE(org.dmg.pmml.DATATYPE) FieldRef(org.dmg.pmml.FieldRefDocument.FieldRef) OPTYPE(org.dmg.pmml.OPTYPE) DerivedField(org.dmg.pmml.DerivedFieldDocument.DerivedField)

Aggregations

DATATYPE (org.dmg.pmml.DATATYPE)2 DerivedField (org.dmg.pmml.DerivedFieldDocument.DerivedField)2 FieldRef (org.dmg.pmml.FieldRefDocument.FieldRef)2 OPTYPE (org.dmg.pmml.OPTYPE)2