public static void computeWeights(Instances instances, List<Element<IntPair>> pairs) {
		List<Attribute> attributes = instances.getAttributes();
		boolean[] used = new boolean[attributes.size()];
		for (Element<IntPair> pair : pairs) {
			int f1 = pair.element.v1;
			int f2 = pair.element.v2;
			used[f1] = used[f2] = true;
		}
		CHistogram[] cHist = new CHistogram[attributes.size()];
		for (int i = 0; i < cHist.length; i++) {
			if (used[i]) {
				switch (attributes.get(i).getType()) {
					case BINNED:
						BinnedAttribute binnedAtt = (BinnedAttribute) attributes.get(i);
						cHist[i] = new CHistogram(binnedAtt.getNumBins());
						break;
					case NOMINAL:
						NominalAttribute nominalAtt = (NominalAttribute) attributes.get(i);
						cHist[i] = new CHistogram(nominalAtt.getCardinality());
					default:
						break;
				}
			}
		}
		double ySq = computeCHistograms(instances, used, cHist);
		for (Element<IntPair> pair : pairs) {
			final int f1 = pair.element.v1;
			final int f2 = pair.element.v2;
			final int size1 = cHist[f1].size();
			final int size2 = cHist[f2].size();
			Histogram2D hist2d = new Histogram2D(size1, size2);
			computeHistogram2D(instances, f1, f2, hist2d);
			computeWeight(pair, cHist, hist2d, ySq);
		}
	}