public static List<Element<int[]>> diagnose(GAM gam, Instances instances) {
		List<Element<int[]>> list = new ArrayList<>();
		Map<int[], List<Regressor>> map = new HashMap<>();
		List<int[]> terms = gam.getTerms();
		List<Regressor> regressors = gam.getRegressors();
		for (int i = 0; i < terms.size(); i++) {
			int[] term = terms.get(i);
			if (!map.containsKey(term)) {
				map.put(term, new ArrayList<Regressor>());
			}
			Regressor regressor = regressors.get(i);
			map.get(term).add(regressor);
		}

		double[] predictions = new double[instances.size()];
		for (int[] term : map.keySet()) {
			List<Regressor> regressorList = map.get(term);
			for (int i = 0; i < instances.size(); i++) {
				predictions[i] = 0;
				Instance instance = instances.get(i);
				for (Regressor regressor : regressorList) {
					predictions[i] += regressor.regress(instance);
				}
			}
			double weight = StatUtils.variance(predictions);
			list.add(new Element<int[]>(term, weight));
		}

		return list;
	}