I recently benchmarked multi-linear regression on a large dataset using two methods in PV-WAVE -- direct manipulation of the matrix using the pseudo-inverse vs. the MULTIREGRESS function. Surprisingly, the pseudo-inverse was much faster. Is this because the pseudo-inverse leverages OpenMP but MULTIREGRESS does not? I am using 64-bit PV-WAVE 10.0a on Windows 7 and my PC has 4 cores with 8 threads.
Code:
FUNCTION matrix_invert, matr
LUFAC, matr, CONDITION=A_c, INVERSE=m_inv
END
; Load result and train matrices
info, result, train
regr = result # TRANSPOSE(train) # MATRIX_INVERT(train # TRANSPOSE(train))
; Transpose the train matrix
info, result, train
regr = MULTIREGRESS(train, result)
Here are the results:
Code:
Pseudo-Inverse:
RESULT FLOAT = Array(84210624)
TRAIN FLOAT = Array(7, 84210624)
Elapsed time = 12.277 sec
MULTIREGRESS:
RESULT FLOAT = Array(84210624)
TRAIN FLOAT = Array(84210624, 7)
Elapsed time = 39.063 sec