i.svm.predict
Predict with a SVM
Predict with a Support Vector Machine
i.svm.predict group=name [subgroup=name] signaturefile=name output=name [cache=cache size] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
i.svm.predict group=name signaturefile=name output=name
grass.script.run_command("i.svm.predict", group, subgroup=None, signaturefile, output, cache=512, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("i.svm.predict", group="name", signaturefile="name", output="name")
Parameters
group=name [required]
Maps with feature values (attributes)
subgroup=name
Name of input imagery subgroup
signaturefile=name [required]
Name of input file containing signatures
output=name [required]
Output map with predicted class or calculated value
cache=cache size
LIBSVM kernel cache size in MB
Allowed values: 1-
Default: 512
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
group : str, required
Maps with feature values (attributes)
Used as: input, group, name
subgroup : str, optional
Name of input imagery subgroup
Used as: input, subgroup, name
signaturefile : str, required
Name of input file containing signatures
Used as: input, sigfile, name
output : str, required
Output map with predicted class or calculated value
Used as: output, raster, name
cache : int, optional
LIBSVM kernel cache size in MB
Used as: cache size
Allowed values: 1-
Default: 512
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
i.svm.predict predicts values with a Support Vector Machine (SVM) and stores them in a raster file. Predictions are based on a signature file generated with i.svm.train.
Internally the module performs input value rescaling of each of imagery group rasters by minimum and maximum range determined during training.
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.
It is strongly suggested to have semantic labels set for each raster map in the training data (feature value) and in value prediction imagery groups. Use r.support to set semantic labels.
PERFORMANCE
Value prediction is done cell by cell and thus memory consumption should be constant.
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.
EXAMPLE
This is the second part of classification process. See i.svm.train for the first part.
Predict land use classes form a LANDSAT scene from October of 2002 with a SVM trained on a 1996 land use map landuse96_28m.
i.svm.predict group=lsat7_2002 subgroup=res_30m \
signaturefile=landuse96_rnd_points output=pred_landuse_2002
SEE ALSO
Train SVM: i.svm.train
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.
- 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.predict source code
(history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f