R 使用nnet软件包进行光栅图像分类
我对R中“nnet”包的光栅分类有问题。我无法使用预测的单元格类别创建光栅。这是我的代码:R 使用nnet软件包进行光栅图像分类,r,neural-network,classification,raster,R,Neural Network,Classification,Raster,我对R中“nnet”包的光栅分类有问题。我无法使用预测的单元格类别创建光栅。这是我的代码: library(sp) library(nnet) library(caret) library(rgdal) library(raster) images_list=list.files(path="maps", full.names=TRUE, ignore.case = TRUE) rasters_stack <- stack(images_list) table = read.
library(sp)
library(nnet)
library(caret)
library(rgdal)
library(raster)
images_list=list.files(path="maps", full.names=TRUE, ignore.case = TRUE)
rasters_stack <- stack(images_list)
table = read.csv("points.csv", sep = ",")
indeks <- createDataPartition(table$class, p=2/3, list=FALSE)
training <- table[indeks, ]
test <- table[-indeks, ]
model = nnet(factor(class) ~ blue + green + red, data = training, size=2)
predict(rasters_stack, model, type="class", filename="output.img",
progress="text", overwrite=TRUE)
我想试一试。你能提供输入数据还是假数据输入?如作者通过电子邮件指出的数据。
Error in v * x@data@gain : non-numeric argument to binary operator
In addition: Warning messages:
1: In rgdal::putRasterData(x@file@transient, v, band = 1, offset = off) :
NAs introduced by coercion
2: In rgdal::putRasterData(x@file@transient, v, band = 1, offset = off) :
NAs introduced by coercion
3: In rgdal::putRasterData(x@file@transient, v, band = 1, offset = off) :
NAs introduced by coercion
4: In rgdal::putRasterData(x@file@transient, v, band = 1, offset = off) :
NAs introduced by coercion
5: In .gd_SetStatistics(object, ...) : NAs introduced by coercion