use of org.dmg.pmml.LocalTransformationsDocument.LocalTransformations in project knime-core by knime.
the class DerivedFieldMapper method getDerivedFields.
/**
* @param pmml the pmml document to retrieve the derived fields from
* @return all derived fields from the transformation dictionary as well as
* of all local transformation elements, or an empty array if no
* derived fields are defined.
*/
public static DerivedField[] getDerivedFields(final PMML pmml) {
List<DerivedField> derivedFields = new ArrayList<DerivedField>();
TransformationDictionary trans = pmml.getTransformationDictionary();
if (trans != null) {
derivedFields.addAll(Arrays.asList(trans.getDerivedFieldArray()));
}
LocalTransformations localTrans = null;
if (pmml.getAssociationModelArray().length > 0) {
localTrans = pmml.getAssociationModelArray(0).getLocalTransformations();
} else if (pmml.getClusteringModelArray().length > 0) {
localTrans = pmml.getClusteringModelArray(0).getLocalTransformations();
} else if (pmml.getGeneralRegressionModelArray().length > 0) {
localTrans = pmml.getGeneralRegressionModelArray(0).getLocalTransformations();
} else if (pmml.getNaiveBayesModelArray().length > 0) {
localTrans = pmml.getNaiveBayesModelArray(0).getLocalTransformations();
} else if (pmml.getNeuralNetworkArray().length > 0) {
localTrans = pmml.getNeuralNetworkArray(0).getLocalTransformations();
} else if (pmml.getRegressionModelArray().length > 0) {
localTrans = pmml.getRegressionModelArray(0).getLocalTransformations();
} else if (pmml.getRuleSetModelArray().length > 0) {
localTrans = pmml.getRuleSetModelArray(0).getLocalTransformations();
} else if (pmml.getSequenceModelArray().length > 0) {
localTrans = pmml.getSequenceModelArray(0).getLocalTransformations();
} else if (pmml.getSupportVectorMachineModelArray().length > 0) {
localTrans = pmml.getSupportVectorMachineModelArray(0).getLocalTransformations();
} else if (pmml.getTextModelArray().length > 0) {
localTrans = pmml.getTextModelArray(0).getLocalTransformations();
} else if (pmml.getTimeSeriesModelArray().length > 0) {
localTrans = pmml.getTimeSeriesModelArray(0).getLocalTransformations();
} else if (pmml.getTreeModelArray().length > 0) {
localTrans = pmml.getTreeModelArray(0).getLocalTransformations();
} else if (pmml.sizeOfRuleSetModelArray() > 0) {
localTrans = pmml.getRuleSetModelArray(0).getLocalTransformations();
}
if (localTrans != null) {
derivedFields.addAll(Arrays.asList(localTrans.getDerivedFieldArray()));
}
return derivedFields.toArray(new DerivedField[0]);
}
use of org.dmg.pmml.LocalTransformationsDocument.LocalTransformations in project knime-core by knime.
the class PMMLBinningTranslator method exportToLocalTrans.
/**
* {@inheritDoc}
*/
@Override
public LocalTransformations exportToLocalTrans() {
LocalTransformations localtrans = LocalTransformations.Factory.newInstance();
localtrans.setDerivedFieldArray(createDerivedFields());
return localtrans;
}
use of org.dmg.pmml.LocalTransformationsDocument.LocalTransformations in project knime-core by knime.
the class PMMLMany2OneTranslator method exportToLocalTrans.
/**
* {@inheritDoc}
*/
@Override
public LocalTransformations exportToLocalTrans() {
final LocalTransformations localTrans = LocalTransformations.Factory.newInstance();
localTrans.setDerivedFieldArray(new DerivedField[] { createDerivedField() });
return localTrans;
}
use of org.dmg.pmml.LocalTransformationsDocument.LocalTransformations in project knime-core by knime.
the class PMMLStringConversionTranslator method exportToLocalTrans.
/**
* {@inheritDoc}
*/
@Override
public LocalTransformations exportToLocalTrans() {
LocalTransformations localtrans = LocalTransformations.Factory.newInstance();
localtrans.setDerivedFieldArray(createDerivedFields());
return localtrans;
}
use of org.dmg.pmml.LocalTransformationsDocument.LocalTransformations in project knime-core by knime.
the class PMMLMapValuesTranslator method exportToLocalTrans.
/**
* {@inheritDoc}
*/
@Override
public LocalTransformations exportToLocalTrans() {
LocalTransformations localTrans = LocalTransformations.Factory.newInstance();
localTrans.setDerivedFieldArray(createDerivedFields());
return localTrans;
}
Aggregations