You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Naveen <na...@formcept.com> on 2015/07/21 11:59:31 UTC

LinearRegressionWithSGD Outputs NaN

Hi ,

I am trying to use LinearRegressionWithSGD on Million Song Data Set and 
my model returns NaN's as weights and 0.0 as the intercept. What might 
be the issue for the error ? I am using Spark 1.40 in standalone mode.

Below is my model:

val numIterations = 100
  val stepSize = 1.0
  val regParam = 0.01
  val regType = "L2"
  val algorithm = new LinearRegressionWithSGD()
algorithm.optimizer.setNumIterations(numIterations).setStepSize(stepSize).setRegParam(regParam)
  val model = algorithm.run(parsedTrainData)

Regards,
Naveen

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Re: LinearRegressionWithSGD Outputs NaN

Posted by Burak Yavuz <br...@gmail.com>.
Hi,
Could you please decrease your step size to 0.1, and also try 0.01? You
could also try running L-BFGS, which doesn't have step size tuning, to get
better results.

Best,
Burak

On Tue, Jul 21, 2015 at 2:59 AM, Naveen <na...@formcept.com> wrote:

> Hi ,
>
> I am trying to use LinearRegressionWithSGD on Million Song Data Set and my
> model returns NaN's as weights and 0.0 as the intercept. What might be the
> issue for the error ? I am using Spark 1.40 in standalone mode.
>
> Below is my model:
>
> val numIterations = 100
>  val stepSize = 1.0
>  val regParam = 0.01
>  val regType = "L2"
>  val algorithm = new LinearRegressionWithSGD()
>
> algorithm.optimizer.setNumIterations(numIterations).setStepSize(stepSize).setRegParam(regParam)
>  val model = algorithm.run(parsedTrainData)
>
> Regards,
> Naveen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
> For additional commands, e-mail: user-help@spark.apache.org
>
>