Skip to content

Commit 22dcc14

Browse files
committed
minor refine
1 parent 01b809d commit 22dcc14

File tree

1 file changed

+2
-5
lines changed
  • mllib/src/main/scala/org/apache/spark/ml/clustering

1 file changed

+2
-5
lines changed

mllib/src/main/scala/org/apache/spark/ml/clustering/LDA.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import org.apache.spark.sql.functions.{col, monotonicallyIncreasingId, udf}
3939
import org.apache.spark.sql.types.StructType
4040

4141

42-
4342
private[clustering] trait LDAParams extends Params with HasFeaturesCol with HasMaxIter
4443
with HasSeed with HasCheckpointInterval {
4544

@@ -464,19 +463,17 @@ sealed abstract class LDAModel private[ml] (
464463
object LDAModel extends MLReadable[LDAModel] {
465464

466465
private class LDAModelReader extends MLReader[LDAModel] {
467-
468466
override def load(path: String): LDAModel = {
469467
val metadataPath = new Path(path, "metadata").toString
470-
val metadataStr = sc.textFile(metadataPath, 1).first()
471-
val metadata = parse(metadataStr)
468+
val metadata = parse(sc.textFile(metadataPath, 1).first())
472469
implicit val format = DefaultFormats
473470
val className = (metadata \ "class").extract[String]
474471
className match {
475472
case c if className == classOf[LocalLDAModel].getName =>
476473
LocalLDAModel.load(path)
477474
case c if className == classOf[DistributedLDAModel].getName =>
478475
DistributedLDAModel.load(path)
479-
case _ => throw new SparkException(s"$className is not a LDAModel")
476+
case _ => throw new SparkException(s"$className in $path is not a LDAModel")
480477
}
481478
}
482479
}

0 commit comments

Comments
 (0)