【发布时间】:2018-05-29 19:36:23
【问题描述】:
对于一项作业,我必须使用随训练数据提供的数据计算 ID3 树的性能,解释为什么使用训练数据这样做不好,并找到一种方法来计算不使用训练数据的性能。
这样我得到了 100% 的性能,我认为这是错误的。即使不是,我也不知道从这里去哪里。有什么帮助吗?
【问题讨论】:
对于一项作业,我必须使用随训练数据提供的数据计算 ID3 树的性能,解释为什么使用训练数据这样做不好,并找到一种方法来计算不使用训练数据的性能。
这样我得到了 100% 的性能,我认为这是错误的。即使不是,我也不知道从这里去哪里。有什么帮助吗?
【问题讨论】:
您的问题是,您使用相同的数据进行训练和测试。
您想要将数据拆分为训练和测试数据集。然后,您在训练集上训练您的 ID§ 树,并将该树应用于测试集并计算该结果的性能。
执行此操作的最简单方法是 Split Data 运算符,您可以在其中设置拆分的比率(通常为 0.7 用于训练,0.3 用于测试)。验证模型性能的更稳健的方法是使用交叉验证。
这里也是流程 XML 文件,只需将其复制并粘贴到您的 RapidMiner 流程视图中即可:
<?xml version="1.0" encoding="UTF-8"?><process version="8.2.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="8.2.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="retrieve" compatibility="8.2.000" expanded="true" height="68" name="Retrieve Sonar" width="90" x="45" y="85">
<parameter key="repository_entry" value="//Samples/data/Sonar"/>
</operator>
<operator activated="true" class="numerical_to_polynominal" compatibility="8.2.000" expanded="true" height="82" name="Numerical to Polynominal" width="90" x="179" y="85">
<parameter key="include_special_attributes" value="true"/>
</operator>
<operator activated="true" class="split_data" compatibility="8.2.000" expanded="true" height="103" name="Split Data" width="90" x="380" y="85">
<enumeration key="partitions">
<parameter key="ratio" value="0.7"/>
<parameter key="ratio" value="0.3"/>
</enumeration>
<parameter key="sampling_type" value="shuffled sampling"/>
</operator>
<operator activated="true" class="id3" compatibility="8.2.000" expanded="true" height="82" name="ID3" width="90" x="581" y="85"/>
<operator activated="true" class="apply_model" compatibility="8.2.000" expanded="true" height="82" name="Apply Model" width="90" x="648" y="238">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="performance_classification" compatibility="8.2.000" expanded="true" height="82" name="Performance" width="90" x="782" y="238">
<list key="class_weights"/>
</operator>
<connect from_op="Retrieve Sonar" from_port="output" to_op="Numerical to Polynominal" to_port="example set input"/>
<connect from_op="Numerical to Polynominal" from_port="example set output" to_op="Split Data" to_port="example set"/>
<connect from_op="Split Data" from_port="partition 1" to_op="ID3" to_port="training set"/>
<connect from_op="Split Data" from_port="partition 2" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="ID3" from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_op="Apply Model" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
<connect from_op="Performance" from_port="performance" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
【讨论】: