Examples of PMML


Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    }


    @Test
    public void testPMMLCustomOutput() throws Exception {
        PMML pmmlDocument = null;
        String drl = null;
        if (scorecardCompiler.compileFromExcel(PMMLDocumentTest.class.getResourceAsStream("/scoremodel_externalmodel.xls")) ) {
            pmmlDocument = scorecardCompiler.getPMMLDocument();
            assertNotNull( pmmlDocument );
            PMML4Compiler.dumpModel( pmmlDocument, System.out );
            drl = scorecardCompiler.getDRL();
            assertTrue( drl != null && ! drl.isEmpty() );
            //System.out.println(drl);
        } else {
            fail("failed to parse scoremodel Excel.");
        }

        for (Object serializable : pmmlDocument.getAssociationModelsAndBaselineModelsAndClusteringModels()){
            if (serializable instanceof Scorecard){
                Scorecard scorecard = (Scorecard)serializable;
                for (Object obj :scorecard.getExtensionsAndCharacteristicsAndMiningSchemas()){
                    if ( obj instanceof Output) {
                        Output output = (Output)obj;
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML



    @Test
    public void testDRLExecution() throws Exception {
        PMML pmmlDocument = null;
        String drl = null;
        if (scorecardCompiler.compileFromExcel(PMMLDocumentTest.class.getResourceAsStream("/scoremodel_externalmodel.xls")) ) {
            pmmlDocument = scorecardCompiler.getPMMLDocument();
            assertNotNull( pmmlDocument );
            PMML4Compiler.dumpModel( pmmlDocument, System.out );
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    }

    @Test
    public void testWithInitialScore() throws Exception {
        ScorecardCompiler scorecardCompiler2 = new ScorecardCompiler(EXTERNAL_OBJECT_MODEL);
        PMML pmmlDocument2 = null;
        String drl2 = null;
        if ( scorecardCompiler2.compileFromExcel( PMMLDocumentTest.class.getResourceAsStream("/scoremodel_externalmodel.xls" ), "scorecards_initialscore" ) ) {
            pmmlDocument2 = scorecardCompiler2.getPMMLDocument();
            assertNotNull(pmmlDocument2);
            drl2 = scorecardCompiler2.getDRL();
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    }

    @Test
    public void testWithReasonCodes() throws Exception {
        ScorecardCompiler scorecardCompiler2 = new ScorecardCompiler(EXTERNAL_OBJECT_MODEL);
        PMML pmmlDocument2 = null;
        String drl2 = null;
        if (scorecardCompiler2.compileFromExcel(PMMLDocumentTest.class.getResourceAsStream("/scoremodel_externalmodel.xls"), "scorecards_reasoncode") ) {
            pmmlDocument2 = scorecardCompiler2.getPMMLDocument();
            PMML4Compiler.dumpModel( pmmlDocument2, System.out );
            assertNotNull( pmmlDocument2 );
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    public void setUp() throws Exception {
    }

    @Test
    public void testScoringExtension() throws Exception {
        PMML pmmlDocument;
        ScorecardCompiler scorecardCompiler = new ScorecardCompiler(INTERNAL_DECLARED_TYPES);
        if (scorecardCompiler.compileFromExcel(PMMLDocumentTest.class.getResourceAsStream("/scoremodel_scoring_strategies.xls")) ) {
            pmmlDocument = scorecardCompiler.getPMMLDocument();
            assertNotNull(pmmlDocument);
            String drl = scorecardCompiler.getDRL();
            assertNotNull(drl);
            for (Object serializable : pmmlDocument.getAssociationModelsAndBaselineModelsAndClusteringModels()){
                if (serializable instanceof Scorecard){
                    Scorecard scorecard = (Scorecard)serializable;
                    assertEquals("Sample Score",scorecard.getModelName());
                    Extension extension = ScorecardPMMLUtils.getExtension(scorecard.getExtensionsAndCharacteristicsAndMiningSchemas(), ScorecardPMMLExtensionNames.SCORECARD_SCORING_STRATEGY);
                    assertNotNull(extension);
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    @Test
    public void testAbsenceOfReasonCodes() throws Exception {
        ScorecardCompiler scorecardCompiler = new ScorecardCompiler(INTERNAL_DECLARED_TYPES);
        scorecardCompiler.compileFromExcel( PMMLDocumentTest.class.getResourceAsStream( "/scoremodel_c.xls" ) );
        PMML pmml = scorecardCompiler.getPMMLDocument();
        for (Object serializable : pmml.getAssociationModelsAndBaselineModelsAndClusteringModels()){
            if (serializable instanceof Scorecard){
                assertFalse(((Scorecard) serializable).isUseReasonCodes());
            }
        }
    }
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    @Before
    public void setUp() throws Exception {
        ScorecardCompiler scorecardCompiler = new ScorecardCompiler(INTERNAL_DECLARED_TYPES);
        if (scorecardCompiler.compileFromExcel(PMMLDocumentTest.class.getResourceAsStream("/scoremodel_c.xls")) ) {
            PMML pmmlDocument = scorecardCompiler.getPMMLDocument();
            assertNotNull( pmmlDocument );
            PMML4Compiler.dumpModel( pmmlDocument, System.out );
            drl = scorecardCompiler.getDRL();
        } else {
            fail("failed to parse scoremodel Excel.");
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    }


    public String compile( InputStream source, ClassLoader classLoader ) {
        this.results = new ArrayList<KnowledgeBuilderResult>();
        PMML pmml = loadModel( PMML, source );
        helper.setResolver( classLoader );
        if ( getResults().isEmpty() ) {
            return generateTheory( pmml );
        } else {
            return null;
View Full Code Here

Examples of org.dmg.pmml.pmml_4_2.descr.PMML

    private static final List<String> NUMERIC_OPERATORS = Arrays.asList("=", ">", "<", ">=", "<=");


    public static String marshal( final ScoreCardModel model ) {
        final PMML pmml = createPMMLDocument( model );

        final StringBuilder sb = new StringBuilder();

        //Package statement and Imports are appended by org.drools.scorecards.drl.AbstractDRLEmitter
View Full Code Here

Examples of org.dmg.pmml31.PMMLDocument.PMML

    }
   
    public PMMLDocument toObject()
    {
        PMMLDocument result = PMMLDocument.Factory.newInstance();
        PMML pmmlObject = result.addNewPMML();
        pmmlObject.setVersion("3.0");
        //head of PMML document
        pmmlObject.setHeader(mPMML.getHeader());
        //data dictionary
        DataField[] dataFields = mPMML.getDataDictionary().getDataFieldArray();
        for(int i=0; i<columnCount; i++)
        {
            OPTYPE.Enum optype = dataFields[i].getOptype();
            if (optype == OPTYPE.CATEGORICAL)
            {
                int countValue = histogram_values[i].size();
                Value value = dataFields[i].addNewValue();
                for(int j=0; j<countValue; j++)
                {
                    value.setValue(histogram_values[i].get(j).toString());
                    Extension ext = value.addNewExtension();
                    ext.setName("count");
                    ext.setValue(String.valueOf(histogram_frequency[i][j]));
                }
            }
        }       
        pmmlObject.setDataDictionary(mPMML.getDataDictionary());
        pmmlObject.getDataDictionary().setDataFieldArray(dataFields);
               
        //ModelStat
        MiningModel miningModel = pmmlObject.addNewMiningModel();
        miningModel.setModelName("Statistica");
        org.dmg.pmml31.ModelStatsDocument.ModelStats modelStats =
            miningModel.addNewModelStats();
       
        for(int i=0; i<columnCount; i++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.