public void initializeModel(Documents docSet) {
    	if (docSet == null) {
            throw new IllegalArgumentException("The documents set must be not null!");
        }

    	N = docSet.docs.size();
    	M = docSet.indexToTermMap.size();
    	
        //element in docTermMatrix represents times the word appear in this document 
        docTermMatrix = new int[N][M];
        //init docTermMatrix
        for (int docIndex = 0; docIndex < N; docIndex++) {
            Document doc = docSet.docs.get(docIndex);
            for (int word = 0; word < doc.docWords.length; word++) {
                int termIndex = docSet.docs.get(docIndex).docWords[word];
                docTermMatrix[docIndex][termIndex] += 1;
            }
        }

        docTopicPros = new double[N][topicNum];
        topicTermPros = new double[topicNum][M];
        docTermTopicPros = new double[N][M][topicNum];

        //init p(z|d),for each document the constraint is sum(p(z|d))=1.0
        for (int i = 0; i < N; i++) {
            double[] pros = randomProbilities(topicNum);
            for (int j = 0; j < topicNum; j++) {
                docTopicPros[i][j] = pros[j];
            }
        }
        //init p(w|z),for each topic the constraint is sum(p(w|z))=1.0
        for (int i = 0; i < topicNum; i++) {
            double[] pros = randomProbilities(M);
            for (int j = 0; j < M; j++) {
                topicTermPros[i][j] = pros[j];
            }
        }
    }