Class WeightedTopicModel

  • All Implemented Interfaces:
    java.io.Serializable

    public class WeightedTopicModel
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Field Detail

      • sourceWordPattern

        public static java.util.regex.Pattern sourceWordPattern
      • targetWordPattern

        public static java.util.regex.Pattern targetWordPattern
      • numTopics

        protected int numTopics
      • numTypes

        protected int numTypes
      • alpha

        protected double alpha
      • alphaSum

        protected double alphaSum
      • beta

        protected double beta
      • betaSum

        protected double betaSum
      • oneDocTopicCounts

        protected int[] oneDocTopicCounts
      • typeTopicCounts

        protected int[][] typeTopicCounts
      • tokensPerTopic

        protected int[] tokensPerTopic
      • typeTypeWeights

        protected com.carrotsearch.hppc.IntDoubleHashMap[] typeTypeWeights
      • logTypeTopicWeights

        protected double[][] logTypeTopicWeights
      • typeTopicWeights

        protected double[][] typeTopicWeights
      • totalTopicWeights

        protected double[] totalTopicWeights
      • showTopicsInterval

        public int showTopicsInterval
      • wordsPerTopic

        public int wordsPerTopic
      • formatter

        protected java.text.NumberFormat formatter
      • printLogLikelihood

        protected boolean printLogLikelihood
      • logCountRatioCache

        protected double[] logCountRatioCache
    • Constructor Detail

      • WeightedTopicModel

        public WeightedTopicModel​(int numberOfTopics,
                                  double alphaSum,
                                  double beta,
                                  Randoms random)
    • Method Detail

      • getAlphabet

        public Alphabet getAlphabet()
      • getNumTopics

        public int getNumTopics()
      • setTopicDisplay

        public void setTopicDisplay​(int interval,
                                    int n)
      • setRandomSeed

        public void setRandomSeed​(int seed)
      • getTypeTopicCounts

        public int[][] getTypeTopicCounts()
      • getTopicTotals

        public int[] getTopicTotals()
      • addInstances

        public void addInstances​(InstanceList training)
      • readTypeTypeWeights

        public void readTypeTypeWeights​(java.io.File weightsFile)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sample

        public void sample​(int iterations,
                           boolean shouldInitialize,
                           int docCycleCount)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • sampleTopicsForOneDoc

        protected void sampleTopicsForOneDoc​(FeatureSequence tokenSequence,
                                             FeatureSequence topicSequence,
                                             boolean initializing,
                                             boolean debugging)
      • topWords

        public java.lang.String topWords​(int numWords)
      • printState

        public void printState​(java.io.File f)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • printState

        public void printState​(java.io.PrintStream stream)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception