RapidMiner 数据挖掘逻辑回归一标签

Posted

技术标签:

【中文标题】RapidMiner 数据挖掘逻辑回归一标签【英文标题】:RapidMiner Data Mining Logistic Regression One label 【发布时间】:2020-10-24 16:55:27 【问题描述】:

目前正在从事一个教育数据挖掘项目。我的一些数据集有一个非常常见的问题,我无法在任何地方搜索这个问题。每当我运行我的过程时,它总是会声明

'只有一个标签',学习方案逻辑回归没有足够的能力来处理只有一个标签的示例集。如果只知道一个类的示例,则存在现有的特殊建模运算符。它们支持“一类标签”功能。

我得到了一些带有一个标签的数据集,它工作得很好。我也尝试编辑标签,因为我使用了多标签。我无法理解这个问题。请帮助各位!下面是我的 XML。

    <?xml version="1.0" encoding="UTF-8"?>
    <process version="9.7.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.7.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="read_excel" compatibility="9.7.001" expanded="true"  name="Read Excel"  x="45" y="34">
            <parameter key="excel_file" value="D:\MyDocuments\CMUFiles\RESEARCH AND EXTENSION\SHs Performance NAT in Bukidnon\ExcelSubjectTemplate\Language-and-communication\finaldataAnalysis\Humss-Language-and-Communication.xlsx"/>
            <parameter key="sheet_selection" value="sheet number"/>
            <parameter key="sheet_number" value="1"/>
            <parameter key="imported_cell_range" value="A1"/>
            <parameter key="encoding" value="SYSTEM"/>
            <parameter key="first_row_as_names" value="true"/>
            <list key="annotations"/>
            <parameter key="date_format" value=""/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="read_all_values_as_polynominal" value="false"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="Name.true.polynominal.attribute"/>
              <parameter key="1" value="OC-G11-Q1.true.integer.attribute"/>
              <parameter key="2" value="OC-G11-Q2.true.integer.attribute"/>
              <parameter key="3" value="F-G11-Q1.true.integer.attribute"/>
              <parameter key="4" value="F-G11-Q2.true.integer.attribute"/>
              <parameter key="5" value="RWS-G11-Q3.true.integer.attribute"/>
              <parameter key="6" value="RWS-G11-Q4.true.integer.attribute"/>
              <parameter key="7" value="F-G11-Q3.true.integer.attribute"/>
              <parameter key="8" value="F-G11-Q4.true.integer.attribute"/>
              <parameter key="9" value="CW-G12-Q1.true.integer.attribute"/>
              <parameter key="10" value="CW-G12-Q2.true.integer.attribute"/>
              <parameter key="11" value="LC-PS-NAT.true.real.attribute"/>
              <parameter key="12" value="LC-PS-NAT-Rem.true.polynominal.attribute"/>
              <parameter key="13" value="LC-IL-NAT.true.real.attribute"/>
              <parameter key="14" value="LC-IL-NAT-Rem.true.polynominal.attribute"/>
              <parameter key="15" value="LC-CT-NAT.true.real.attribute"/>
              <parameter key="16" value="LC-CT-NAT-Rem.true.polynominal.attribute"/>
              <parameter key="17" value="Total-MPS.true.real.attribute"/>
              <parameter key="18" value="overall-remarks.true.polynominal.attribute"/>
              <parameter key="19" value="T.true.polynominal.attribute"/>
              <parameter key="20" value="U.true.polynominal.attribute"/>
              <parameter key="21" value="V.true.polynominal.attribute"/>
            </list>
            <parameter key="read_not_matching_values_as_missings" value="false"/>
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
          </operator>
          <operator activated="true" class="subprocess" compatibility="9.7.001" expanded="true"  name="Subprocess"  x="179" y="34">
            <process expanded="true">
              <operator activated="true" class="replace_missing_values" compatibility="9.7.001" expanded="true"  name="Replace Missing Values"  x="45" y="34">
                <parameter key="return_preprocessing_model" value="false"/>
                <parameter key="create_view" value="false"/>
                <parameter key="attribute_filter_type" value="all"/>
                <parameter key="attribute" value=""/>
                <parameter key="attributes" value=""/>
                <parameter key="use_except_expression" value="false"/>
                <parameter key="value_type" value="attribute_value"/>
                <parameter key="use_value_type_exception" value="false"/>
                <parameter key="except_value_type" value="time"/>
                <parameter key="block_type" value="attribute_block"/>
                <parameter key="use_block_type_exception" value="false"/>
                <parameter key="except_block_type" value="value_matrix_row_start"/>
                <parameter key="invert_selection" value="false"/>
                <parameter key="include_special_attributes" value="false"/>
                <parameter key="default" value="average"/>
                <list key="columns"/>
              </operator>
              <operator activated="true" class="generate_id" compatibility="9.7.001" expanded="true"  name="Generate ID"  x="179" y="34">
                <parameter key="create_nominal_ids" value="true"/>
                <parameter key="offset" value="0"/>
              </operator>
              <operator activated="true" class="select_attributes" compatibility="9.7.001" expanded="true"  name="Select Attributes"  x="313" y="34">
                <parameter key="attribute_filter_type" value="subset"/>
                <parameter key="attribute" value=""/>
                <parameter key="attributes" value="CW-G12-Q1|CW-G12-Q2|F-G11-Q1|F-G11-Q2|F-G11-Q3|F-G11-Q4|OC-G11-Q1|OC-G11-Q2|overall-remarks|RWS-G11-Q3|RWS-G11-Q4"/>
                <parameter key="use_except_expression" value="false"/>
                <parameter key="value_type" value="attribute_value"/>
                <parameter key="use_value_type_exception" value="false"/>
                <parameter key="except_value_type" value="time"/>
                <parameter key="block_type" value="attribute_block"/>
                <parameter key="use_block_type_exception" value="false"/>
                <parameter key="except_block_type" value="value_matrix_row_start"/>
                <parameter key="invert_selection" value="false"/>
                <parameter key="include_special_attributes" value="false"/>
              </operator>
              <operator activated="true" class="remove_useless_attributes" compatibility="9.7.001" expanded="true"  name="Remove Useless Attributes"  x="514" y="34">
                <parameter key="numerical_min_deviation" value="0.0"/>
                <parameter key="nominal_useless_above" value="1.0"/>
                <parameter key="nominal_remove_id_like" value="false"/>
                <parameter key="nominal_useless_below" value="0.0"/>
              </operator>
              <connect from_port="in 1" to_op="Replace Missing Values" to_port="example set input"/>
              <connect from_op="Replace Missing Values" from_port="example set output" to_op="Generate ID" to_port="example set input"/>
              <connect from_op="Generate ID" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
              <connect from_op="Select Attributes" from_port="example set output" to_op="Remove Useless Attributes" to_port="example set input"/>
              <connect from_op="Remove Useless Attributes" from_port="example set output" to_port="out 1"/>
              <portSpacing port="source_in 1" spacing="0"/>
              <portSpacing port="source_in 2" spacing="0"/>
              <portSpacing port="sink_out 1" spacing="0"/>
              <portSpacing port="sink_out 2" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="set_role" compatibility="9.7.001" expanded="true"  name="Set Role"  x="313" y="34">
            <parameter key="attribute_name" value="id"/>
            <parameter key="target_role" value="batch"/>
            <list key="set_additional_roles">
              <parameter key="overall-remarks" value="label"/>
            </list>
          </operator>
          <operator activated="true" class="split_data" compatibility="9.7.001" expanded="true"  name="Split Data"  x="447" y="85">
            <enumeration key="partitions">
              <parameter key="ratio" value="0.7"/>
              <parameter key="ratio" value="0.3"/>
            </enumeration>
            <parameter key="sampling_type" value="automatic"/>
            <parameter key="use_local_random_seed" value="true"/>
            <parameter key="local_random_seed" value="1992"/>
          </operator>
          <operator activated="true" class="optimize_selection_evolutionary" compatibility="9.7.001" expanded="true"  name="Optimize Selection (Evolutionary)"  x="581" y="34">
            <parameter key="use_exact_number_of_attributes" value="false"/>
            <parameter key="restrict_maximum" value="false"/>
            <parameter key="min_number_of_attributes" value="1"/>
            <parameter key="max_number_of_attributes" value="1"/>
            <parameter key="exact_number_of_attributes" value="1"/>
            <parameter key="initialize_with_input_weights" value="false"/>
            <parameter key="population_size" value="5"/>
            <parameter key="maximum_number_of_generations" value="30"/>
            <parameter key="use_early_stopping" value="false"/>
            <parameter key="generations_without_improval" value="2"/>
            <parameter key="normalize_weights" value="true"/>
            <parameter key="use_local_random_seed" value="false"/>
            <parameter key="local_random_seed" value="1992"/>
            <parameter key="user_result_individual_selection" value="false"/>
            <parameter key="show_population_plotter" value="false"/>
            <parameter key="plot_generations" value="10"/>
            <parameter key="constraint_draw_range" value="false"/>
            <parameter key="draw_dominated_points" value="true"/>
            <parameter key="maximal_fitness" value="Infinity"/>
            <parameter key="selection_scheme" value="tournament"/>
            <parameter key="tournament_size" value="0.25"/>
            <parameter key="start_temperature" value="1.0"/>
            <parameter key="dynamic_selection_pressure" value="true"/>
            <parameter key="keep_best_individual" value="false"/>
            <parameter key="save_intermediate_weights" value="false"/>
            <parameter key="intermediate_weights_generations" value="10"/>
            <parameter key="p_initialize" value="0.5"/>
            <parameter key="p_mutation" value="-1.0"/>
            <parameter key="p_crossover" value="0.5"/>
            <parameter key="crossover_type" value="uniform"/>
            <process expanded="true">
              <operator activated="true" class="time_series:multi_label_model_learner" compatibility="9.7.000" expanded="true"  name="Multi Label Modeling"  x="112" y="34">
                <parameter key="attribute_filter_type" value="subset"/>
                <parameter key="attribute" value=""/>
                <parameter key="attributes" value="overall-remarks"/>
                <parameter key="use_except_expression" value="false"/>
                <parameter key="value_type" value="attribute_value"/>
                <parameter key="use_value_type_exception" value="false"/>
                <parameter key="except_value_type" value="time"/>
                <parameter key="block_type" value="attribute_block"/>
                <parameter key="use_block_type_exception" value="false"/>
                <parameter key="except_block_type" value="value_matrix_row_start"/>
                <parameter key="invert_selection" value="false"/>
                <parameter key="include_special_attributes" value="true"/>
                <parameter key="add_macros" value="false"/>
                <parameter key="current_label_name_macro" value="current_label_attribute"/>
                <parameter key="current_label_type_macro" value="current_label_type"/>
                <parameter key="enable_parallel_execution" value="true"/>
                <process expanded="true">
                  <operator activated="true" class="set_role" compatibility="9.7.001" expanded="true"  name="Set Role (2)"  x="112" y="34">
                    <parameter key="attribute_name" value="overall-remarks"/>
                    <parameter key="target_role" value="label"/>
                    <list key="set_additional_roles"/>
                  </operator>
                  <operator activated="true" class="concurrency:cross_validation" compatibility="9.7.001" expanded="true"  name="Cross Validation"  x="313" y="34">
                    <parameter key="split_on_batch_attribute" value="false"/>
                    <parameter key="leave_one_out" value="false"/>
                    <parameter key="number_of_folds" value="10"/>
                    <parameter key="sampling_type" value="automatic"/>
                    <parameter key="use_local_random_seed" value="false"/>
                    <parameter key="local_random_seed" value="1992"/>
                    <parameter key="enable_parallel_execution" value="true"/>
                    <process expanded="true">
                      <operator activated="true" class="polynomial_by_binomial_classification" compatibility="9.7.001" expanded="true"  name="Polynominal by Binominal Classification"  x="179" y="34">
                        <parameter key="classification_strategies" value="1 against all"/>
                        <parameter key="random_code_multiplicator" value="2.0"/>
                        <parameter key="use_local_random_seed" value="false"/>
                        <parameter key="local_random_seed" value="1992"/>
                        <process expanded="true">
                          <operator activated="true" class="h2o:logistic_regression" compatibility="9.7.001" expanded="true"  name="Logistic Regression"  x="45" y="136">
                            <parameter key="solver" value="AUTO"/>
                            <parameter key="reproducible" value="false"/>
                            <parameter key="maximum_number_of_threads" value="4"/>
                            <parameter key="use_regularization" value="false"/>
                            <parameter key="lambda_search" value="false"/>
                            <parameter key="number_of_lambdas" value="0"/>
                            <parameter key="lambda_min_ratio" value="0.0"/>
                            <parameter key="early_stopping" value="true"/>
                            <parameter key="stopping_rounds" value="3"/>
                            <parameter key="stopping_tolerance" value="0.001"/>
                            <parameter key="standardize" value="true"/>
                            <parameter key="non-negative_coefficients" value="false"/>
                            <parameter key="add_intercept" value="true"/>
                            <parameter key="compute_p-values" value="true"/>
                            <parameter key="remove_collinear_columns" value="true"/>
                            <parameter key="missing_values_handling" value="MeanImputation"/>
                            <parameter key="max_iterations" value="0"/>
                            <parameter key="max_runtime_seconds" value="0"/>
                          </operator>
                          <connect from_port="training set" to_op="Logistic Regression" to_port="training set"/>
                          <connect from_op="Logistic Regression" from_port="model" to_port="model"/>
                          <portSpacing port="source_training set" spacing="0"/>
                          <portSpacing port="sink_model" spacing="0"/>
                        </process>
                      </operator>
                      <connect from_port="training set" to_op="Polynominal by Binominal Classification" to_port="training set"/>
                      <connect from_op="Polynominal by Binominal Classification" from_port="model" to_port="model"/>
                      <portSpacing port="source_training set" 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="9.7.001" expanded="true"  name="Apply Model"  x="45" y="34">
                        <list key="application_parameters"/>
                        <parameter key="create_view" value="false"/>
                      </operator>
                      <operator activated="true" class="performance_classification" compatibility="9.7.001" expanded="true"  name="Performance"  x="179" y="34">
                        <parameter key="main_criterion" value="first"/>
                        <parameter key="accuracy" value="true"/>
                        <parameter key="classification_error" value="false"/>
                        <parameter key="kappa" value="false"/>
                        <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="performance 1"/>
                      <portSpacing port="source_model" spacing="0"/>
                      <portSpacing port="source_test set" spacing="0"/>
                      <portSpacing port="source_through 1" spacing="0"/>
                      <portSpacing port="sink_test set results" spacing="0"/>
                      <portSpacing port="sink_performance 1" spacing="0"/>
                      <portSpacing port="sink_performance 2" spacing="0"/>
                    </process>
                  </operator>
                  <operator activated="true" class="apply_model" compatibility="9.7.001" expanded="true"  name="Apply Model (2)"  x="514" y="187">
                    <list key="application_parameters"/>
                    <parameter key="create_view" value="false"/>
                  </operator>
                  <connect from_port="training set" to_op="Set Role (2)" to_port="example set input"/>
                  <connect from_port="input 1" to_op="Apply Model (2)" to_port="unlabelled data"/>
                  <connect from_op="Set Role (2)" from_port="example set output" to_op="Cross Validation" to_port="example set"/>
                  <connect from_op="Cross Validation" from_port="model" to_op="Apply Model (2)" to_port="model"/>
                  <connect from_op="Apply Model (2)" from_port="model" to_port="model"/>
                  <portSpacing port="source_training set" spacing="0"/>
                  <portSpacing port="source_input 1" spacing="0"/>
                  <portSpacing port="source_input 2" spacing="0"/>
                  <portSpacing port="sink_model" spacing="0"/>
                  <portSpacing port="sink_output 1" spacing="0"/>
                </process>
              </operator>
              <operator activated="true" class="apply_model" compatibility="9.7.001" expanded="true"  name="Apply Model (3)"  x="246" y="136">
                <list key="application_parameters"/>
                <parameter key="create_view" value="false"/>
              </operator>
              <operator activated="true" class="set_role" compatibility="9.7.001" expanded="true"  name="Set Role (3)"  x="380" y="34">
                <parameter key="attribute_name" value="overall-remarks"/>
                <parameter key="target_role" value="label"/>
                <list key="set_additional_roles">
                  <parameter key="prediction(overall-remarks)" value="prediction"/>
                </list>
              </operator>
              <operator activated="true" class="performance_classification" compatibility="9.7.001" expanded="true"  name="Performance (2)"  x="514" y="34">
                <parameter key="main_criterion" value="first"/>
                <parameter key="accuracy" value="true"/>
                <parameter key="classification_error" value="false"/>
                <parameter key="kappa" value="false"/>
                <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="example set" to_op="Multi Label Modeling" to_port="input 1"/>
              <connect from_port="through 1" to_op="Multi Label Modeling" to_port="training set"/>
              <connect from_port="through 2" to_op="Apply Model (3)" to_port="unlabelled data"/>
              <connect from_op="Multi Label Modeling" from_port="model" to_op="Apply Model (3)" to_port="model"/>
              <connect from_op="Apply Model (3)" from_port="labelled data" to_op="Set Role (3)" to_port="example set input"/>
              <connect from_op="Set Role (3)" from_port="example set output" to_op="Performance (2)" to_port="labelled data"/>
              <connect from_op="Performance (2)" from_port="performance" to_port="performance"/>
              <portSpacing port="source_example set" spacing="0"/>
              <portSpacing port="source_through 1" spacing="0"/>
              <portSpacing port="source_through 2" spacing="0"/>
              <portSpacing port="source_through 3" spacing="0"/>
              <portSpacing port="sink_performance" spacing="0"/>
            </process>
          </operator>
          <connect from_op="Read Excel" from_port="output" to_op="Subprocess" to_port="in 1"/>
          <connect from_op="Subprocess" from_port="out 1" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Optimize Selection (Evolutionary)" to_port="example set in"/>
          <connect from_op="Set Role" from_port="original" to_op="Split Data" to_port="example set"/>
          <connect from_op="Split Data" from_port="partition 1" to_op="Optimize Selection (Evolutionary)" to_port="through 1"/>
          <connect from_op="Split Data" from_port="partition 2" to_op="Optimize Selection (Evolutionary)" to_port="through 2"/>
          <connect from_op="Optimize Selection (Evolutionary)" from_port="example set out" 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>

【问题讨论】:

【参考方案1】:

从您的流程(无法访问数据)我猜问题是您尝试训练逻辑回归的数据集只有一个标签类(例如只有 TRUE 和没有 FALSE)。如果您的示例集包含很少的示例并且偶然只有一个类最终进入训练折叠,这也可能发生。

关于您显示的过程,我也想知道,当您只有一个名为“overall-remarks”的标签列时,为什么要使用多标签建模。在这种情况下,正常的分类策略应该可以正常工作。

有关流程设计的更多信息和详细讨论以及有关 RapidMiner 的一般问题,我还建议您在 RapidMiner 社区中重新发布您的问题:https://community.rapidminer.com

【讨论】:

以上是关于RapidMiner 数据挖掘逻辑回归一标签的主要内容,如果未能解决你的问题,请参考以下文章

rapidminer都有哪些算子带graph中的ISOM?

由于“未知标签类型'连续'”,逻辑回归不起作用?

在逻辑回归中预测具有最高可能概率的某个标签

RapidMiner - 将多项式属性更改为数字/整数

将 kNN 模型应用于 RapidMiner 中的整个数据集

Logistic Regression 逻辑回归