v.kcv(1)

πŸ’– v.kcv β€” the GRASS GIS User's Manual, but make it bestie πŸ’–

okay so bestie, welcome to the GRASS GIS User's Manual entry for v.kcv(1) and honestly? she's a baddie. she takes your points and splits them into test/train sets, randomly, no drama. let's get into it πŸ¦‹


✨ NAME ✨

v.kcv β€” randomly partition points into test/train sets. that's it. that's the whole job. and she ate πŸ’…


πŸŽ€ KEYWORDS πŸŽ€

vector, statistics, points, point pattern, sampling

iykyk 🌸


🌈 SYNOPSIS 🌈

v.kcv
v.kcv --help
v.kcv map=name  [layer=string]  npartitions=integer  [column=name]
[--help]  [--verbose]  [--quiet]  [--ui]

🚩 Flags 🚩

  • --help β€” prints the usage summary. your girl when you're lost fr.
  • --verbose β€” verbose module output. she's chatty and we love that.
  • --quiet β€” quiet module output. she's giving mysterious main character energy.
  • --ui β€” force launches the GUI dialog. clicky clicky mode πŸ‘‘

🧚 Parameters 🧚

  • map=name [required] β€” the name of the vector map. or, plot twist, it can be a data source for direct OGR access.
  • layer=string β€” layer number or layer name. here's the tea: vector features can have category values living in different layers, and this number decides which layer you're using. when you're doing direct OGR access, this is the layer name instead. default: 1
  • npartitions=integer [required] β€” how many partitions you want. must be > 1, no exceptions bestie.
  • column=name β€” the name for the new column that the partition number gets written into. default: part

πŸ’– DESCRIPTION πŸ’–

so what does v.kcv actually do? she randomly divides a points list into k sets of test/train data β€” this is for npartitions-fold cross validation, periodt.

the test partitions are mutually exclusive. meaning: a point shows up in exactly one test partition and in k-1 training partitions. no double dipping, we don't do that here πŸ™ˆ

here's the process, step by step, and it's honestly kind of iconic:

  1. the module generates a random point using the selected random number generator.
  2. then it finds the closest point to that random point.
  3. that site gets removed from the candidate list β€” which means it will not be selected for any other test set β€” and it gets saved in the first test partition file.
  4. this repeats until enough points have been selected for the test partition.

and how many points get chosen for test partitions? that depends on how many sites are available and how many partitions you chose. the module makes that number as consistent as possible while still making sure all sites will be chosen for testing. then this whole filling-up-a-test-partition thing happens k times. slay πŸ”₯


🫢 NOTES 🫢

  • an ideal random sites generator would follow a Poisson distribution, and it'll only ever be as random as the original sites. this module just divides vector points up in a random manner. simple as that.
  • > ⚠️ be warned bestie: random number generation occurs over the intervals defined by the current region of the map. so check your region, fr fr.
  • > 😭 this program may not work properly with Lat-long data. just a heads up, don't come for me.

🌸 EXAMPLES 🌸

all of these examples are based on the North Carolina sample dataset. okay let's go:

g.copy vect=geonames_wake,my_geonames_wake
v.kcv map=my_geonames_wake column=part npartitions=10

and the geodetic one:

g.copy vect=geodetic_pts,my_geodetic_pts
v.kcv map=my_geodetic_pts column=part npartitions=10

look at her go πŸŽ€


πŸ‘€ SEE ALSO πŸ‘€

v.random, g.region

go read those too, they're her besties πŸ’œ


πŸ‘‘ AUTHORS πŸ‘‘

  • James Darrell McCauley,
  • when he was at: Agricultural Engineering Purdue University

then the glow-up timeline:

  • 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)

πŸ”₯ SOURCE CODE πŸ”₯

Available at: v.kcv source code (history)

Accessed: Saturday Jan 17 05:41:22 2026

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual


and that's the whole page bestie!! 🌟 this was GRASS 8.4.2, page v.kcv(1), accessed Saturday Jan 17 05:41:22 2026 β€” thanks for reading, ily, go partition some points πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from