Search in sources :

Example 11 with RuleSetModel

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

the class PMMLRuleTranslator method initializeFrom.

/**
 * {@inheritDoc}
 */
@Override
public void initializeFrom(final PMMLDocument pmmlDoc) {
    m_nameMapper = new DerivedFieldMapper(pmmlDoc);
    List<RuleSetModel> models = pmmlDoc.getPMML().getRuleSetModelList();
    if (models.size() == 0) {
        throw new IllegalArgumentException("No treemodel provided.");
    }
    m_originalRuleModel = models.get(0);
    initDataDictionary(pmmlDoc);
    m_rules = parseRulesFromModel(m_originalRuleModel);
    MININGFUNCTION.Enum functionName = m_originalRuleModel.getFunctionName();
    assert functionName == MININGFUNCTION.CLASSIFICATION : functionName;
    m_isScorable = m_originalRuleModel.getIsScorable();
    RuleSet ruleSet = m_originalRuleModel.getRuleSet();
    m_selectionMethodList = ruleSet.getRuleSelectionMethodList();
    m_defaultScore = ruleSet.isSetDefaultScore() ? ruleSet.getDefaultScore() : null;
    m_defaultConfidence = ruleSet.isSetDefaultConfidence() ? ruleSet.getDefaultConfidence() : Double.NaN;
    m_recordCount = ruleSet.isSetRecordCount() ? ruleSet.getRecordCount() : Double.NaN;
    m_nbCorrect = ruleSet.isSetNbCorrect() ? ruleSet.getNbCorrect() : Double.NaN;
}
Also used : DerivedFieldMapper(org.knime.core.node.port.pmml.preproc.DerivedFieldMapper) RuleSetModel(org.dmg.pmml.RuleSetModelDocument.RuleSetModel) RuleSet(org.dmg.pmml.RuleSetDocument.RuleSet) MININGFUNCTION(org.dmg.pmml.MININGFUNCTION)

Aggregations

RuleSetModel (org.dmg.pmml.RuleSetModelDocument.RuleSetModel)11 PMML (org.dmg.pmml.PMMLDocument.PMML)8 RuleSet (org.dmg.pmml.RuleSetDocument.RuleSet)6 ClusteringModel (org.dmg.pmml.ClusteringModelDocument.ClusteringModel)4 GeneralRegressionModel (org.dmg.pmml.GeneralRegressionModelDocument.GeneralRegressionModel)4 NeuralNetwork (org.dmg.pmml.NeuralNetworkDocument.NeuralNetwork)4 PMMLDocument (org.dmg.pmml.PMMLDocument)4 RegressionModel (org.dmg.pmml.RegressionModelDocument.RegressionModel)4 SupportVectorMachineModel (org.dmg.pmml.SupportVectorMachineModelDocument.SupportVectorMachineModel)4 TreeModel (org.dmg.pmml.TreeModelDocument.TreeModel)4 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)4 PMMLPortObject (org.knime.core.node.port.pmml.PMMLPortObject)4 NaiveBayesModel (org.dmg.pmml.NaiveBayesModelDocument.NaiveBayesModel)3 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)3 ParseException (java.text.ParseException)2 AssociationModel (org.dmg.pmml.AssociationModelDocument.AssociationModel)2 LocalTransformations (org.dmg.pmml.LocalTransformationsDocument.LocalTransformations)2 MiningModel (org.dmg.pmml.MiningModelDocument.MiningModel)2 RuleSelectionMethod (org.dmg.pmml.RuleSelectionMethodDocument.RuleSelectionMethod)2 SequenceModel (org.dmg.pmml.SequenceModelDocument.SequenceModel)2