Created
May 11, 2018 21:46
-
-
Save benoitdescamps/33efab6783b37db3e1ccff212cec51e3 to your computer and use it in GitHub Desktop.
code snippet for Hyperparameters (part II): Random Search on Spark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import breeze.stats.distributions.{Gamma,Uniform,Poisson} | |
import com.microsoft.ml.spark.LightGBMClassifier | |
import tuning.RandomGridBuilder | |
object example_lgbm{ | |
def main(args: Array[String]): Unit = { | |
val lgbm = new LightGBMClassifier() | |
val randomGrid = new RandomGridBuilder(5) | |
.addDistr(lgbm.learningRate,Gamma(1.0,0.1)) | |
.addDistr(lgbm.baggingFraction,Uniform(0.7,0.99)) | |
.addDistr(lgbm.featureFraction,Uniform(0.7,0.99)) | |
.addDistr(lgbm.maxDepth,Poisson(10)) | |
.addDistr(lgbm.numIterations,Poisson(200)) | |
.build() | |
println(randomGrid.toList) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment