protected static void computeWeight(Element<IntPair> pair, CHistogram[] cHist, Histogram2D hist2d, double ySq) {
		final int f1 = pair.element.v1;
		final int f2 = pair.element.v2;
		final int size1 = cHist[f1].size();
		final int size2 = cHist[f2].size();
		Table table = new Table(size1, size2);
		computeTable(hist2d, cHist[f1], cHist[f2], table);
		double bestRSS = Double.POSITIVE_INFINITY;
		double[] predInt = new double[4];
		for (int v1 = 0; v1 < size1 - 1; v1++) {
			for (int v2 = 0; v2 < size2 - 1; v2++) {
				getPredictor(table, v1, v2, predInt);
				double rss = getRSS(table, v1, v2, ySq, predInt);
				if (rss < bestRSS) {
					bestRSS = rss;
				}
			}
		}
		pair.weight = bestRSS;
	}