public Vec getTopics(Vec doc)
    {
        Vec gamma = new DenseVector(K);

        Random rand = RandomUtil.getRandom();
        double lambdaInv = (W * K) / (D * 100.0);

        for (int j = 0; j < gamma.length(); j++)
            gamma.set(j, sampleExpoDist(lambdaInv, rand.nextDouble()) + eta);

        Vec eLogTheta_i = new DenseVector(K);
        Vec expLogTheta_i = new DenseVector(K);
        expandPsiMinusPsiSum(gamma, gamma.sum(), eLogTheta_i);
        for (int j = 0; j < eLogTheta_i.length(); j++)
            expLogTheta_i.set(j, FastMath.exp(eLogTheta_i.get(j)));
        
        computePhi(doc, new int[doc.nnz()], new double[doc.nnz()], K, gamma, eLogTheta_i, expLogTheta_i);
        gamma.mutableDivide(gamma.sum());
        return gamma;
    }
public Vec getTopics ( Vec doc ) { Vec gamma = new DenseVector ( K ) ; Random rand = RandomUtil . getRandom ( ) ; double lambdaInv = ( W * K ) / ( D * 100.0 ) ; for ( int j = 0 ; j < gamma . length ( ) ; j ++ ) gamma . set ( j , sampleExpoDist ( lambdaInv , rand . nextDouble ( ) ) + eta ) ; Vec eLogTheta_i = new DenseVector ( K ) ; Vec expLogTheta_i = new DenseVector ( K ) ; expandPsiMinusPsiSum ( gamma , gamma . sum ( ) , eLogTheta_i ) ; for ( int j = 0 ; j < eLogTheta_i . length ( ) ; j ++ ) expLogTheta_i . set ( j , FastMath . exp ( eLogTheta_i . get ( j ) ) ) ; computePhi ( doc , new int [ doc . nnz ( ) ] , new double [ doc . nnz ( ) ] , K , gamma , eLogTheta_i , expLogTheta_i ) ; gamma . mutableDivide ( gamma . sum ( ) ) ; return gamma ; }
Computes the topic distribution for the given document.<br>
Note that the returned vector will be dense, but many of the values may
be very nearly zero.

@param doc the document to find the topics for
@return a vector of the topic distribution for the given document