Github user jkbradley commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4047#discussion_r23501379
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala 
---
    @@ -0,0 +1,472 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.mllib.clustering
    +
    +import java.util.Random
    +
    +import breeze.linalg.{DenseVector => BDV, sum => brzSum, normalize, axpy 
=> brzAxpy}
    +
    +import org.apache.spark.Logging
    +import org.apache.spark.annotation.DeveloperApi
    +import org.apache.spark.graphx._
    +import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.rdd.RDD
    +import org.apache.spark.util.Utils
    +
    +
    +/**
    + * :: DeveloperApi ::
    + *
    + * Latent Dirichlet Allocation (LDA), a topic model designed for text 
documents.
    + *
    + * Terminology:
    + *  - "word" = "term": an element of the vocabulary
    + *  - "token": instance of a term appearing in a document
    + *  - "topic": multinomial distribution over words representing some 
concept
    + *
    + * Currently, the underlying implementation uses Expectation-Maximization 
(EM), implemented
    + * according to the Asuncion et al. (2009) paper referenced below.
    + *
    + * References:
    + *  - Original LDA paper (journal version):
    + *    Blei, Ng, and Jordan.  "Latent Dirichlet Allocation."  JMLR, 2003.
    + *     - This class implements their "smoothed" LDA model.
    + *  - Paper which clearly explains several algorithms, including EM:
    + *    Asuncion, Welling, Smyth, and Teh.
    + *    "On Smoothing and Inference for Topic Models."  UAI, 2009.
    + *
    + * NOTE: This is currently marked DeveloperApi since it is under active 
development and may undergo
    + *       API changes.
    + */
    +@DeveloperApi
    +class LDA private (
    +    private var k: Int,
    +    private var maxIterations: Int,
    --- End diff --
    
    I like having "smoothing" in the names since that's easier to understand 
for people who have not read LDA papers.  I agree the difference between 
smoothing "topics" and "terms" is hard to understand.  (If it were not for the 
precedent set by the Stanford NLP toolbox, I would actually vote to relabel 
"termSmoothing" --> "topicSmoothing" and "topicSmoothing" --> "docSmoothing" 
since we are smoothing distributions, not smoothing elements of distributions.)
    
    One other issue with alpha/beta is that papers are not consistent about 
parameter names.  ("beta" is more often called "eta" in what I've read.)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to