- I'm working on the spam dataset to classify the inputs into binary classes.
- my problem is that: the observations in the dataset are floats small numbers in the first 53 column, and the 54 is float larger numbers, while the last two columns are integers.
How to Normalize this dataset correctly, so all the observations have the same importance?
import pandas as pd spam = pd.read_table("spambase.data",sep=',',header=None)
- one proposed approach which didn't seem very convenient to me, because it normalize the whole row input is that:
#======================== # Normalization Function #======================== def Normalize(x): ''' ================================== Normalization Function ================================== ----------- Parameters: ----------- @Parameter x: Vector --------- Returns: --------- Normalized Vector. ================================ ''' norm=0.0 for e in x: norm+=e**2 for i in range(len(x)): x[i]/=sqrt(norm) return x