VectorRegression

Performs regression on the input vector data according to a model file.

Description

This application performs a vector data regression based on a model file produced by the TrainVectorRegression application.Features of the vector data output will contain the values predicted by the classifier. There are two modes: 1) Update mode: add of the ‘cfield’ field containing the predicted value in the input file. 2) Write mode: copies the existing fields of the input file to the output file and add the ‘cfield’ field containing the predicted value. If you have declared the output file, the write mode applies. Otherwise, the input file update mode will be applied.

Parameters

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.

Examples

From the command-line:

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

From 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()

Limitations

Shapefiles are supported, but the SQLite format is only supported in update mode.