Faster method to compute scales and avoid array_agg
To avoid array_agg, created UDF to help normalize data.
More scalable, and much faster

Now compatible with all olded versions of GPDB.

Due to the Python bug on GPDB 4.2.3, prediction function does not work
on it. Will replace the Python prediction function with C++ code, which
is also faster.