use of org.knime.core.node.port.pmml.PMMLMiningSchemaTranslator in project knime-core by knime.
the class PMMLImport method init.
/**
* @param pmmlDoc
*/
private void init(final PMMLDocument pmmlDoc) {
PMMLDataDictionaryTranslator dictTrans = new PMMLDataDictionaryTranslator();
dictTrans.initializeFrom(pmmlDoc);
DataTableSpec tableSpec = dictTrans.getDataTableSpec();
List<String> activeDerivedFields = dictTrans.getActiveDerivedFields();
PMMLPortObjectSpecCreator specCreator = new PMMLPortObjectSpecCreator(tableSpec);
PMMLMiningSchemaTranslator miningTrans = new PMMLMiningSchemaTranslator();
miningTrans.initializeFrom(pmmlDoc);
Set<String> activeFields = new LinkedHashSet<String>();
List<String> miningFields = miningTrans.getActiveFields();
/* If we have a model all active fields of the data dictionary
* are passed through the mining schema. */
activeFields.addAll(miningFields);
activeFields.addAll(activeDerivedFields);
specCreator.setLearningColsNames(new LinkedList<String>(activeFields));
specCreator.addPreprocColNames(activeDerivedFields);
specCreator.setTargetColsNames(miningTrans.getTargetFields());
PMMLPortObjectSpec portObjectSpec = specCreator.createSpec();
m_portObject = new PMMLPortObject(portObjectSpec, pmmlDoc);
}
Aggregations