When using big datasets, calculation of the dot product with numpy requires assigning a lot of virtual memory to the dense connectivity matrix. Most computers won't be able to allocate that much RAM.
Luckily, scipy has a sparse matrix dot operation that is both much faster and requires much less RAM.
It is a method the sparse matrix object.
Also, we don't have to check if the matrix is sparse because numpy has an inner method for dense matrices that is called in the same way.
When using big datasets, calculation of the dot product with
numpy
requires assigning a lot of virtual memory to the dense connectivity matrix. Most computers won't be able to allocate that much RAM.Luckily,
scipy
has a sparse matrix dot operation that is both much faster and requires much less RAM. It is a method the sparse matrix object.Also, we don't have to check if the matrix is sparse because
numpy
has an inner method for dense matrices that is called in the same way.