0

I have a problem where I need to calculate MSE and MAE. I want to create a loop where:

  • (Test 1) Input 1-15, predict next 15 mins.
  • (Test 2) Input 2-16, predict next 15 mins.
  • (Test 3) Input 3-17, predict next 15 mins.
  • ... and so on, until the end of my inputs.

For each of Test 1, 2, 3 etc, find the MSE and MAE.

Then, I want to calculate the average MSE and MAE.

These are the examples of my predicted and original data frames that I want to use.

combined_original_df

Predicted Dataframe

combined_predicted_df

Original Dataframe

I've tried splitting the dfs into chunks using

def split_pred_dataframe(combined_pred_df, chunk_size = 15): 
    chunks = list()
    num_chunks = len(combined_pred_df) // chunk_size + (1 if len(combined_pred_df) % chunk_size else 0)
    for i in range(num_chunks):
        chunks.append(combined_pred_df[i*chunk_size:(i+1)*chunk_size])
    return chunks
def split_original_dataframe(combined_original_df, chunk_size = 15): 
    chunks = list()
    num_chunks = len(combined_original_df) // chunk_size + (1 if len(combined_original_df) % chunk_size else 0)
    for i in range(num_chunks):
        chunks.append(combined_original_df[i*chunk_size:(i+1)*chunk_size])
    return chunks 

However, I'm not really sure how to apply this into a loop for MSE and MAE calculations. Any help and guidance would be really appreciated.

0 Answers0