File tree Expand file tree Collapse file tree
main/scala/org/apache/spark/mllib/classification
test/scala/org/apache/spark/mllib/classification Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,6 +166,9 @@ class NaiveBayes private (private var lambda: Double) extends Serializable with
166166 this
167167 }
168168
169+ /** Get the smoothing parameter. Default: 1.0. */
170+ def getLambda : Double = lambda
171+
169172 /**
170173 * Run the algorithm with the configured parameters on an input RDD of LabeledPoint entries.
171174 *
Original file line number Diff line number Diff line change @@ -85,6 +85,14 @@ class NaiveBayesSuite extends FunSuite with MLlibTestSparkContext {
8585 assert(numOfPredictions < input.length / 5 )
8686 }
8787
88+ test(" get, set params" ) {
89+ val nb = new NaiveBayes ()
90+ nb.setLambda(2.0 )
91+ assert(nb.getLambda == 2.0 )
92+ nb.setLambda(3.0 )
93+ assert(nb.getLambda == 3.0 )
94+ }
95+
8896 test(" Naive Bayes" ) {
8997 val nPoints = 10000
9098
You can’t perform that action at this time.
0 commit comments