<jupyter_start><jupyter_text>Goals :3) Get MAPE plots. 1) Make the model complex. 4) Create a grid search for params and pick best model. 5) Repeat this for median sale price without supply.<jupyter_code>H = 3
hidden_sizes = [15,30, 40]
layers = [2]
learning_rates = [0.01, 0.02]
dropouts = [0.0]
n_epochs = 350
batch_size = 20000

best_model = None
best_loss = float("inf")
best_losses_per_horizon = None

for h in hidden_sizes:
    for l in layers: 
        for lr in learning_rates:
            for do in dropouts:
                print("-------------------------------------")
                print(f"HIDDEN SIZE {h} : NUM LAYERS : {l} : LEARNING RATE : {lr} : DROP OUT : {do}")

                model = lstm_seq2seq(input_size = X_train_torch.shape[2], hidden_size = h, dropout = do,
                                     output_size = 1, num_layers=l).cuda()
                loss, losses_per_horizon = model.train_model(X_train_torch, 
                                         Y_train_torch, 
                                         n_epochs = n_epochs, 
                                         target_len = (H+1), 
                                         batch_size = batch_size,
                                         learning_rate = lr)
                
                if loss[n_epochs - 1] < best_loss:
                    print("New best model found")
                    best_model = model
                    best_loss = loss[n_epochs - 1]
                    best_losses_per_horizon = losses_per_horizon
                    
                plot_loss_values(loss, losses_per_horizon)


                # plot predictions on train/test data
                plot_train_test_results(model, 
                                         X_train, 
                                         y_train, 
                                         X_test, 
                                         y_test)
                
                
                print("-------------------------------------")
torch.save(best_model.state_dict(), './sale_model.pth')
H = 3
h = 30
l = 2
lr = 0.01
do = 0.05
n_epochs = 150
batch_size = 20000

# best_model = lstm_seq2seq(input_size = X_train_torch.shape[2], hidden_size = h, dropout = do,
#                      output_size = 1, num_layers=l).cuda()
loss, losses_per_horizon = best_model.train_model(X_train_torch, 
                         Y_train_torch, 
                         n_epochs = n_epochs, 
                         target_len = (H+1), 
                         batch_size = batch_size,
                         learning_rate = lr)
plot_loss_values(loss, losses_per_horizon)

torch.save(best_model.state_dict(), './sale_model_new_gru_log.pth')
torch.cuda.empty_cache()
plot_train_test_results(best_model, X_train, y_train, X_test, y_test, num_rows = 4)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1046880507578428, 'fraction_numerical': 0.020091646105040536, 'mean_word_length': 1.309194467046379, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 19, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '310243', 'license': 'MIT', 'n_tokens_mistral': 868, 'n_tokens_neox': 802, 'n_words': 180, 'path': 'LSTM_EncoderDecoder-Sale.ipynb', 'repo_name': 'sparsha1644/HomePriceBeastNew', 'size': '2837'}