Normalization
# Start from scratch
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf ## Borrow a few classes from sci-kit learn
from sklearn.compose import make_column_transformer
from sklearn.preprocessing import MinMaxScaler, OneHotEncoder
from sklearn.model_selection import train_test_split #Create column transformer
ct = make_column_transformer((MinMaxScaler(), ['age', 'bmi', 'children']), # turn all values in these columns between 0 and 1 (OneHotEncoder(handle_unknown='ignore', dtype="int32"), ['sex', 'smoker', 'region'])) # Create X and y
X = insurance.drop('charges', axis=1)
y = insurance['charges'] # Split datasets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) # Fit the column transformer on training data and apply to both datasets (train and test)
ct.fit(X_train) # Transform data
X_train_normalize = ct.transform(X_train)
X_test_normalize = ct.transform(X_test)