Note: A new GRASS GIS stable version has been released: GRASS GIS 7. Go directly to the new manual page here
NAME
v.kcv - Randomly partition points into test/train sets.
KEYWORDS
vector, statistics
SYNOPSIS
v.kcv
v.kcv help
v.kcv [-dq] input=name output=name k=integer column=string [--overwrite] [--verbose] [--quiet]
Flags:
- -d
- Use drand48()
- -q
- Quiet
- --overwrite
- Allow output files to overwrite existing files
- --verbose
- Verbose module output
- --quiet
- Quiet module output
Parameters:
- input=name
- Name of input vector map
- output=name
- Name for output vector map
- k=integer
- Number of partitions
- Options: 1-32767
- column=string
- Name for new column to which partition number is written
- Default: part
DESCRIPTION
v.kcv randomly divides a points lists into k sets of
test/train data (for k-fold cross validation).
Test partitions are mutually exclusive. That is, a point will appear in
only one test partition and k-1 training partitions.
The module generates a random point using the selected random number
generator and then finds the closest point to it. This site is removed
from the candidate list (meaning that it will not be selected for any
other test set) and saved in the first test partition file. This is
repeated until enough points have been selected for the test partition.
The number of points chosen for test partitions depends upon the number
of sites available and the number of partitions chosen (this number is
made as consistent as possible while ensuring that all sites will be
chosen for testing). This process of filling up a test partition is
done k times.
NOTES
An ideal random sites generator will follow a Poisson distribution and
will only be as random as the original sites. This module simply
divides vector points up in a random manner.
Be warned that random number generation occurs over the
intervals defined by the current region of the map.
This program may not work properly with Lat-long data.
EXAMPLES
All examples are based on the North Carolina sample dataset.
g.copy vect=geonames_wake,my_geonames_wake
v.kcv input=my_geonames_wake output=my_geonames_wake_kvc column=part k=10
g.copy vect=geodetic_pts,my_geodetic_pts
v.kcv input=my_geodetic_pts output=my_geodetic_pts_kvc column=part k=10
SEE ALSO
v.random,
g.region
AUTHOR
James Darrell McCauley,
when he was at:
Agricultural Engineering
Purdue University
27 Jan 1994: fixed RAND_MAX for Solaris 2.3
13 Sep 2000: released under GPL
Updated to 5.7 Radim Blazek 10 / 2004
OGR support by Martin Landa (2009)
Speed-up by Jan Vandrol and Jan Ruzicka (2013)
Last changed: $Date: 2014-05-01 13:00:52 -0700 (Thu, 01 May 2014) $
Main index - vector index - Full index
© 2003-2016 GRASS Development Team