I filed MAHOUT-1139, added a test case and committed a fix. Let me know if that solves your problem.
Thanks for noticing the problem! On Thu, Jan 10, 2013 at 5:58 PM, Ted Dunning <[email protected]> wrote: > In the meantime, can you file a JIRA with your sample code? > > > On Thu, Jan 10, 2013 at 5:57 PM, Ted Dunning <[email protected]>wrote: > >> Hmm... >> >> The LSMRTest code works. So it seems like there is a mismatch somewhere. >> >> In debugging that test, it seems that the loop exits via ITERATION_LIMIT >> which avoids the problematic if statement. This is likely due to the fact >> that the test is solving a Hilbert matrix which has exceedingly bad >> condition number. >> >> I will put in a random matrix test and see what happens. I suspect that >> changing line 457 to this: >> >> if (stop != StopCode.CONTINUE && stop.ordinal() != istop) { >> >> will solve your problem. >> >> This code is translated from the reference implementation for LSMR. That >> is the source of some of these strange constructs. >> >> On Thu, Jan 10, 2013 at 5:04 PM, James Frohnhofer <[email protected]>wrote: >> >>> Hi -- >>> >>> I'm fairly new to Mahout, and the LSRM solver seemed like a quick and >>> robust way to solve a linear regression problem. >>> >>> However whenever I call solve, I get an IllegalStateException, at >>> LMSR.java >>> line 457, with the error "bad code math 2 vs 2" or "bad code match 1 vs >>> 1". >>> Looking at the code, it doesn't appear to me that the StopCode could >>> ever >>> be set without throwing this exception. >>> >>> I may be missing something because it's not clear to me at all, the point >>> of setting the StopCode, manually setting the istop flag to a the ordinal >>> value of the StopCode enum and then throwing an exception if they are the >>> same. >>> >>> Also the documentation talks about the regularization parameter lanbda, >>> but >>> the setLambda method is private. >>> >>> Any help or guidance would be appreciated. >>> >>> Thanks, >>> >>> Jim >>> >> >> >
