<jupyter_start><jupyter_text>Feature Preprocessing To Rescale our data to make usefull to neural networkCategorical FeaturesIts help when we want more catagorical lebel or output as their lebel.<jupyter_code>df = pd.read_csv('/content/drive/My Drive/Google Colab/Neural Network/Keras/My_Code_Keras/weight-height.csv')
df.head()
pd.get_dummies(df['Gender'], prefix='Gender').head() # on column Gender # df['Gender]
df['Gender'].unique() #  how many types of data has column 1<jupyter_output><empty_output><jupyter_text>Feature transformation ** Neural Network works good on 0 to 1 or close to 1 value ** 1) Rescale with fixed factor<jupyter_code>df[['Height (feet)']] = df[['Height']] / 12.0
df[['Weight (100 lbs)']] = df[['Weight']] / 100.0
df.head()
df.describe().round(2) # information about the data set<jupyter_output><empty_output><jupyter_text>2) MinMax normalizationIf we want to exactly between 0 to 1 value<jupyter_code>from sklearn.preprocessing import MinMaxScaler
mms = MinMaxScaler();
df['Weight_mms'] = mms.fit_transform(df[['Weight']])
df['Height_mms'] = mms.fit_transform(df[['Height']])
df.describe().round(2)<jupyter_output><empty_output><jupyter_text>3) Standard normalizationMin of that data will be 0 Standard deviation of that data is 1<jupyter_code>from sklearn.preprocessing import StandardScaler
ss = StandardScaler()

df['Weight_ss'] = ss.fit_transform(df[['Weight']])
df['Height_ss'] = ss.fit_transform(df[['Height']])
df.describe().round(2)
plt.figure(figsize=(15, 5))

for i, feature in enumerate(['Height', 'Height (feet)', 'Height_mms', 'Height_ss']):
  plt.subplot(1, 4, i+1)
  df[feature].plot(kind='hist', title=feature)
  plt.xlabel(feature)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1488862837045721, 'fraction_numerical': 0.017584994138335287, 'mean_word_length': 7.326829268292683, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '326306', 'license': 'MIT', 'n_tokens_mistral': 621, 'n_tokens_neox': 579, 'n_words': 142, 'path': 'Code/6-Feature Preprocessing _ Transformation.ipynb', 'repo_name': 'shahinvx/Keras_Basic', 'size': '1706'}