I have a Tensorflow regression model that i have with been working with. I have the model tuned well and getting good results while training. However, when i goto evalute the results are horrible. I did some research and found that i am not normalizing my test features and labels as well so i suspect that is where the problem is. My thought is to normalize the whole dataset before splitting the dataset into train and test sets but i am getting an attribute error that has me stumped.
here is the code sample. Please help :)
#concatenate the surface data and single_downhole_col into a single dataframe
  training_Data =[]
  training_Data = pd.concat([surface_Data, single_downhole_col], axis=1)
  #print('training data shape:',training_Data.shape)
  #print(training_Data.head())
  #normalize the data using keras
  model_normalizer_layer = tf.keras.layers.Normalization(axis=-1)
  model_normalizer_layer.adapt(training_Data)
  normalized_training_Data = model_normalizer_layer(training_Data)
  #convert the data frame to array
  dataset = normalized_training_Data.copy()
  dataset.tail()
  #create a training and test set
  train_dataset = dataset.sample(frac=0.8, random_state=0)
  test_dataset = dataset.drop(train_dataset.index)
  #check the data
  train_dataset.describe().transpose()
  #split features from labels
  train_features = train_dataset.copy()
  test_features = test_dataset.copy()
and if there is any interest in knowing how the normalizer layer is used in the model then please see below
 def build_and_compile_model(data):
    model = keras.Sequential([
        model_normalizer_layer,
        layers.Dense(260, input_dim=401,activation='relu'),
        layers.Dense(80, activation='relu'),
        #layers.Dense(40, activation='relu'),
        layers.Dense(1)
    ])

 
    