I would like to run a naive implementation of grid search with MLlib but I am a bit confused about choosing the 'best' range of parameters. Apparently, I do not want to waste too much resources for a combination of parameters that will probably not give a better mode. Any suggestions from your experience?

val intercept   : List[Boolean]  = List(false)
val classes     : List[Int]      = List(2)
val validate    : List[Boolean]  = List(true)
val tolerance : List[Double] = List(0.0000001 , 0.000001 , 0.00001 , 0.0001 , 0.001 , 0.01 , 0.1 , 1.0) val gradient : List[Gradient] = List(new LogisticGradient() , new LeastSquaresGradient() , new HingeGradient())
val corrections : List[Int]      = List(5 , 10 , 15)
val iters       : List[Int]      = List(1 , 10 , 100 , 1000 , 10000)
val regparam : List[Double] = List(0.0 , 0.0001 , 0.001 , 0.01 , 0.1 , 1.0 , 10.0 , 100.0) val updater : List[Updater] = List(new SimpleUpdater() , new L1Updater() , new SquaredL2Updater())

val combinations = for (a <- intercept;
                        b <- classes;
                        c <- validate;
                        d <- tolerance;
                        e <- gradient;
                        f <- corrections;
                        g <- iters;
                        h <- regparam;
                        i <- updater) yield (a,b,c,d,e,f,g,h,i)

for( ( interceptS , classesS , validateS , toleranceS , gradientS , correctionsS , itersS , regParamS , updaterS ) <- combinations.take(3) ) {

val lr : LogisticRegressionWithLBFGS = new LogisticRegressionWithLBFGS().
            setIntercept(addIntercept=interceptS).
            setNumClasses(numClasses=classesS).
            setValidateData(validateData=validateS)

      lr.
            optimizer.
            setConvergenceTol(tolerance=toleranceS).
            setGradient(gradient=gradientS).
            setNumCorrections(corrections=correctionsS).
            setNumIterations(iters=itersS).
            setRegParam(regParam=regParamS).
            setUpdater(updater=updaterS)

}


---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscr...@spark.apache.org

Reply via email to