private double calcLoglikelihood(double[] Pz, double[][] Pd_z, double[][] Pw_z)
    {
    	double L = 0.0;
        for (int m = 0; m < this.M; m++)
        {
        	Data d = this.dataset.getDataAt(m);
            for (int position = 0; position < d.size(); position++)
            {
            	Feature f = d.getFeatureAt(position);
                int w = f.dim;
                double n = f.weight;

                double sum = 0.0;
                for (int z = 0; z < this.K; z++)
                {
                	sum += Pz[z] * Pd_z[z][m] * Pw_z[z][w];
                }
                L += n * Math.log10(sum);
            }
        }
        return L;
    }