Multiple Label dataset classification

User: "nickshel81"
New Altair Community Member
Updated by Jocelyn

Hi Everyone,

I am working on this text mining use case where my dataset has simply 4 columns, An ID, a Comments field (text), a Failure (Yes/No) and a Failure Type (Polynomial). The failure type is there only when a failure exists otherwise it is empty.

I know how to use the text mining process to classify a failure yes or no  but how can I then classify the type of failure based on the text once the record is classified as a failure? Do I have to do this in two seperate processes or can I do both labels classification in the same process?

Please let me know if you have any questions.

Thanks 

Sort by:
1 - 1 of 11
    User: "nickshel81"
    New Altair Community Member
    OP
    Accepted Answer

    Hi @Telcontar120

     

    Thanks for the recommendation. I was actually able to solve this in a different way. One challenge I faced was actually testing the model once i figured out training the two labels. I hope this is helpful for others. I'm actually surprised there isn't a more straight forward way to deal with multi label datasets in rapidminer. maybe a future feature :)

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.3.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.3.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="7.3.000" expanded="true" height="68" name="Retrieve Failures" width="90" x="45" y="34">
    <parameter key="repository_entry" value="../../data/Failure/Failures"/>
    </operator>
    <operator activated="true" class="text:process_document_from_data" compatibility="7.3.000" expanded="true" height="82" name="Process Documents from Data" width="90" x="313" y="34">
    <parameter key="prune_below_percent" value="1.0"/>
    <parameter key="prune_above_percent" value="99.0"/>
    <parameter key="prune_below_absolute" value="10"/>
    <parameter key="prune_above_absolute" value="1000"/>
    <parameter key="prune_above_rank" value="0.99"/>
    <list key="specify_weights"/>
    <process expanded="true">
    <operator activated="true" class="text:tokenize" compatibility="7.3.000" expanded="true" height="68" name="Tokenize" width="90" x="246" y="34"/>
    <operator activated="true" class="text:transform_cases" compatibility="7.3.000" expanded="true" height="68" name="Transform Cases" width="90" x="380" y="34">
    <parameter key="transform_to" value="upper case"/>
    </operator>
    <operator activated="true" class="text:filter_stopwords_english" compatibility="7.3.000" expanded="true" height="68" name="Filter Stopwords (English)" width="90" x="514" y="34"/>
    <operator activated="true" class="text:filter_by_length" compatibility="7.3.000" expanded="true" height="68" name="Filter Tokens (by Length)" width="90" x="648" y="34">
    <parameter key="min_chars" value="3"/>
    </operator>
    <operator activated="false" class="text:stem_porter" compatibility="7.3.000" expanded="true" height="68" name="Stem (Porter)" width="90" x="782" y="85"/>
    <operator activated="true" class="text:generate_n_grams_terms" compatibility="7.3.000" expanded="true" height="68" name="Generate n-Grams (2)" width="90" x="916" y="34"/>
    <connect from_port="document" to_op="Tokenize" to_port="document"/>
    <connect from_op="Tokenize" from_port="document" to_op="Transform Cases" to_port="document"/>
    <connect from_op="Transform Cases" from_port="document" to_op="Filter Stopwords (English)" to_port="document"/>
    <connect from_op="Filter Stopwords (English)" from_port="document" to_op="Filter Tokens (by Length)" to_port="document"/>
    <connect from_op="Filter Tokens (by Length)" from_port="document" to_op="Generate n-Grams (2)" to_port="document"/>
    <connect from_op="Generate n-Grams (2)" from_port="document" to_port="document 1"/>
    <portSpacing port="source_document" spacing="0"/>
    <portSpacing port="sink_document 1" spacing="0"/>
    <portSpacing port="sink_document 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="set_role" compatibility="7.3.000" expanded="true" height="82" name="Set Role" width="90" x="514" y="34">
    <parameter key="attribute_name" value="FAILURE"/>
    <parameter key="target_role" value="label1"/>
    <list key="set_additional_roles">
    <parameter key="FAILURE_TYPE" value="label2"/>
    </list>
    </operator>
    <operator activated="true" class="loop_labels" compatibility="7.3.000" expanded="true" height="103" name="Loop Labels" width="90" x="715" y="34">
    <process expanded="true">
    <operator activated="true" class="concurrency:cross_validation" compatibility="7.3.000" expanded="true" height="145" name="Cross Validation" width="90" x="514" y="34">
    <process expanded="true">
    <operator activated="true" class="neural_net" compatibility="7.3.000" expanded="true" height="82" name="Neural Net" width="90" x="246" y="34">
    <list key="hidden_layers"/>
    </operator>
    <connect from_port="training set" to_op="Neural Net" to_port="training set"/>
    <connect from_op="Neural Net" 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="7.1.001" expanded="true" height="82" name="Apply Model" width="90" x="112" y="34">
    <list key="application_parameters"/>
    </operator>
    <operator activated="true" class="performance_classification" compatibility="7.3.000" expanded="true" height="82" name="Performance" width="90" x="246" y="34">
    <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="store" compatibility="7.3.000" expanded="true" height="68" name="Store (2)" width="90" x="648" y="34">
    <parameter key="repository_entry" value="Model%{execution_count}"/>
    </operator>
    <connect from_port="example set" to_op="Cross Validation" to_port="example set"/>
    <connect from_op="Cross Validation" from_port="model" to_op="Store (2)" to_port="input"/>
    <connect from_op="Cross Validation" from_port="performance 1" to_port="out 2"/>
    <connect from_op="Store (2)" from_port="through" to_port="out 1"/>
    <portSpacing port="source_example set" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <portSpacing port="sink_out 2" spacing="0"/>
    <portSpacing port="sink_out 3" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="read_excel" compatibility="7.3.000" expanded="true" height="68" name="Read Excel" width="90" x="45" y="187">
    <parameter key="excel_file" value="C:\Users\Hussein\Desktop\Failures.xlsx"/>
    <parameter key="imported_cell_range" value="A1:D14"/>
    <list key="annotations">
    <parameter key="0" value="Name"/>
    </list>
    <list key="data_set_meta_data_information">
    <parameter key="0" value="ID.true.integer.attribute"/>
    <parameter key="1" value="COMMENTS.true.text.attribute"/>
    <parameter key="2" value="FAILURE.true.attribute_value.attribute"/>
    <parameter key="3" value="FAILURE_TYPE.true.attribute_value.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="generate_attributes" compatibility="7.3.000" expanded="true" height="82" name="Duplicate Comments" width="90" x="179" y="187">
    <list key="function_descriptions">
    <parameter key="NOTES" value="COMMENTS"/>
    </list>
    </operator>
    <operator activated="true" class="text:process_document_from_data" compatibility="7.3.000" expanded="true" height="82" name="Process Documents from Data (2)" width="90" x="313" y="187">
    <parameter key="prune_below_percent" value="1.0"/>
    <parameter key="prune_above_percent" value="99.0"/>
    <parameter key="prune_below_absolute" value="10"/>
    <parameter key="prune_above_absolute" value="1000"/>
    <parameter key="prune_above_rank" value="0.99"/>
    <list key="specify_weights"/>
    <process expanded="true">
    <operator activated="true" class="text:tokenize" compatibility="7.3.000" expanded="true" height="68" name="Tokenize (2)" width="90" x="246" y="34"/>
    <operator activated="true" class="text:transform_cases" compatibility="7.3.000" expanded="true" height="68" name="Transform Cases (2)" width="90" x="380" y="34">
    <parameter key="transform_to" value="upper case"/>
    </operator>
    <operator activated="true" class="text:filter_stopwords_english" compatibility="7.3.000" expanded="true" height="68" name="Filter Stopwords (2)" width="90" x="514" y="34"/>
    <operator activated="true" class="text:filter_by_length" compatibility="7.3.000" expanded="true" height="68" name="Filter Tokens (2)" width="90" x="648" y="34">
    <parameter key="min_chars" value="3"/>
    </operator>
    <operator activated="false" class="text:stem_porter" compatibility="7.3.000" expanded="true" height="68" name="Stem (2)" width="90" x="782" y="85"/>
    <operator activated="true" class="text:generate_n_grams_terms" compatibility="7.3.000" expanded="true" height="68" name="Generate n-Grams (3)" width="90" x="916" y="34"/>
    <connect from_port="document" to_op="Tokenize (2)" to_port="document"/>
    <connect from_op="Tokenize (2)" from_port="document" to_op="Transform Cases (2)" to_port="document"/>
    <connect from_op="Transform Cases (2)" from_port="document" to_op="Filter Stopwords (2)" to_port="document"/>
    <connect from_op="Filter Stopwords (2)" from_port="document" to_op="Filter Tokens (2)" to_port="document"/>
    <connect from_op="Filter Tokens (2)" from_port="document" to_op="Generate n-Grams (3)" to_port="document"/>
    <connect from_op="Generate n-Grams (3)" from_port="document" to_port="document 1"/>
    <portSpacing port="source_document" spacing="0"/>
    <portSpacing port="sink_document 1" spacing="0"/>
    <portSpacing port="sink_document 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="set_role" compatibility="7.3.000" expanded="true" height="82" name="Set Role (2)" width="90" x="514" y="187">
    <parameter key="attribute_name" value="FAILURE"/>
    <parameter key="target_role" value="label1"/>
    <list key="set_additional_roles">
    <parameter key="FAILURE_TYPE" value="label2"/>
    <parameter key="ID" value="id"/>
    </list>
    </operator>
    <operator activated="true" class="loop_labels" compatibility="7.3.000" expanded="true" height="82" name="Loop Labels (2)" width="90" x="715" y="187">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="7.3.000" expanded="true" height="68" name="Retrieve" width="90" x="313" y="34">
    <parameter key="repository_entry" value="Model%{execution_count}"/>
    </operator>
    <operator activated="true" class="apply_model" compatibility="7.3.000" expanded="true" height="82" name="Apply Model (2)" width="90" x="447" y="85">
    <list key="application_parameters"/>
    </operator>
    <connect from_port="example set" to_op="Apply Model (2)" to_port="unlabelled data"/>
    <connect from_op="Retrieve" from_port="output" to_op="Apply Model (2)" to_port="model"/>
    <connect from_op="Apply Model (2)" from_port="labelled data" to_port="out 1"/>
    <portSpacing port="source_example set" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <portSpacing port="sink_out 2" spacing="0"/>
    </process>
    </operator>
    <connect from_op="Retrieve Failures" from_port="output" to_op="Process Documents from Data" to_port="example set"/>
    <connect from_op="Process Documents from Data" from_port="example set" to_op="Set Role" to_port="example set input"/>
    <connect from_op="Process Documents from Data" from_port="word list" to_op="Process Documents from Data (2)" to_port="word list"/>
    <connect from_op="Set Role" from_port="example set output" to_op="Loop Labels" to_port="example set"/>
    <connect from_op="Loop Labels" from_port="out 1" to_port="result 1"/>
    <connect from_op="Loop Labels" from_port="out 2" to_port="result 2"/>
    <connect from_op="Read Excel" from_port="output" to_op="Duplicate Comments" to_port="example set input"/>
    <connect from_op="Duplicate Comments" from_port="example set output" to_op="Process Documents from Data (2)" to_port="example set"/>
    <connect from_op="Process Documents from Data (2)" from_port="example set" to_op="Set Role (2)" to_port="example set input"/>
    <connect from_op="Set Role (2)" from_port="example set output" to_op="Loop Labels (2)" to_port="example set"/>
    <connect from_op="Loop Labels (2)" from_port="out 1" to_port="result 3"/>
    <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"/>
    <portSpacing port="sink_result 4" spacing="0"/>
    </process>
    </operator>
    </process>