🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"Logistic Regression cannot handle polynominal label."

User: "arunpushkar"
New Altair Community Member
Updated by Jocelyn
i am using "read Database" operator to read training data from Mysql having 3 integer attributes and one varchar(4) attribute which will act as "lable" for classification and takes value 'yes' or 'no'. now when i use "logistic regression" for training model i get following error"Logistic Regression cannot handle polynomial label" but if i read csv data from csv file and set lable attribute to "nominal" it work's properly. but when i read data from database it gives error, first of all how to make any attribute read from database "nominal" so that it can be used by "Logical Regression". in fact i used "text to nominal" operator but it didn't work.
XML code for it as follows:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.2.008">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
    <process expanded="true" height="531" width="832">
      <operator activated="true" class="read_database" compatibility="5.2.008" expanded="true" height="60" name="Training" width="90" x="65" y="121">
        <parameter key="define_connection" value="url"/>
        <parameter key="connection" value="netcon"/>
        <parameter key="database_url" value="jdbc:mysql://localhost:3306/netdata"/>
        <parameter key="username" value="root"/>
        <parameter key="password" value="UxP0KMCZjok="/>
        <parameter key="query" value="SELECT *&#10;FROM `trainingData`"/>
        <enumeration key="parameters"/>
      </operator>
      <operator activated="true" class="set_role" compatibility="5.2.008" expanded="true" height="76" name="Set Role" width="90" x="179" y="120">
        <parameter key="name" value="attack"/>
        <parameter key="target_role" value="label"/>
        <list key="set_additional_roles"/>
      </operator>
      <operator activated="true" class="logistic_regression" compatibility="5.2.008" expanded="true" height="94" name="Logistic Regression" width="90" x="313" y="120"/>
      <operator activated="true" class="read_database" compatibility="5.2.008" expanded="true" height="60" name="Scoring" width="90" x="313" y="345">
        <parameter key="define_connection" value="url"/>
        <parameter key="database_url" value="jdbc:mysql://localhost:3306/netdata"/>
        <parameter key="username" value="root"/>
        <parameter key="password" value="UxP0KMCZjok="/>
        <parameter key="query" value="SELECT *&#10;FROM `scoringData`"/>
        <enumeration key="parameters"/>
      </operator>
      <operator activated="true" class="apply_model" compatibility="5.2.008" expanded="true" height="76" name="Apply Model" width="90" x="514" y="165">
        <list key="application_parameters"/>
      </operator>
      <connect from_op="Training" from_port="output" to_op="Set Role" to_port="example set input"/>
      <connect from_op="Set Role" from_port="example set output" to_op="Logistic Regression" to_port="training set"/>
      <connect from_op="Logistic Regression" from_port="model" to_op="Apply Model" to_port="model"/>
      <connect from_op="Scoring" from_port="output" to_op="Apply Model" to_port="unlabelled data"/>
      <connect from_op="Apply Model" from_port="model" 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>

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Skirzynski"
    New Altair Community Member
    Indeed it is strange that you get different behavior for the same data. Please check if the "Read CSV" operator really returns a nominal and not a binominal label. Unfortunately I do not have your CSV file nor your database to confirm your observation.

    To solve your problem: Convert the type of your label to binominal explicitly. For this you can use the "Nominal to Binominal" operator.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.000" expanded="true" name="Process">
        <process expanded="true" height="531" width="832">
          <operator activated="true" class="read_database" compatibility="5.3.000" expanded="true" height="60" name="Training" width="90" x="45" y="120">
            <parameter key="define_connection" value="url"/>
            <parameter key="connection" value="netcon"/>
            <parameter key="database_url" value="jdbc:mysql://localhost:3306/netdata"/>
            <parameter key="username" value="root"/>
            <parameter key="password" value="XMwkPQPpKVNYn/9aiRV/qw=="/>
            <parameter key="query" value="SELECT *&#10;FROM `trainingData`"/>
            <enumeration key="parameters"/>
          </operator>
          <operator activated="true" class="nominal_to_binominal" compatibility="5.3.000" expanded="true" height="94" name="Nominal to Binominal" width="90" x="179" y="120">
            <parameter key="attribute_filter_type" value="single"/>
            <parameter key="attribute" value="attack"/>
          </operator>
          <operator activated="true" class="set_role" compatibility="5.3.000" expanded="true" height="76" name="Set Role" width="90" x="313" y="120">
            <parameter key="name" value="attack"/>
            <parameter key="target_role" value="label"/>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="logistic_regression" compatibility="5.3.000" expanded="true" height="94" name="Logistic Regression" width="90" x="447" y="120"/>
          <operator activated="true" class="read_database" compatibility="5.3.000" expanded="true" height="60" name="Scoring" width="90" x="447" y="345">
            <parameter key="define_connection" value="url"/>
            <parameter key="database_url" value="jdbc:mysql://localhost:3306/netdata"/>
            <parameter key="username" value="root"/>
            <parameter key="password" value="XMwkPQPpKVNYn/9aiRV/qw=="/>
            <parameter key="query" value="SELECT *&#10;FROM `scoringData`"/>
            <enumeration key="parameters"/>
          </operator>
          <operator activated="true" class="apply_model" compatibility="5.3.000" expanded="true" height="76" name="Apply Model" width="90" x="648" y="165">
            <list key="application_parameters"/>
          </operator>
          <connect from_op="Training" from_port="output" to_op="Nominal to Binominal" to_port="example set input"/>
          <connect from_op="Nominal to Binominal" from_port="example set output" to_op="Set Role" to_port="example set input"/>
          <connect from_op="Set Role" from_port="example set output" to_op="Logistic Regression" to_port="training set"/>
          <connect from_op="Logistic Regression" from_port="model" to_op="Apply Model" to_port="model"/>
          <connect from_op="Scoring" from_port="output" to_op="Apply Model" to_port="unlabelled data"/>
          <connect from_op="Apply Model" from_port="model" 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>