Craig Aumann
2014-Aug-07 23:32 UTC
[R] Applying Different Predictive Models over Different Geographic subsets of a RasterStack
I'm struggling with the best way to apply different predictive models over different geographical areas of a raster stack. The context of the problem is that different predictive models are developed within different polygonal regions of the overall study area. Each model needs to be used to predict an outcome for just the geographic area for which it was developed. Every pixel has one and only one predictive model, but the model changes across different regions of the landscape. The models come from a "random forest" fit. The problem is that the rasterstack is rather large both in terms of number of pixels and also the number of layers which the predictive model needs to use. If the problem were smaller, there are a number of things I could "get away with" in terms of how I would do this, but given the problem size, I need a more cunning solution. Ideally, I would like to only call predict from the package Raster just once, and have the predict function call the right model based on the geographical location of the pixel. However, not clear that this is possible with the Raster Package, or if it is possible how to implement it efficiently. Any ideas or suggestions greatly appreciated. Cheers! Craig [[alternative HTML version deleted]]
Mitchell Maltenfort
2014-Aug-08 02:10 UTC
[R] Applying Different Predictive Models over Different Geographic subsets of a RasterStack
I don't know this particular package well, but I believe "party" contains something called "mob" which creates a regression tree terminating in different models at each node. Could that be adapted to your project? On Thursday, August 7, 2014, Craig Aumann <craigaumann@gmail.com> wrote:> I'm struggling with the best way to apply different predictive models over > different geographical areas of a raster stack. > > The context of the problem is that different predictive models are > developed within different polygonal regions of the overall study area. > Each model needs to be used to predict an outcome for just the geographic > area for which it was developed. Every pixel has one and only one > predictive model, but the model changes across different regions of the > landscape. The models come from a "random forest" fit. > > The problem is that the rasterstack is rather large both in terms of number > of pixels and also the number of layers which the predictive model needs to > use. If the problem were smaller, there are a number of things I could > "get away with" in terms of how I would do this, but given the problem > size, I need a more cunning solution. > > Ideally, I would like to only call predict from the package Raster just > once, and have the predict function call the right model based on the > geographical location of the pixel. However, not clear that this is > possible with the Raster Package, or if it is possible how to implement it > efficiently. > > Any ideas or suggestions greatly appreciated. > > Cheers! > Craig > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org <javascript:;> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- ____________________________ Ersatzistician and Chutzpahthologist I can answer any question. "I don't know" is an answer. "I don't know yet" is a better answer. "I can write better than anybody who can write faster, and I can write faster than anybody who can write better" AJ Leibling [[alternative HTML version deleted]]