Skip to content
Snippets Groups Projects
Commit 3a43ae7c authored by sueann's avatar sueann Committed by Joseph K. Bradley
Browse files

[SPARK-18613][ML] make spark.mllib LDA dependencies in spark.ml LDA private

## What changes were proposed in this pull request?
spark.ml.*LDAModel classes were exposing spark.mllib LDA models via protected methods. Made them package (clustering) private.

## How was this patch tested?
```
build/sbt doc  # "millib.clustering" no longer appears in the docs for *LDA* classes
build/sbt compile  # compiles
build/sbt
> mllib/testOnly   # tests pass
```

Author: sueann <sueann@databricks.com>

Closes #16860 from sueann/SPARK-18613.
parent de8a03e6
No related branches found
No related tags found
No related merge requests found
...@@ -418,11 +418,11 @@ abstract class LDAModel private[ml] ( ...@@ -418,11 +418,11 @@ abstract class LDAModel private[ml] (
* If this model was produced by EM, then this local representation may be built lazily. * If this model was produced by EM, then this local representation may be built lazily.
*/ */
@Since("1.6.0") @Since("1.6.0")
protected def oldLocalModel: OldLocalLDAModel private[clustering] def oldLocalModel: OldLocalLDAModel
/** Returns underlying spark.mllib model, which may be local or distributed */ /** Returns underlying spark.mllib model, which may be local or distributed */
@Since("1.6.0") @Since("1.6.0")
protected def getModel: OldLDAModel private[clustering] def getModel: OldLDAModel
private[ml] def getEffectiveDocConcentration: Array[Double] = getModel.docConcentration.toArray private[ml] def getEffectiveDocConcentration: Array[Double] = getModel.docConcentration.toArray
...@@ -563,7 +563,7 @@ abstract class LDAModel private[ml] ( ...@@ -563,7 +563,7 @@ abstract class LDAModel private[ml] (
class LocalLDAModel private[ml] ( class LocalLDAModel private[ml] (
uid: String, uid: String,
vocabSize: Int, vocabSize: Int,
@Since("1.6.0") override protected val oldLocalModel: OldLocalLDAModel, @Since("1.6.0") override private[clustering] val oldLocalModel: OldLocalLDAModel,
sparkSession: SparkSession) sparkSession: SparkSession)
extends LDAModel(uid, vocabSize, sparkSession) { extends LDAModel(uid, vocabSize, sparkSession) {
...@@ -573,7 +573,7 @@ class LocalLDAModel private[ml] ( ...@@ -573,7 +573,7 @@ class LocalLDAModel private[ml] (
copyValues(copied, extra).setParent(parent).asInstanceOf[LocalLDAModel] copyValues(copied, extra).setParent(parent).asInstanceOf[LocalLDAModel]
} }
override protected def getModel: OldLDAModel = oldLocalModel override private[clustering] def getModel: OldLDAModel = oldLocalModel
@Since("1.6.0") @Since("1.6.0")
override def isDistributed: Boolean = false override def isDistributed: Boolean = false
...@@ -656,14 +656,14 @@ class DistributedLDAModel private[ml] ( ...@@ -656,14 +656,14 @@ class DistributedLDAModel private[ml] (
private var oldLocalModelOption: Option[OldLocalLDAModel]) private var oldLocalModelOption: Option[OldLocalLDAModel])
extends LDAModel(uid, vocabSize, sparkSession) { extends LDAModel(uid, vocabSize, sparkSession) {
override protected def oldLocalModel: OldLocalLDAModel = { override private[clustering] def oldLocalModel: OldLocalLDAModel = {
if (oldLocalModelOption.isEmpty) { if (oldLocalModelOption.isEmpty) {
oldLocalModelOption = Some(oldDistributedModel.toLocal) oldLocalModelOption = Some(oldDistributedModel.toLocal)
} }
oldLocalModelOption.get oldLocalModelOption.get
} }
override protected def getModel: OldLDAModel = oldDistributedModel override private[clustering] def getModel: OldLDAModel = oldDistributedModel
/** /**
* Convert this distributed model to a local representation. This discards info about the * Convert this distributed model to a local representation. This discards info about the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment