I wanted to perform residual analysis on my test set data but got the error "MemoryError: Unable to allocate 812. GiB for an array with shape (330040, 330040) and data type float64".
col_formula = ' + '.join(X_train.columns)
formule = 'Purchase ~ ' + col_formulae
result = smf.ols(formula= formule, data=df).fit()
result.summary2()
train_pred = result.predict(X_train)
resid = y_test - train_pred
After running the last line of code, I got a memory error "MemoryError: Unable to allocate 812. GiB for an array with shape (330040, 330040) and data type float64".
How do I fit this error?