我成功地在一个数据集上应用了 Rapidminer 中的神经网络算子,其中我有 3 列,第 4 列是标记的列
column1|column2|column3|column4(labelled)
data |data |data |data
,现在我有一个测试数据,以便根据column1、column2、column3预测标记列的值,测试数据如下所示:
column1|column2|column3
data |data |data
问题:这是正确的吗?
使用这种方法,我创建了一个模型,以便该过程可以预测未标记列的值:
然后,使用以下参考中的解决方案:
我再次使用拆分数据创建了一个模型,为此我组合了我的数据集进行训练和测试(现在组合数据有一些标记列的值,有些没有这个列值,因为这是测试数据的一部分)。
但我仍然收到此错误。
从我所看到的问题是,您没有将Nominal to Numerical运算符应用于您的测试集。在默认设置中,此运算符为在指定属性中找到的每个标称值创建一个虚拟编码。在您的情况下,您将有一个名为“Course1=A”的列/属性,其中每个示例的条目为 1,其中原始列是“A”,依此类推。
您需要做的是对测试数据应用与训练数据相同的编码。如您所见,Nominal to Numerical运算符有一个额外的输出端口,称为pre(预处理模型的缩写)。这可以用于在多个数据集上应用相同的预处理步骤(如规范化或编码)。
为了令人信服,您还可以使用Group Model运算符将多个模型组合为一个。
请参阅下面的流程 XML(只需将其 c&p 到 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 Golf" width="90" x="45" y="34">
<parameter key="repository_entry" value="//Samples/data/Golf"/>
</operator>
<operator activated="true" class="nominal_to_numerical" compatibility="8.2.000" expanded="true" height="103" name="Nominal to Numerical" width="90" x="179" y="34">
<list key="comparison_groups"/>
<description align="center" color="purple" colored="true" width="126">Transform the nominal attributes into a dummy encoding with 0/1 for each expression.<br>This encoding is then also delivered via &quot;pre&quot; output port.</description>
</operator>
<operator activated="true" class="neural_net" compatibility="8.2.000" expanded="true" height="82" name="Neural Net" width="90" x="447" y="34">
<list key="hidden_layers"/>
</operator>
<operator activated="true" class="retrieve" compatibility="8.2.000" expanded="true" height="68" name="Retrieve Golf-Testset" width="90" x="45" y="340">
<parameter key="repository_entry" value="//Samples/data/Golf-Testset"/>
</operator>
<operator activated="true" class="apply_model" compatibility="8.2.000" expanded="true" height="82" name="Apply Model (2)" width="90" x="447" y="340">
<list key="application_parameters"/>
</operator>
<operator activated="true" class="apply_model" compatibility="8.2.000" expanded="true" height="82" name="Apply Model" width="90" x="648" y="340">
<list key="application_parameters"/>
</operator>
<connect from_op="Retrieve Golf" from_port="output" to_op="Nominal to Numerical" to_port="example set input"/>
<connect from_op="Nominal to Numerical" from_port="example set output" to_op="Neural Net" to_port="training set"/>
<connect from_op="Nominal to Numerical" from_port="preprocessing model" to_op="Apply Model (2)" to_port="model"/>
<connect from_op="Neural Net" from_port="model" to_op="Apply Model" to_port="model"/>
<connect from_op="Retrieve Golf-Testset" from_port="output" to_op="Apply Model (2)" to_port="unlabelled data"/>
<connect from_op="Apply Model (2)" from_port="labelled data" to_op="Apply Model" to_port="unlabelled data"/>
<connect from_op="Apply Model" from_port="labelled data" 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"/>
<description align="center" color="green" colored="true" height="103" resized="true" width="315" x="433" y="433">First apply the &quot;preprocessing&quot; model so the test data have the same structure<br/><br/>Then apply the trained neural net</description>
</process>
</operator>
</process>
也可以随时在RapidMiner 社区论坛中进一步提问或重新发布问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句