TrainDimensionalityReduction¶
训练降维模型
描述¶
降维算法(自动编码器、主成分分析、自组织映射)的训练器。与其他机器学习模型一样,所有输入样本都用于计算模型。该模型可用于 ImageDimensionalityReduction 和 VectorDimensionalityReduction 申请。
参数¶
输入和输出数据¶
这组参数允许设置输入和输出数据。
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选项¶
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
Shark自动编码器选项¶
Maximum number of iterations during training -algorithm.autoencoder.nbiter int
Default value: 100
The maximum number of iterations used during training.
Maximum number of iterations during training -algorithm.autoencoder.nbiterfinetuning int
Default value: 0
The maximum number of iterations used during fine tuning of the whole network.
Epsilon -algorithm.autoencoder.epsilon float
Default value: 0
Epsilon
Weight initialization factor -algorithm.autoencoder.initfactor float
Default value: 1
Parameter that control the weight initialization of the autoencoder
Size -algorithm.autoencoder.nbneuron string1 string2...
Mandatory
The number of neurons in each hidden layer.
Strength of the regularization -algorithm.autoencoder.regularization string1 string2...
Mandatory
Strength of the L2 regularization used during training
Strength of the noise -algorithm.autoencoder.noise string1 string2...
Mandatory
Strength of the noise
Sparsity parameter -algorithm.autoencoder.rho string1 string2...
Mandatory
Sparsity parameter
Sparsity regularization strength -algorithm.autoencoder.beta string1 string2...
Mandatory
Sparsity regularization strength
Learning curve -algorithm.autoencoder.learningcurve filename [dtype]
Learning error values
Shark PCA选项¶
Dimension of the output of the pca transformation -algorithm.pca.dim int
Default value: 10
Dimension of the output of the pca transformation.
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
实例¶
从命令行执行以下操作:
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
来自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()