i.svm.train(1)
πΈ i.svm.train π
okay bestie, welcome to the GRASS User's Manual page for i.svm.train(1) β the little module that trains your Support Vector Machine so it can go be a main character later. Let's get into it π«Ά
β¨ NAME β¨
<i.svm.train</italic>> β Train a SVM also known as: Train a Support Vector Machine π
π₯ KEYWORDS π₯
imagery, svm, classification, training
π¦ SYNOPSIS π¦
i.svm.train
i.svm.train --help
i.svm.train [-sp] group=name [subgroup=name] trainingmap=name
signaturefile=name [type=name] [kernel=name] [cache=cache size]
[degree=value] [gamma=value] [coef0=value] [eps=value]
[cost=value] [nu=value] [p=value] [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π© Flags (the little toggles, lowkey iconic)
-sβ Do not use the shrinking heuristics Defaults to use the shrinking heuristics-pβ Train a SVC or SVR model for probability estimates Defaults to no probabilities in model--overwriteβ Allow output files to overwrite existing files--helpβ Print usage summary--verboseβ Verbose module output--quietβ Quiet module output--uiβ Force launching GUI dialog
π Parameters (the actual info you gotta give it, periodt)
group=name[required] β Maps with feature values (attributes)subgroup=nameβ Name of input imagery subgrouptrainingmap=name[required] β Map with training labels or target valuessignaturefile=name[required] β Name for output file containing result signaturestype=nameβ Type of SVM Options:c_svc,nu_svc,one_class,epsilon_svr,nu_svrDefault:c_svcc_svc: C-SVM classificationnu_svc: nu-SVM classificationone_class: one-class SVMepsilon_svr: epsilon-SVM regressionnu_svr: nu-SVM regression
kernel=nameβ SVM kernel type Options:linear,poly,rbf,sigmoidDefault:rbflinear: uβ*vpoly: (gamma*uβ*v + coef0)^degreerbf: exp(-gamma*|u-v|^2)sigmoid: tanh(gamma*uβ*v + coef0)
cache=cache sizeβ LIBSVM kernel cache size in MB Options:1-Default:512degree=valueβ Degree in kernel function Options:0-Default:3gamma=valueβ Gamma in kernel function Default:1coef0=valueβ coef0 in kernel function Default:0eps=valueβ Tolerance of termination criterion Defaults to0.00001for nu-SVC and0.001for otherscost=valueβ Cost of constraints violation The parameter C of C-SVC, epsilon-SVR, and nu-SVR Default:1nu=valueβ The parameter nu of nu-SVC, one-class SVM, and nu-SVR Default:0.5p=valueβ The epsilon in epsilon-insensitive loss function of epsilon-SVM regression Default:0.1
π DESCRIPTION π
so basically i.svm.train finds parameters for a Support Vector Machine and stores them in a signature file for later usage by i.svm.predict. it's giving "prep era" β it does the studying so prediction can slay later β¨
Internally the module performs input value rescaling of each of imagery group rasters by mean normalisation based on minimum and maximum value present in the raster metadata. Rescaling parameters are written into the signature file for use during prediction. no cap, that's the whole vibe.
π NOTES π
i.svm.train internally is using the LIBSVM. For introduction into value prediction or estimation with LIBSVM, see a Practical Guide to Support Vector Classification by Chih-Wei Hsu, Chih-Chung Chang, and Chih-Jen Lin. iykyk π
It is strongly suggested to have semantic labels set for each raster map in the training data (feature value) imagery group. Use r.support to set semantic labels. do it. thank me later π
β PERFORMANCE β
SVM training is done by loading all training data into memory. In a case of large input raster files, use sparse label rasters (e.g. raster points or small patches instead of uninterrupted cover). your RAM said please π₯Ί
During the training process there is no progress output printed. Training with large number of data points can take significant time - just be patient. literally just sit there and vibe, bestie π
By default the shrinking heuristics option of LIBSVM is enabled. It should not impact the outcome, just the training time. On some input parameter and data combinations training with the shrinking heuristics disabled might be faster. (that's the -s flag btw π)
The cache parameter determines the maximum memory allocated for kernel caching to enhance computational speed. Itβs important to note that the actual moduleβs memory consumption may vary from this setting, as it solely impacts LIBSVMβs internal caching. The cache is utilized on an as-needed basis, so itβs unlikely to reach the specified value. don't stress about it π
π§ EXAMPLE π§
This is the first part of classification process. See i.svm.predict for the second part.
Train a SVM to identify land use classes according to the 1996 land use map landuse96_28m and then classify a LANDSAT scene from October of 2002. Example requires the nc_spm_08 dataset.
# Align computation region to the scene
g.region raster=lsat7_2002_10 -p
# store VIZ, NIR, MIR into group/subgroup
i.group group=lsat7_2002 subgroup=res_30m \
input=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70
# Now digitize training areas "training" with the digitizer
# and convert to raster model with v.to.rast
v.to.rast input=training output=training use=cat label_column=label
# If you are just playing around and do not care about the accuracy of outcome,
# just use one of existing maps instead e.g.
# r.random input=landuse96_28m npoints=10000 raster=training -s
# Train the SVM
i.svm.train group=lsat7_2002 subgroup=res_30m \
trainingmap=training signaturefile=landuse96_rnd_points
# Go to i.svm.predict for the next step.
π¦ SEE ALSO π¦
- Predict values:
i.svm.predict - Set semantic labels:
r.support - Other classification modules:
i.maxlik,i.smap - LIBSVM home page: LIBSVM - A Library for Support Vector Machines
π REFERENCES π
Please cite both - LIBSVM and i.svm. bestie's gotta give credit where it's due π«Ά
- For
i.svm.*modules: Nartiss, M., & Melniks, R. (2023). Improving pixel-based classification of GRASS GIS with support vector machine. Transactions in GIS, 00, 1β16. https://doi.org/10.1111/tgis.13102 - For LIBSVM: Chang, C.-C., & Lin, C.-J. (2011). LIBSVM : a library for support vector machines. ACM Transactions on Intelligent Systems and Technology, 2:27:1--27:27.
π AUTHOR π
Maris Nartiss, University of Latvia.
πΈ SOURCE CODE πΈ
Available at: i.svm.train source code (history)
Accessed: Saturday Oct 31 11:14:21 2026
Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole page, bestie π β¨ this bad boy is GRASS 8.5.0, last touched Saturday Oct 31 11:14:21 2026, brought to you by the Β© 2003-2026 GRASS Development Team β go train that SVM and slay π₯π
π¦ where this page comes from
- nixos 26.05: grass 8.5.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms