"Need help with decision tree"

chobo
chobo New Altair Community Member
edited November 5 in Community Q&A
Hi, I can't seem to get the decision tree to work even though there are no errors when I hit run button. I have a simple csv file with  three columns, they are all text values.


In the design workspace I have a Read CSV file connected to a Set Role which is connected to the tree, but I can't see the tree view or get a result.


Thanks.

Answers

  • steffen
    steffen New Altair Community Member
    Hello Chobo

    Your description is rather unspecific. Please copy the process from the xml tab into this thread, best into the code-area ("#"-symbol). Then we have something to think about.

    regards,

    steffen
  • chobo
    chobo New Altair Community Member
    Here you go Steffen. I hope this what you are asking for. Thanks!

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" expanded="true" name="Process">
        <process expanded="true" height="280" width="547">
          <operator activated="true" class="read_csv" expanded="true" height="60" name="Read CSV" width="90" x="112" y="75">
            <parameter key="file_name" value="C:\Documents and Settings\chobo\Desktop\test.csv"/>
          </operator>
          <operator activated="true" class="set_role" expanded="true" height="76" name="Set Role" width="90" x="246" y="97">
            <parameter key="name" value="WinLoss"/>
            <parameter key="target_role" value="label"/>
          </operator>
          <operator activated="true" class="decision_tree" expanded="true" height="76" name="Decision Tree" width="90" x="380" y="120"/>
          <connect from_op="Read CSV" from_port="output" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Decision Tree" to_port="training set"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
  • SebastianLoh
    SebastianLoh New Altair Community Member
    Hi chobo,

    it seems you simply forget to connect the model output out your DecisionTree operator to the results. Try this process:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.0">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" expanded="true" name="Process">
        <process expanded="true" height="583" width="920">
          <operator activated="true" class="read_csv" expanded="true" height="60" name="Read CSV" width="90" x="112" y="210">
            <parameter key="file_name" value="C:\Documents and Settings\chobo\Desktop\test.csv"/>
          </operator>
          <operator activated="true" class="set_role" expanded="true" height="76" name="Set Role" width="90" x="313" y="165">
            <parameter key="name" value="WinLoss"/>
            <parameter key="target_role" value="label"/>
          </operator>
          <operator activated="true" class="decision_tree" expanded="true" height="76" name="Decision Tree" width="90" x="581" y="120"/>
          <connect from_op="Read CSV" from_port="output" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Decision Tree" to_port="training set"/>
          <connect from_op="Decision Tree" from_port="model" to_port="result 1"/>
          <connect from_op="Decision Tree" from_port="exampleSet" to_port="result 2"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
          <portSpacing port="sink_result 3" spacing="0"/>
        </process>
      </operator>
    </process>
    Ciao Sebastian
  • chobo
    chobo New Altair Community Member
    It works! Thanks for the help Sebastian.