[SPARK-6291] [MLLIB] GLM toString & toDebugString
GLM toString prints out intercept, numFeatures. For LogisticRegression and SVM model, toString also prints out numClasses, threshold. GLM toDebugString prints out the whole weights, intercept. Author: Yanbo Liang <ybliang8@gmail.com> Closes #5038 from yanboliang/spark-6291 and squashes the following commits: 2f578b0 [Yanbo Liang] code format 78b33f2 [Yanbo Liang] fix typos 1e8a023 [Yanbo Liang] GLM toString & toDebugString
This commit is contained in:
parent
3c4e486b9c
commit
dda4dedca0
|
@ -163,6 +163,10 @@ class LogisticRegressionModel (
|
|||
}
|
||||
|
||||
override protected def formatVersion: String = "1.0"
|
||||
|
||||
override def toString: String = {
|
||||
s"${super.toString}, numClasses = ${numClasses}, threshold = ${threshold.get}"
|
||||
}
|
||||
}
|
||||
|
||||
object LogisticRegressionModel extends Loader[LogisticRegressionModel] {
|
||||
|
|
|
@ -86,6 +86,10 @@ class SVMModel (
|
|||
}
|
||||
|
||||
override protected def formatVersion: String = "1.0"
|
||||
|
||||
override def toString: String = {
|
||||
s"${super.toString}, numClasses = 2, threshold = ${threshold.get}"
|
||||
}
|
||||
}
|
||||
|
||||
object SVMModel extends Loader[SVMModel] {
|
||||
|
|
|
@ -76,7 +76,12 @@ abstract class GeneralizedLinearModel(val weights: Vector, val intercept: Double
|
|||
predictPoint(testData, weights, intercept)
|
||||
}
|
||||
|
||||
override def toString() = "(weights=%s, intercept=%s)".format(weights, intercept)
|
||||
/**
|
||||
* Print a summary of the model.
|
||||
*/
|
||||
override def toString: String = {
|
||||
s"${this.getClass.getName}: intercept = ${intercept}, numFeatures = ${weights.size}"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue