File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
main/scala/org/apache/spark/mllib/classification
test/scala/org/apache/spark/mllib/classification Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,9 @@ class NaiveBayes private (private var lambda: Double) extends Serializable with
166
166
this
167
167
}
168
168
169
+ /** Get the smoothing parameter. Default: 1.0. */
170
+ def getLambda : Double = lambda
171
+
169
172
/**
170
173
* Run the algorithm with the configured parameters on an input RDD of LabeledPoint entries.
171
174
*
Original file line number Diff line number Diff line change @@ -85,6 +85,14 @@ class NaiveBayesSuite extends FunSuite with MLlibTestSparkContext {
85
85
assert(numOfPredictions < input.length / 5 )
86
86
}
87
87
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
+
88
96
test(" Naive Bayes" ) {
89
97
val nPoints = 10000
90
98
You can’t perform that action at this time.
0 commit comments