Decision Tree

RawanRawan MemberPosts:2Newbie
Hi everyone,
After building decision tree how can I know
  1. Tree depth
  2. How many leaves (decision nodes) does it have
Thnx

Jasmine_

Answers

  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified ExpertPosts:942Unicorn
    Hi@Rawan,

    check out Tree to Rules (included in RapidMiner) or "Decision Tree to Example Set" in the Converters extension.
    你可以很容易地得到f决定节点的数量rom the number of rules.
    The tree depth is a bit harder. Essentially, the number of & signs in the description of the rule (with Decision Tree to Example Set) is the number of decisions that were applied.

    Here's an example using the Converters extension:







    <参数键= " logverbosity " value = " init " / >
    <帕拉meter key="random_seed" value="-1"/>
    <帕拉meter key="send_mail" value="never"/>
    <帕拉meter key="notification_email" value=""/>
    <帕拉meter key="process_duration_for_mail" value="30"/>
    <帕拉meter key="encoding" value="SYSTEM"/>


    <帕拉meter key="repository_entry" value="//Samples/data/Iris"/>


    <帕拉meter key="criterion" value="gain_ratio"/>
    <帕拉meter key="maximal_depth" value="10"/>
    <帕拉meter key="apply_pruning" value="true"/>
    <帕拉meter key="confidence" value="0.1"/>
    <帕拉meter key="apply_prepruning" value="true"/>
    <帕拉meter key="minimal_gain" value="0.01"/>
    <帕拉meter key="minimal_leaf_size" value="2"/>
    <帕拉meter key="minimal_size_for_split" value="4"/>
    <帕拉meter key="number_of_prepruning_alternatives" value="3"/>



    <帕拉meter key="macro" value="nodes"/>
    <帕拉meter key="macro_type" value="number_of_examples"/>
    <帕拉meter key="statistics" value="average"/>
    <帕拉meter key="attribute_name" value=""/>




    <帕拉meter key="nodes" value="eval(%{nodes})"/>
    <帕拉meter key="depth" value="length(replaceAll(Condition, "[^&]", "")) + 1"/>

    <帕拉meter key="keep_all" value="true"/>


    <帕拉meter key="use_default_aggregation" value="false"/>
    <帕拉meter key="attribute_filter_type" value="all"/>
    <帕拉meter key="attribute" value=""/>
    <帕拉meter key="attributes" value=""/>
    <帕拉meter key="use_except_expression" value="false"/>
    <帕拉meter key="value_type" value="attribute_value"/>
    <帕拉meter key="use_value_type_exception" value="false"/>
    <帕拉meter key="except_value_type" value="time"/>
    <帕拉meter key="block_type" value="attribute_block"/>
    <帕拉meter key="use_block_type_exception" value="false"/>
    <帕拉meter key="except_block_type" value="value_matrix_row_start"/>
    <帕拉meter key="invert_selection" value="false"/>
    <帕拉meter key="include_special_attributes" value="false"/>
    <帕拉meter key="default_aggregation_function" value="average"/>

    <帕拉meter key="depth" value="maximum"/>

    <帕拉meter key="group_by_attributes" value="nodes"/>
    <帕拉meter key="count_all_combinations" value="false"/>
    <帕拉meter key="only_distinct" value="false"/>
    <帕拉meter key="ignore_missings" value="true"/>













    Regards,
    Balázs
    sgenzer Jasmine_
  • RawanRawan MemberPosts:2Newbie
    BalazsBarany
    sorry but i couldn't find & signs after I used the tree to rules to find the tree depth:(
    Jasmine_
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified ExpertPosts:942Unicorn
    Hi@Rawan,

    that operator has a different output. There's no easy way to process the model description in RapidMiner, but you can copy and process it with an external tool like an editor. Tree to Rules separates the rules with "and".

    The process I put into the discussion (you can copy the XML into RapidMiner Studio in the XML panel) uses the Converters extension. This contains the helpful operator that converts the tree to an example set which you can analyze inside RapidMiner.

    Regards,
    Balázs
    Jasmine_
Sign InorRegisterto comment.