I am looking into the possibility of using GRASS with the R Random Forest algorithm to create a land cover classification. I read the Furlanello, Neteler et al. paper (very nice) and some others but I need some help with the details. My problem is somewhat different from the Furlanello, Neteler et al. paper since my sample data are coming from a multispectral image instead of a database. I still have to get up to speed with R and the Random Forest algorithm but I have an initial GRASS question.
What I want to do is select a number of samples representing each land cover type from a multispectral image. These data would then be input into the Random Forest model to create the classification rules. For example, I'm thinking that I will need to create vector polygons for each land cover type I'm interested in. To keep it simple for this explanation I'll use forest and non-forest. I'll digitize a few polygons that represent forest and a few more that represent non-forest. Next, I will need to sample the multispectral image data by selecting 500 randomly selected pixels that fall under the forest polygons and another 500 pixels from under the non-forest polygons. How can I do this in GRASS? I suppose I can run v.random to create a vector point layer of random points within each land cover class (specify zmin and zmax as the same value?) but then how would I use the point layer to get the spectral information from an image group? I will also need to format the sample data so that R can read it.
If anyone has advice or resources they can point me to regarding the use of Random Forests or CART in GRASS please let me know
Check out r.what manual page [1], specially the part about using input
from a text file or, better yet, sending the output from v.out.ascii
to r.what.
Basicaly, what you do after having your points is export their
coordinates using v.out.ascii and pipe it to r.what. The query will be
dumped on the screen. To capture it, just save it to any text file.
Something like this:
On Wed, Feb 4, 2009 at 8:29 AM, Ned Horning <horning@amnh.org> wrote:
Greetings,
I am looking into the possibility of using GRASS with the R Random Forest
algorithm to create a land cover classification. I read the Furlanello,
Neteler et al. paper (very nice) and some others but I need some help with
the details. My problem is somewhat different from the Furlanello, Neteler
et al. paper since my sample data are coming from a multispectral image
instead of a database. I still have to get up to speed with R and the Random
Forest algorithm but I have an initial GRASS question.
What I want to do is select a number of samples representing each land cover
type from a multispectral image. These data would then be input into the
Random Forest model to create the classification rules. For example, I'm
thinking that I will need to create vector polygons for each land cover type
I'm interested in. To keep it simple for this explanation I'll use forest
and non-forest. I'll digitize a few polygons that represent forest and a few
more that represent non-forest. Next, I will need to sample the
multispectral image data by selecting 500 randomly selected pixels that fall
under the forest polygons and another 500 pixels from under the non-forest
polygons. How can I do this in GRASS? I suppose I can run v.random to create
a vector point layer of random points within each land cover class (specify
zmin and zmax as the same value?) but then how would I use the point layer
to get the spectral information from an image group? I will also need to
format the sample data so that R can read it.
If anyone has advice or resources they can point me to regarding the use of
Random Forests or CART in GRASS please let me know
Additionally, in GRASS >= 6.4 you can do a selective random sampling
with v.extract: http://grass.osgeo.org/grass64/manuals/html64_user/v.extract.html
v.extract ...
random=integer
Number of random categories matching vector objects to extract
Number must be smaller than unique cat count in layer
-> Example: Extract 3 random areas from geology map
Combining these modules you'll be able to perform the extraction.
Markus
PS: Please consider (later) to create a small FAQ in the GRASS Wiki -
solved once, solved "forever"...
Next, I will need to sample the multispectral image data by
selecting 500 randomly selected pixels that fall under the
forest polygons and another 500 pixels from under the
non-forest polygons. How can I do this in GRASS?
Hi,
for that step you might consider the v.random.cover script from the GRASS
Addons wiki page.