如何将批处理模型应用于rapidminer中的非批处理数据

时间:2016-02-13 10:05:02

标签: batch-processing rapidminer

我使用批量验证创建了一个模型,有没有办法将此模型应用于非批量数据? 以下是我创建的示例流程:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="7.0.001">
 <context>
<input/>
<output/>
<macros/>
 </context>
 <operator activated="true" class="process" compatibility="7.0.001"      expanded="true" name="Process">
<parameter key="logverbosity" value="init"/>
<parameter key="random_seed" value="2001"/>
<parameter key="send_mail" value="never"/>
<parameter key="notification_email" value=""/>
<parameter key="process_duration_for_mail" value="30"/>
<parameter key="encoding" value="SYSTEM"/>
<process expanded="true">
  <operator activated="true" class="retrieve" compatibility="7.0.001" expanded="true" height="68" name="Retrieve distmodel3" width="90" x="45" y="136">
    <parameter key="repository_entry" value="../data/distmodel3"/>
  </operator>
  <operator activated="true" class="set_role" compatibility="7.0.001" expanded="true" height="82" name="Set Role" width="90" x="246" y="187">
    <parameter key="attribute_name" value="batchid"/>
    <parameter key="target_role" value="batch"/>
    <list key="set_additional_roles">
      <parameter key="Letter" value="label"/>
      <parameter key="Frame" value="batch"/>
      <parameter key="Feat1" value="regular"/>
      <parameter key="Feat2" value="regular"/>
      <parameter key="Feat3" value="regular"/>
      <parameter key="Feat4" value="regular"/>
      <parameter key="Feat5" value="regular"/>
      <parameter key="Feat6" value="regular"/>
      <parameter key="Feat7" value="regular"/>
      <parameter key="Feat8" value="regular"/>
      <parameter key="Gender" value="regular"/>
    </list>
  </operator>
  <operator activated="true" class="batch_x_validation" compatibility="7.0.001" expanded="true" height="124" name="Validation" width="90" x="380" y="85">
    <parameter key="create_complete_model" value="false"/>
    <parameter key="average_performances_only" value="true"/>
    <process expanded="true">
      <operator activated="false" class="weka:W-J48" compatibility="7.0.000" expanded="true" height="82" name="W-J48" width="90" x="112" y="34">
        <parameter key="U" value="true"/>
        <parameter key="C" value="0.25"/>
        <parameter key="M" value="2.0"/>
        <parameter key="R" value="false"/>
        <parameter key="B" value="true"/>
        <parameter key="S" value="false"/>
        <parameter key="L" value="false"/>
        <parameter key="A" value="false"/>
      </operator>
      <operator activated="true" class="k_nn" compatibility="7.0.001" expanded="true" height="82" name="k-NN" width="90" x="112" y="187">
        <parameter key="k" value="3"/>
        <parameter key="weighted_vote" value="false"/>
        <parameter key="measure_types" value="MixedMeasures"/>
        <parameter key="mixed_measure" value="MixedEuclideanDistance"/>
        <parameter key="nominal_measure" value="NominalDistance"/>
        <parameter key="numerical_measure" value="EuclideanDistance"/>
        <parameter key="divergence" value="GeneralizedIDivergence"/>
        <parameter key="kernel_type" value="radial"/>
        <parameter key="kernel_gamma" value="1.0"/>
        <parameter key="kernel_sigma1" value="1.0"/>
        <parameter key="kernel_sigma2" value="0.0"/>
        <parameter key="kernel_sigma3" value="2.0"/>
        <parameter key="kernel_degree" value="3.0"/>
        <parameter key="kernel_shift" value="1.0"/>
        <parameter key="kernel_a" value="1.0"/>
        <parameter key="kernel_b" value="0.0"/>
      </operator>
      <connect from_port="training" to_op="k-NN" to_port="training set"/>
      <connect from_op="k-NN" from_port="model" to_port="model"/>
      <portSpacing port="source_training" spacing="0"/>
      <portSpacing port="sink_model" spacing="0"/>
      <portSpacing port="sink_through 1" spacing="0"/>
    </process>
    <process expanded="true">
      <operator activated="true" class="apply_model" compatibility="7.0.001" expanded="true" height="82" name="Apply Model" width="90" x="45" y="34">
        <list key="application_parameters"/>
        <parameter key="create_view" value="false"/>
      </operator>
      <operator activated="true" class="performance_classification" compatibility="7.0.001" expanded="true" height="82" name="Performance" width="90" x="179" y="34">
        <parameter key="main_criterion" value="first"/>
        <parameter key="accuracy" value="true"/>
        <parameter key="classification_error" value="true"/>
        <parameter key="kappa" value="true"/>
        <parameter key="weighted_mean_recall" value="false"/>
        <parameter key="weighted_mean_precision" value="false"/>
        <parameter key="spearman_rho" value="false"/>
        <parameter key="kendall_tau" value="false"/>
        <parameter key="absolute_error" value="false"/>
        <parameter key="relative_error" value="false"/>
        <parameter key="relative_error_lenient" value="false"/>
        <parameter key="relative_error_strict" value="false"/>
        <parameter key="normalized_absolute_error" value="false"/>
        <parameter key="root_mean_squared_error" value="false"/>
        <parameter key="root_relative_squared_error" value="false"/>
        <parameter key="squared_error" value="false"/>
        <parameter key="correlation" value="false"/>
        <parameter key="squared_correlation" value="false"/>
        <parameter key="cross-entropy" value="false"/>
        <parameter key="margin" value="false"/>
        <parameter key="soft_margin_loss" value="false"/>
        <parameter key="logistic_loss" value="false"/>
        <parameter key="skip_undefined_labels" value="true"/>
        <parameter key="use_example_weights" value="true"/>
        <list key="class_weights"/>
      </operator>
      <connect from_port="model" to_op="Apply Model" to_port="model"/>
      <connect from_port="test set" to_op="Apply Model" to_port="unlabelled data"/>
      <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="averagable 1"/>
      <portSpacing port="source_model" spacing="0"/>
      <portSpacing port="source_test set" spacing="0"/>
      <portSpacing port="source_through 1" spacing="0"/>
      <portSpacing port="sink_averagable 1" spacing="0"/>
      <portSpacing port="sink_averagable 2" spacing="0"/>
    </process>
  </operator>
  <operator activated="true" class="legacy:write_model" compatibility="7.0.001" expanded="true" height="68" name="Write Model" width="90" x="514" y="187">
    <parameter key="model_file" value="C:\Users\Hans\Documents\ModelFile.mod"/>
    <parameter key="overwrite_existing_file" value="true"/>
    <parameter key="output_type" value="XML Zipped"/>
  </operator>
  <connect from_op="Retrieve distmodel3" from_port="output" to_op="Set Role" to_port="example set input"/>
  <connect from_op="Set Role" from_port="example set output" to_op="Validation" to_port="training"/>
  <connect from_op="Validation" from_port="model" to_op="Write Model" to_port="input"/>
  <connect from_op="Validation" from_port="training" to_port="result 1"/>
  <connect from_op="Validation" from_port="averagable 1" 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>

/////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////

1 个答案:

答案 0 :(得分:0)

Batch Validation运算符使用属性来拆分训练示例集。由于此属性显式设置为batch类型,因此特殊,这意味着在构建模型时 分类模型使用常规属性来预测类标签。这意味着模型应该在不包含具有批处理角色的属性的示例集上工作。如果模型与包含设置为常规的批处理属性的示例集一起使用,则性能将不依赖于它(模型可能根本不起作用 - 它取决于模型)。