TrainDimensionalityReduction¶
Train a dimensionality reduction model
Description¶
Trainer for dimensionality reduction algorithms (autoencoders, PCA, SOM). All input samples are used to compute the model, like other machine learning models. The model can be used in the ImageDimensionalityReduction and VectorDimensionalityReduction applications.
Parameters¶
Input and output data¶
This group of parameters allows setting input and output data.
Input Vector Data -io.vd vectorfile
Mandatory
Input geometries used for training (note: all geometries from the layer will be used)
Output model -io.out filename [dtype]
Mandatory
Output file containing the estimated model (.txt format).
Input XML image statistics file -io.stats filename [dtype]
XML file containing mean and variance of each feature.
Field names to be used for training -feat string1 string2...
List of field names in the input vector data used as features for training.
algorithm to use for the training -algorithm [som|autoencoder|pca]
Default value: som
Choice of the dimensionality reduction algorithm to use for the training.
OTB SOM
This group of parameters allows setting SOM parameters.Shark Autoencoder
This group of parameters allows setting Shark autoencoder parameters.Shark PCA
This group of parameters allows setting Shark PCA parameters.
OTB SOM options¶
Map size -algorithm.som.s string1 string2...
Default value: 10 10
Sizes of the SOM map (one per dimension). For instance, [12;15] means a 2D map of size 12x15. Support2D to 5D maps.
Neighborhood sizes -algorithm.som.n string1 string2...
Default value: 3 3
Sizes of the initial neighborhood in the SOM map (one per dimension). The number of sizes should be the same as the map sizes
NumberIteration -algorithm.som.ni int
Default value: 5
Number of iterations for SOM learning
BetaInit -algorithm.som.bi float
Default value: 1
Initial learning coefficient
BetaFinal -algorithm.som.bf float
Default value: 0.1
Final learning coefficient
InitialValue -algorithm.som.iv float
Default value: 10
Maximum initial neuron weight
Examples¶
From the command-line:
otbcli_TrainDimensionalityReduction -io.vd cuprite_samples.sqlite -io.out model.som -algorithm som -algorithm.som.s 10 10 -algorithm.som.n 3 3 -algorithm.som.ni 5 -algorithm.som.bi 1 -algorithm.som.bf 0.1 -algorithm.som.iv 10 -feat value_0 value_1 value_2 value_3 value_4 value_5 value_6 value_7 value_8 value_9
From Python:
import otbApplication
app = otbApplication.Registry.CreateApplication("TrainDimensionalityReduction")
app.SetParameterString("io.vd", "cuprite_samples.sqlite")
app.SetParameterString("io.out", "model.som")
app.SetParameterString("algorithm","som")
app.SetParameterStringList("algorithm.som.s", ['10', '10'])
app.SetParameterStringList("algorithm.som.n", ['3', '3'])
app.SetParameterInt("algorithm.som.ni", 5)
app.SetParameterFloat("algorithm.som.bi", 1)
app.SetParameterFloat("algorithm.som.bf", 0.1)
app.SetParameterFloat("algorithm.som.iv", 10)
app.SetParameterStringList("feat", ['value_0', 'value_1', 'value_2', 'value_3', 'value_4', 'value_5', 'value_6', 'value_7', 'value_8', 'value_9'])
app.ExecuteAndWriteOutput()