🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"Modify Decision Tree Spliting Score"

User: "cplai"
New Altair Community Member
Updated by Jocelyn
Hi all,

I am new in RapidMiner and I need help for my testing. I would like to use RapidMiner to construct a decision tree for me, but I would like to use new splitting criterion instead of Gain Ratio, Info Gain, Gini Index or the other which are provided by RapidMiner. May I know could I do that? Below is some code which generate standard decision tree with Gain Ratio.

/**
*
* @author CP Lai
*/
public class MIM_DT {

    //RapidMiner operators
    private Operator exampleSource;
    private Operator decisionTree;
    private Operator modelWriter;

    public MIM_DT(){

        try{
            // Tell the Java application where rapidminer located and start rapidminer
            System.setProperty("rapidminer.home", "C:\\Program Files\\Rapid-I\\RapidMiner");
            RapidMiner.init(false, false, false, true);

            // Initialize ExampleSource operator
            exampleSource = OperatorService.createOperator( "ExampleSource" );
            exampleSource.setParameter("attributes", "C:\\Documents and Settings\\student\\Desktop\\MIMDT\\clev_training.aml");

            decisionTree = OperatorService.createOperator("DecisionTree");
            decisionTree.setParameter("criterion", "gain_ratio");

            modelWriter = OperatorService.createOperator("ModelWriter");
            modelWriter.setParameter("model_file", "C:\\Documents and Settings\\student\\Desktop\\MIMDT\\clev_training3.mod");
            modelWriter.setParameter("output_type", "Binary");

            this.runMIM_DT();
        }

        catch(Exception e){
            e.printStackTrace();
        }
    }

    private void runMIM_DT(){
       
        try {
            IOContainer container = exampleSource.apply(new IOContainer());
            ExampleSet eSet = container.get(ExampleSet.class);

            container = decisionTree.apply(container);
            Model aModel = container.get(Model.class);
            System.out.println("Result???");
            System.out.println(aModel.toString());

            container = modelWriter.apply(container);
            Model outModel = container.get(Model.class);

        } catch (OperatorException ex) {
            Logger.getLogger(MIM_DT.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public static void main(String[] args){
        MIM_DT aTree = new MIM_DT();
    }

}

Your help will be fully appreciated by me. Thanks you

Chee Ping

Find more posts tagged with