Skip to content

Speeding up gwr.predict #22

@nikosGeography

Description

@nikosGeography

I have one dependent and two independent variables and I want to predict at new locations using the gwr.predict. I was wondering if there is a way to speed up the function because it is very slow. For example, when using gwr.basic, I can utilize the parameters parallel.method and parallel.arg. Is there a way to use them in the gwr.predict function as well?

Here is the code I am using:

library (GWmodel)
library(raster)
library(sp)

wd = "path/"
provoliko = "EPSG:7767"

tirs = raster(paste0(wd, "tirs.tif"))
pop = raster(paste0(wd, "pop.tif"))
s = stack(pop, tirs)
names(s) = c("pop", "tirs")
regpoints <- rasterToPoints(s, spatial = TRUE)

block.data = read.csv(paste0(wd, "block.data.csv"))

coordinates(block.data) <- c("x", "y")
proj4string(block.data) <- provoliko

dist = GWmodel::gwr.dist(dp.locat = coordinates(block.data), rp.locat = coordinates(regpoints), focus = 0, p = 2, theta = 0, longlat = F)

eq1 <- ntl ~ pop + tirs

abw = bw.gwr(eq1, 
             data = block.data, 
             approach = "CV", 
             kernel = "gaussian",
             adaptive = TRUE, 
             p = 2, 
             longlat = FALSE, 
             parallel.method = "omp",
             parallel.arg = "omp")

p = gwr.predict(eq1, 
                          data = block.data, 
                          predictdata = regpoints, 
                          bw = abw, 
                          kernel = "gaussian", 
                          adaptive = TRUE, 
                          p = 2,
                          theta = 0, 
                          longlat = FALSE, 
                          dMat1 = dist)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions