v.kcv(1grass)

πŸ’– v.kcv β€” the GRASS User's Manual glow-up πŸ’–

okay so bestie, welcome to v.kcv, a lil GRASS module that lives in the GRASS User's Manual and does exactly one iconic thing: it randomly partitions points into test/train sets. that's it. that's the whole vibe. πŸŽ€


✨ NAME ✨

v.kcv β€” randomly partition points into test/train sets πŸ¦‹

πŸ”‘ KEYWORDS πŸ”‘

vector, statistics, points, point pattern, sampling

πŸ“œ 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, ur welcome πŸ’…
  • --verbose β€” verbose module output, she's chatty
  • --quiet β€” quiet module output, she's mysterious ✨
  • --ui β€” force launching the GUI dialog, glossy buttons and everything

🧚 Parameters

  • map=name [required] β€” name of the vector map. or, plot twist, the data source for direct OGR access.
  • layer=string β€” layer number or name. vector features can have category values in different layers, and this number determines which layer to use. when used with direct OGR access, this is the layer name. default: 1
  • npartitions=integer [required] β€” number of partitions. must be > 1, no cap on ambition.
  • column=name β€” name for the new column the partition number gets written into. default: part 🌸

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea. v.kcv randomly divides a points list into k sets of test/train data β€” that's for npartitions-fold cross validation, if you're fancy like that. πŸ“Š

test partitions are mutually exclusive. meaning: a point will appear in only one test partition and in k-1 training partitions. no double dipping, we don't do that here. 🚫

the way it works: the module generates a random point using the selected random number generator, and then finds the closest point to it. that site gets removed from the candidate list (so it will not be selected for any other test set) and gets saved into the first test partition file. then it does that again. and again. and again, until enough points have been selected for the test partition. πŸ”

the number of points chosen for test partitions depends on the number of sites available and the number of partitions chosen β€” and that number is made as consistent as possible while making sure that all sites will be chosen for testing. 😀 and then that whole filling-up-a-test-partition process is done k times. periodt.


⚠️ 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. that's it, that's the function.

🚨 be warned bestie: random number generation occurs over the intervals defined by the current region of the map. the region is lowkey the main character here.
😭 also, this program may not work properly with Lat-long data. just. heads up.

🌈 EXAMPLES 🌈

all examples are based on the North Carolina sample dataset. iconic dataset, no notes.

g.copy vect=geonames_wake,my_geonames_wake
v.kcv map=my_geonames_wake column=part npartitions=10
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


πŸ‘‘ AUTHORS πŸ‘‘

James Darrell McCauley, back when he was at: Agricultural Engineering Purdue University πŸŽ“

  • 27 Jan 1994: fixed RAND_MAX for Solaris 2.3 (a real one)
  • 13 Sep 2000: released under GPL 🫢
  • Updated to 5.7 by 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)

latest change: Friday May 09 14:33:40 2025 in commit b356c7e108fcbeca77474c8e83ebec8f1e7b3e4a πŸŽ€

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


and that's the whole page, bestie πŸ’œ this was GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, last touched Friday May 09 14:33:40 2025 in commit b356c7e108fcbeca77474c8e83ebec8f1e7b3e4a. slay, go partition some points, ily 🫢✨

πŸ“¦ where this page comes from