![](/img/trans.png)
[英]Binary Logistic Regression - do we need to one_hot encode label?
[英]RapidMiner Data Mining Logistic Regression One label
目前正在從事教育數據挖掘項目。 我的一些數據集遇到了一個非常常見的問題,我無法在任何地方搜索這個問題。 每當我運行我的過程時,它總是說
“只有一個標簽”,學習方案邏輯回歸沒有足夠的能力來處理只有一個 label 的示例集。如果只知道一個 class 的示例,則存在現有的特殊建模運算符。 它們支持“一個 class 標簽”功能。
我得到了一些帶有一個 label 的數據集,它工作得很好。 我還嘗試編輯標簽,因為我使用了 Multi label。 我無法理解這個問題。 請幫助大家.. 下面是我的 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" height="68" name="Read Excel" width="90" 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" height="82" name="Subprocess" width="90" x="179" y="34">
<process expanded="true">
<operator activated="true" class="replace_missing_values" compatibility="9.7.001" expanded="true" height="103" name="Replace Missing Values" width="90" 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" height="82" name="Generate ID" width="90" 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" height="82" name="Select Attributes" width="90" 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" height="82" name="Remove Useless Attributes" width="90" 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" height="82" name="Set Role" width="90" 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" height="103" name="Split Data" width="90" 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" height="145" name="Optimize Selection (Evolutionary)" width="90" 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" height="103" name="Multi Label Modeling" width="90" 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" height="82" name="Set Role (2)" width="90" 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" height="145" name="Cross Validation" width="90" 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" height="82" name="Polynominal by Binominal Classification" width="90" 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" height="124" name="Logistic Regression" width="90" 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" 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="9.7.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="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" height="82" name="Apply Model (2)" width="90" 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" height="82" name="Apply Model (3)" width="90" 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" height="82" name="Set Role (3)" width="90" 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" height="82" name="Performance (2)" width="90" 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>
從您的過程中(無法訪問數據)我猜問題是您嘗試訓練邏輯回歸的數據集只有一個 label class (例如只有 TRUE 和沒有 FALSE)。 如果您有一個包含很少示例的示例集,並且碰巧只有一個 class 最終進入訓練折疊,這也可能發生。
關於您顯示的過程,我還想知道,當您只有一個名為“overall-remarks”的 label 列時,為什么要使用Multi Label 建模。 在這種情況下,正常的分類策略應該可以正常工作。
有關 RapidMiner 的流程設計和一般問題的更多信息和詳細討論,我還建議您在 RapidMiner 社區中重新發布您的問題: https://community.rapidminer.com
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.