rasclass-package(rasclass)
rasclass-package()所属R语言包:rasclass
Supervised Raster Image Classification
监督光栅图像分类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This package is built to perform supervised, per-pixel based raster image classification.
这个包是建立在执行监督,每个像素的光栅图像分类。
Details
详细信息----------Details----------
The raster image classification is carried out by calling a sequence of functions that load data, calculate the classification grid and produce an accuracy assessment of the classification.
通过调用一个函数序列加载数据的分类,计算网格,产生的分类精度评估的光栅图像进行分类。
The package contains the readRasterFolder function to load a set of external data layers from a folder containing raster images in the ESRI asciigrid format (.asc file extension). All files in the specified folder are parsed and stored in a rasclass-class object. The requirements for reading the input raster files is that they are all in the same projection, are aligned and have the same grid-size (i.e. all raster files should have the same header). Furthermore one raster file has to be specified as sample data. Alternatively, data can also converted into the rasclass format from a dataframe using the setRasclassData function.
的包中包含readRasterFolder功能,加载一组的外部数据层的一个在ESRI asciigrid的格式(asc文件扩展名)的文件夹,其中包含光栅图像。指定的文件夹中的所有文件被解析并存储在一个rasclass类对象。读取输入光栅文件的要求是,他们都在相同的投影,对齐,并具有相同的网格大小(即所有的光栅文件应该有相同的标题)。此外,一个栅格文件被指定为样本数据。或者,数据也可以从一个数据框使用setRasclassData函数的rasclass格式转换成。
For the classification, the package contains five supervised, per-pixel classification methods: Maximum Likelihood Classification, Multinomial Logistic Regression, Neural Networks, Random Forests and Support Vector Machines. There is only one classification function classifyRasclass and the algorithm can be specified with as an argument. The output of the classifications is the classified raster grid and standard accuracy assessment indicators, including user and producer accuracies, the overall accuracy, the confusion matrix and the kappa coefficient.
的分类,该软件包中包含5个监督,每个像素的分类方法:最大似然法,多元逻辑回归,神经网络,随机森林和支持向量机。有只有一个分类功能classifyRasclass的,和该算法可以作为一个参数指定的。分类的输出是分类光栅网格和标准的准确度评估指标,包括用户和生产者精度,整体精度,混淆矩阵和Kappa系数。
(作者)----------Author(s)----------
Daniel Wiesmann <a href="mailto:daniel.wiesmann@ist.utl.pt">daniel.wiesmann@ist.utl.pt</a> and David Quinn <a href="mailto:djq@mit.edu">djq@mit.edu</a>
参见----------See Also----------
rasclass-class, rasclassRaster-class,
rasclass-class,rasclassRaster-class,
readRaster, writeRaster,
readRaster,writeRaster,
readRasterFolder, setRasclassData,
readRasterFolder,setRasclassData,
buildFormula, checkRasclass,
buildFormula,checkRasclass,
rasclassMlc, classifyRasclass
rasclassMlc,classifyRasclass
实例----------Examples----------
## Not run: [#不运行:]
# If available, load data from external folder[如果有的话,加载数据从外部文件夹]
object <- readRasterFolder(path = "mypath", samplename = "mysample",
filenames = c('myvar1.asc', 'myvar2.asc'))
## End(Not run)[#(不执行)]
# For this example, create artificial data[在这个例子中,创建人工数据]
mysample <- c(rep(rep(c(1,2), each = 25), 25), rep(rep(c(3,4), each = 25), 25))
mysample <- mysample + sample(c(0, NA), 2500, replace = TRUE, prob = c(1, 50))
myvar1 <- rep(1:50, each = 50) + rnorm(2500, 0, 5)
myvar2 <- rep(rep(1:50), 50) + rnorm(2500, 0, 5)
newdata <- data.frame(mysample, myvar1, myvar2)
# Prepare a rasclass object using the dataframe and specifying raster properties[准备一个rasclass对象,使用数据框,并指定栅格属性]
object <- new('rasclass')
object <- setRasclassData(newdata, ncols = 50, nrows = 50,
xllcorner = 0, yllcorner = 0, cellsize = 1, NAvalue = -9999,
samplename = 'mysample')
# Classify using each algorithm once[使用每种算法的一次分类]
outlist <- list()
outlist[['maximumLikelihood']] <- classifyRasclass(object, method = 'maximumLikelihood')
summary(outlist[['maximumLikelihood']])
outlist[['logit']] <- classifyRasclass(object, method = 'logit')
summary(outlist[['logit']])
outlist[['neuralNetwork']] <- classifyRasclass(object, method = 'neuralNetwork')
summary(outlist[['neuralNetwork']])
outlist[['randomForest']] <- classifyRasclass(object, method = 'randomForest')
summary(outlist[['randomForest']])
outlist[['supportVector']] <- classifyRasclass(object, method = 'supportVector')
summary(outlist[['supportVector']])
# Store sample data as a rasclassRaster for display purposes[用于显示目的作为一个rasclassRaster的样本数据存储]
mysample.ras <- new('rasclassRaster')
mysample.ras@grid <- mysample
mysample.ras@nrows <- 50
mysample.ras@ncols <- 50
mysample.ras@xllcorner <- 0
mysample.ras@yllcorner <- 0
mysample.ras@cellsize <- 1
mysample.ras@NAvalue <- -9999
# Plot results of each classifier[每个分类的图结果]
opar <- par(mfrow = c(2, 3))
image(mysample.ras)
title('Sample data')
for(i in 1:length(outlist)) {
image(outlist[[i]]@predictedGrid)
title(names(outlist)[[i]])
}
par(opar)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|