@SuppressWarnings("unchecked")
	public static double mean(Function w, HashSet<Integer> id, boolean inclusion, 
			double threshold, boolean above) {
		double result = 0.0;
		int counter = 0;
		for (Feature f : (LinearFunction<Feature,FeatureVector>) w) {
			if (((inclusion && id.contains(f.identifier())) || (!inclusion && !id.contains(f.identifier()))) &&
					((above && (f.strength() > threshold)) || (!above && (f.strength() < threshold)))) {
				result += f.strength();
				counter++;
			}
		}
		return result / counter;
	}