title: Improving the performance of an autoencoder network
body: <p>For a couple of days, I am working to improve the performance of my autoencoder network, from changing the network architecture to manually tuning some parameters and lately using <a href="https://optuna.readthedocs.io/en/stable/" rel="nofollow noreferrer">optuna</a> to optimize hpyerparameters. All to no significant improvement in network performance.</p>
  <p>May I know if there're a couple of suggestions you can make to improve this model?</p>
  <p>Code:</p>
  <pre><code>def objective(trial):
      &quot;&quot;&quot;Object function to optimize parameters&quot;&quot;&quot;
      #clear session
      keras.backend.clear_session()
  
      encoding_dim = 32
      input_shape  = x_train_sub.shape[1:]  #(1, 200, 4) input shape
      autoencoder  = Sequential()
      activ='relu'
  
      autoencoder.add(Flatten(input_shape=input_shape))
      autoencoder.add(Dense(800, activation=activ))
      autoencoder.add(Dropout(trial.suggest_uniform('dropout_1', 0.0, 0.5)))
      autoencoder.add(Dense(600, activation=activ))
      autoencoder.add(Dropout(trial.suggest_uniform('dropout_2', 0.0, 0.5)))
      autoencoder.add(Dense(400, activation=activ))
      autoencoder.add(Dropout(trial.suggest_uniform('dropout_3', 0.0, 0.5)))
      autoencoder.add(Dense(200, activation=activ))
      autoencoder.add(Dense(100, activation=activ)) 
      autoencoder.add(Dense(80,  activation=activ)) 
      autoencoder.add(Dense(encoding_dim, activation=activ))   
  
      #decoder
      autoencoder.add(Dense(80, activation=activ))  
      autoencoder.add(Dense(100, activation=activ)) 
      autoencoder.add(Dense(200, activation=activ))
      autoencoder.add(Dense(400, activation=activ))        
      autoencoder.add(Dense(600, activation=activ))
      autoencoder.add(Dense(800, activation=activ))
      autoencoder.add(Dense(np.prod(input_shape), activation=activ)) 
      autoencoder.add(Reshape(input_shape))
  
      optimizer = Adam(lr=trial.suggest_loguniform(&quot;learning_rate&quot;, 1e-5, 1e-1)) 
      autoencoder.compile(optimizer=optimizer, loss='mae', metrics=['mean_squared_error'])
      hist = autoencoder.fit(x_train_sub, x_train_sub, epochs=200, verbose = 0,
          batch_size = trial.suggest_categorical('batch_size', [64, 128]), shuffle=True)
      min_mse = np.min(hist.history['mean_squared_error'])#min mean_squared_error
  
      return min_mse
  </code></pre>
  <p>Create an optuna study:</p>
  <pre><code>study = optuna.create_study(study_name='ae_study', direction='minimize')
  study.optimize(objective, n_trials=150)
  </code></pre>
  <p>Then train fit the model with `study parameters like so:</p>
  <pre><code>output = study.best_params
  dropout_list = [] #loop to form dropouts list from study best parameters
  
  def createModel():
          encoding_dim = 32
          input_shape  = x_train.shape[1:]  #(1, 100, 4) 
          autoencoder  = Sequential()
          activ='relu'
  
          # encoder
          autoencoder.add(Flatten(input_shape=input_shape))
          autoencoder.add(Dense(800, activation=activ))
          autoencoder.add(Dropout(dropout_list[0]))
          autoencoder.add(Dense(600, activation=activ))
          autoencoder.add(Dropout(dropout_list[1]))
          autoencoder.add(Dense(400, activation=activ))
          autoencoder.add(Dropout(dropout_list[2]))
          autoencoder.add(Dense(200, activation=activ)) 
          autoencoder.add(Dense(100, activation=activ)) 
          autoencoder.add(Dense(80,  activation=activ)) 
          autoencoder.add(Dense(encoding_dim, activation=activ))   
          
          #decoder
          autoencoder.add(Dense(80, activation=activ))  
          autoencoder.add(Dense(100, activation=activ)) 
          autoencoder.add(Dense(200, activation=activ))
          autoencoder.add(Dense(400, activation=activ))
          autoencoder.add(Dense(600, activation=activ))
          autoencoder.add(Dense(800, activation=activ))
          autoencoder.add(Dense(np.prod(input_shape), activation=activ)) 
          autoencoder.add(Reshape(input_shape))
  
          optimizer = Adam(lr=output['learning_rate']) 
          autoencoder.compile(optimizer=optimizer, loss='mae', 
                              metrics=['mean_squared_error'])
          autoencoder.fit(x_train, x_train, epochs=250, batch_size=output['batch_size'], 
              shuffle=True) 
  
          return autoencoder
  </code></pre>
  <p>Unfortunately, no significant improvement to my model performance despite all these efforts. What do you suggest I should do further?</p>