Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ abstract class LDAModel private[ml] (
if ($(topicDistributionCol).nonEmpty) {

// TODO: Make the transformer natively in ml framework to avoid extra conversion.
val transformer = oldLocalModel.getTopicDistributionMethod(sparkSession.sparkContext)
val transformer = oldLocalModel.getTopicDistributionMethod

val t = udf { (v: Vector) => transformer(OldVectors.fromML(v)).asML }
dataset.withColumn($(topicDistributionCol), t(col($(featuresCol)))).toDF()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class LocalLDAModel private[spark] (
/**
* Get a method usable as a UDF for `topicDistributions()`
*/
private[spark] def getTopicDistributionMethod(sc: SparkContext): Vector => Vector = {
private[spark] def getTopicDistributionMethod: Vector => Vector = {
val expElogbeta = exp(LDAUtils.dirichletExpectation(topicsMatrix.asBreeze.toDenseMatrix.t).t)
val docConcentrationBrz = this.docConcentration.asBreeze
val gammaShape = this.gammaShape
Expand Down