You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by Gang Bai <ba...@staff.sina.com.cn> on 2014/06/18 04:13:42 UTC

Int tolerance in LBFGS.setConvergenceTol causes problems

Hi folks,

I am implementing a regression model for count data which uses LBFGS for parameter estimation. Following the patterns in mllib.regression, I created an object PoissonRegressionModelWithLBFGS, which creates a new instance of class PoissonRegressionModelWithLBFGS and invokes the run method to get the weights/parameters. 

The implementations are straightforward. But I encountered a problem while using class LBFGS. The parameter of setConvergenceTol is of type Int rather than Double. This leads to the inability to specify a tolerance less than 1.0 and a type mismatch error when passing a Double value. In fact, the class LBFGS internally uses convergenceTol as a Double var. So we can safely change the parameter of setConvergenceTol from type Int to type Double. 

I’ve created a pull request for this. Please take a review here: https://github.com/apache/spark/pull/1104/files

Best regards,
Gang

Re: Int tolerance in LBFGS.setConvergenceTol causes problems

Posted by DB Tsai <db...@stanford.edu>.
Hi Gang,

This is a bug, and I'm the one who did it :) Just add the comment to your PR.

Thanks.

Sincerely,

DB Tsai
-------------------------------------------------------
My Blog: https://www.dbtsai.com
LinkedIn: https://www.linkedin.com/in/dbtsai


On Tue, Jun 17, 2014 at 7:13 PM, Gang Bai <ba...@staff.sina.com.cn> wrote:
> Hi folks,
>
> I am implementing a regression model for count data which uses LBFGS for parameter estimation. Following the patterns in mllib.regression, I created an object PoissonRegressionModelWithLBFGS, which creates a new instance of class PoissonRegressionModelWithLBFGS and invokes the run method to get the weights/parameters.
>
> The implementations are straightforward. But I encountered a problem while using class LBFGS. The parameter of setConvergenceTol is of type Int rather than Double. This leads to the inability to specify a tolerance less than 1.0 and a type mismatch error when passing a Double value. In fact, the class LBFGS internally uses convergenceTol as a Double var. So we can safely change the parameter of setConvergenceTol from type Int to type Double.
>
> I’ve created a pull request for this. Please take a review here: https://github.com/apache/spark/pull/1104/files
>
> Best regards,
> Gang