I have different columns containing int values like age, gender etc. I want these column values to be replaced with 0-1 range values by applying min-max normalization so that i can load it to rapid minor and apply k-means.
plz tell me the sql query of this?
The query to calculate this is as follows
SELECT
1.00*(Age-MinAge)/AgeRange,
1.00*(Gender-MinGender)/GenderRange,
FROM
(
SELECT
Age,
MIN(Age) OVER () AS MinAge,
MAX(Age) OVER () - MIN(Age) OVER () AS AgeRange,
Gender,
MIN(Gender) OVER () AS MinGender,
MAX(Gender) OVER () - MIN(Gender) OVER () AS GenderRange,
FROM
MyTable
) X
You can use this to populate a new table or new columns etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With