VectorRegression

根据模型文件对输入的矢量数据进行回归。

描述

此应用程序基于由 TrainVectorRegression 应用。矢量数据输出的特征将包含分类器预测的值。有两种模式:1)更新模式:在输入文件中添加包含预测值的‘cfield’字段。2)写入方式:将输入文件中已有的字段复制到输出文件中,并添加包含预测值的cfield字段。如果已声明输出文件,则应用写入模式。否则,将应用输入文件更新模式。

参数

Name of the input vector data -in vectorfile Mandatory
The input vector data file to classify.

Statistics file -instat filename [dtype]
A XML file containing mean and standard deviation to centerand reduce samples before classification, produced by ComputeImagesStatistics application.

Model file -model filename [dtype] Mandatory
Model file produced by TrainVectorRegression application.

Output field -cfield string Default value: predicted
Field containing the predicted value.Only geometries with this field available will be taken into account. The field is added either in the input file (if 'out' off) or in the output file. Caution, the 'cfield' must not exist in the input file if you are updating the file.

Field names to be calculated -feat string1 string2...
List of field names in the input vector data used as features for training. Put the same field names as the TrainVectorRegression application.

Output vector data file -out filename [dtype]
Output vector data file storing sample values (OGR format).If not given, the input vector data file is updated.

实例

从命令行执行以下操作:

otbcli_VectorRegression -in vectorData.shp -instat meanVar.xml -model rfModel.rf -out vectorDataLabeledVector.shp -feat perimeter  area  width -cfield predicted

来自Python的评论:

import otbApplication

app = otbApplication.Registry.CreateApplication("VectorRegression")

app.SetParameterString("in", "vectorData.shp")
app.SetParameterString("instat", "meanVar.xml")
app.SetParameterString("model", "rfModel.rf")
app.SetParameterString("out", "vectorDataLabeledVector.shp")
app.SetParameterStringList("feat", ['perimeter', 'area', 'width'])
app.SetParameterString("cfield", "predicted")

app.ExecuteAndWriteOutput()

局限性

支持Shapefile,但仅在更新模式下支持SQLite格式。