public void scale()
	{
		double[] maxValues = new double[featureCount];
		double[] minValues = new double[featureCount];
		for(int i = 0; i < featureCount; i++)
		{
			maxValues[i] = Double.NEGATIVE_INFINITY;
			minValues[i] = Double.POSITIVE_INFINITY;
		}
		
		for(Instance inst : data)
		{
			for(int fid : inst.getFeatureIds())
			{
				double v = inst.getFeature(fid);
				if(v > maxValues[fid])
					maxValues[fid] = v;
				if(v < minValues[fid])
					minValues[fid] = v;
			}
		}
		
		for(Instance inst : data)
		{
			for(int fid : inst.getFeatureIds())
			{
				double v = inst.getFeature(fid);
				double span = maxValues[fid] - minValues[fid];
				if(span <= 0) continue;
				v = (v - minValues[fid])/span;
				inst.setFeature(fid, v);
			}
		}
	}