emma.lucy33
emma.lucy33

Reputation: 1

Accuracy tending towards a number and staying there in MLP (Python Tensorflow)

I've got a pandas dataframe with the following structure:

    temp    dewp    humid   wind_dir    wind_speed  precip  visib   delayed
0   39.02   28.04   64.43   260.0       12.65858    0.0     10.0    True
1   39.92   24.98   54.81   250.0       14.96014    0.0     10.0    False
2   39.02   26.96   61.63   260.0       14.96014    0.0     10.0    True
3   39.02   26.96   61.63   260.0       14.96014    0.0     10.0    False
4   39.92   24.98   54.81   260.0       16.11092    0.0     10.0    False
..................................

I'm trying to build a MLP (with tensorflow) to predict whether a flight will be delayed or not. I do the following to get the dataframe as an input to my MLP

target= flight_info['delayed']

flight_info.pop('delayed')
tf.convert_to_tensor(flight_info)

I then do the following:

normalizer = tf.keras.layers.Normalization(axis=-1)
normalizer.adapt(flight_info)

def get_basic_model():
  model = tf.keras.Sequential([
    normalizer,
    tf.keras.layers.Dense(10, activation='relu'),
    tf.keras.layers.Dense(10, activation='relu'),
    tf.keras.layers.Dense(10, activation='relu'),
    #tf.keras.layers.Dense(15, activation='relu'),
    tf.keras.layers.Dense(1)
  ])

  model.compile(optimizer='adam',
                loss=tf.keras.losses.MeanSquaredError(),
                metrics=['accuracy'])
  return model

model = get_basic_model()
model.fit(flight_info, target, epochs=60, batch_size=1000)

The accuracy goes up by 0.1 and then stays at that point with loss: 0.1605 and accuracy: 0.7906 even after changing the batch size and epochs numerous times.

What am I doing wrong here, could anyone help me out?

Upvotes: 0

Views: 26

Answers (0)

Related Questions