Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is aim to reduce memory footprint of the base GWR model from method in FastGWR. Two approaches are 1) not to store N by N weight matrix 2) not to store N by N hat matrix.
For weight matrix, at every location, a row vector of weights is calculated but not stored. This may add some computation but very trivial. The entire N by N W matrix can be computed on demand as a method to
GWRResults
class.For hat matrix, only tr_S and tr_STS are needed and they are calculated inside of
GWR.fit()
fitting loop additively without storingS
. A boolean parameterhat_matrix
is offered for whether to store the hat matrix. By default,hat_matrix
is set to False for GWR. However, in MGWR, hat matrix of GWR is used to compute projection matrices of MGWR, sohat_matrix
is switched to True behind the scene for calibrating MGWR.Overall speed performance is similar, but memory footprint is much lower. Based on a dataset with 10k locations, peak memory drops from 4487MB to 155MB on my laptop.