"Running Logistic Regression (Weka) for the Yes Class"

earmijoearmijo Member Posts: 270 Unicorn
edited June 2019 in Help
When I run a logistic regression (weka) sometime I get the "wrong" equation. Instead of running the regression for the positive class ("yes"), RM or Weka run it for the negative class. Is there a way of forcing RM or Weka to use the "yes" class. See example below.

I know that it doesn't make any difference for predictions. I know that the fix is very easy ("to get the coefficients for the "yes" class, just reverse the sign") but... this had been driving me crazy since I started using RM (a few years ago).

Thanks in advance for any help.

image
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.5.002">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="6.5.002" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="read_url" compatibility="6.5.002" expanded="true" height="60" name="Read URL" width="90" x="112" y="120">
        <parameter key="url" value="https://s3.amazonaws.com/mirlitus/subscription.csv"/>
        <parameter key="read_attribute_names" value="true"/>
      </operator>
      <operator activated="true" class="set_role" compatibility="6.5.002" expanded="true" height="76" name="Set Role" width="90" x="313" y="120">
        <parameter key="attribute_name" value="id"/>
        <parameter key="target_role" value="id"/>
        <list key="set_additional_roles">
          <parameter key="subscribe" value="label"/>
        </list>
      </operator>
      <operator activated="true" class="weka:W-Logistic" compatibility="5.3.001" expanded="true" height="76" name="W-Logistic" width="90" x="514" y="120"/>
      <connect from_op="Read URL" from_port="output" to_op="Set Role" to_port="example set input"/>
      <connect from_op="Set Role" from_port="example set output" to_op="W-Logistic" to_port="training set"/>
      <connect from_op="W-Logistic" 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>
Tagged:

Answers

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist
    Have you tried the Remap Binominal operator?
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • earmijoearmijo Member Posts: 270 Unicorn
    Thank you Martin. I have tried "Remap Binomial" but it doesn't make any difference. Perhaps it doesn't work with Weka operators.

  • MartinLiebigMartinLiebig Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,503 RM Data Scientist
    does it work with RM Logistic regression but not with W-LogisticRegression? this would sure indicate a problem here..

    ~Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
  • lanemlanem Member, University Professor Posts: 29 Maven

    Hi 

    I have the same problem where weka logistic regression operator calculates the coefficients and odds ratios for the false value but binominal remap operator can reverse this

    My other question is why does the Logistic Regression operator implemented by RapidMiner provide the odds ratios - I know you can calculate these by computing the exponential of the coefficients - but that is a manual fix would be good if the operator could provide this an output

    Regards Michael

Sign In or Register to comment.