Search in sources :

Example 6 with Characteristic

use of org.dmg.pmml.pmml_4_2.descr.Characteristic in project drools by kiegroup.

the class ScorecardReasonCodeTest method testReasonCodes.

@Test
public void testReasonCodes() throws Exception {
    final ScorecardCompiler scorecardCompiler = new ScorecardCompiler(INTERNAL_DECLARED_TYPES);
    boolean compileResult = scorecardCompiler.compileFromExcel(PMMLDocumentTest.class.getResourceAsStream("/scoremodel_reasoncodes.xls"));
    if (!compileResult) {
        assertErrors(scorecardCompiler);
    }
    final PMML pmmlDocument = scorecardCompiler.getPMMLDocument();
    for (Object serializable : pmmlDocument.getAssociationModelsAndBaselineModelsAndClusteringModels()) {
        if (serializable instanceof Scorecard) {
            for (Object obj : ((Scorecard) serializable).getExtensionsAndCharacteristicsAndMiningSchemas()) {
                if (obj instanceof Characteristics) {
                    Characteristics characteristics = (Characteristics) obj;
                    assertEquals(4, characteristics.getCharacteristics().size());
                    for (Characteristic characteristic : characteristics.getCharacteristics()) {
                        for (Attribute attribute : characteristic.getAttributes()) {
                            assertNotNull(attribute.getReasonCode());
                        }
                    }
                    return;
                }
            }
        }
    }
    fail();
}
Also used : Characteristics(org.dmg.pmml.pmml_4_2.descr.Characteristics) Attribute(org.dmg.pmml.pmml_4_2.descr.Attribute) Characteristic(org.dmg.pmml.pmml_4_2.descr.Characteristic) PMML(org.dmg.pmml.pmml_4_2.descr.PMML) Scorecard(org.dmg.pmml.pmml_4_2.descr.Scorecard) Test(org.junit.Test)

Aggregations

Characteristic (org.dmg.pmml.pmml_4_2.descr.Characteristic)6 Characteristics (org.dmg.pmml.pmml_4_2.descr.Characteristics)6 Attribute (org.dmg.pmml.pmml_4_2.descr.Attribute)5 ScorecardError (org.drools.scorecards.ScorecardError)4 Scorecard (org.dmg.pmml.pmml_4_2.descr.Scorecard)2 ArrayList (java.util.ArrayList)1 Extension (org.dmg.pmml.pmml_4_2.descr.Extension)1 MiningField (org.dmg.pmml.pmml_4_2.descr.MiningField)1 MiningSchema (org.dmg.pmml.pmml_4_2.descr.MiningSchema)1 Output (org.dmg.pmml.pmml_4_2.descr.Output)1 PMML (org.dmg.pmml.pmml_4_2.descr.PMML)1 ScorecardPMMLGenerator (org.drools.scorecards.pmml.ScorecardPMMLGenerator)1 Test (org.junit.Test)1 Import (org.kie.soup.project.datamodel.imports.Import)1