public double computeMarginal() {
		// TODO: Add code here
		// generate samples
		for (int i = 0; i < numSamples; i++) {
			// generateHidden
			for (int j = 0; j < _parameters.numHiddenNodes(); j++) { 
				generatedHiddens[i][j] = generateH(i,j);
			}
			// generateVisibles
			for (int j = 0; j < _parameters.numVisibleNodes(); j++) {
				generatedVisibles[i][j] = generateX(i,j);
			}
		}
		
		// count the number of samples that is exactly the same as the visibles
		double count = 0.0;
		for (int i = 0; i < numSamples; i++) {
			boolean correct = true;
			for (int j = 0; j < _parameters.numVisibleNodes(); j++) {
				if (generatedVisibles[i][j] != _parameters.visibleNode(j)) {
					correct = false; // assume it will continue to the next second for-loop.
				}
			}
			if (correct) {
				count += 1;
			}
		}
		
		
		return count / numSamples;
	}