language: cn
model_unique_abbr: random_forest_img_class_sagagis
version: 1.0
identification:
  docker_image_name: sagagis:debian-8.5.0
  docker_run_prefix:
  - imagery_vigra
  - 9
  model_name: 随机森林图像分类算法（ViGrA）
  semantic: random forest
  description: 基于ViGrA（Vision with Generic Algorithms），收集所有分类投票结果后，将投票次数最多的类别指定为最终的输出
  category_application: 预测型
  category_data:
  - 遥感影像数据
  - 图像数据
  keywords:
  - 监督分类
  - 集成学习
parameter_info:
  parameters:
  - arg_name: FEATURES
    param_type: input_data
    name: 输入表格
    description: 用于分类的表格数据，必须包含分类id
    data_type: tif
    data_semantic: rfwork

  - arg_name: TRAINING
    param_type: input_data
    name: 训练标签
    description: 用于训练影像的分类
    data_type: shp
    data_semantic: label

  - arg_name: CLASSES
    param_type: output_data
    name: 分类结果影像
    description: 输出分类结果
    data_type: tif
    data_semantic: Random Forest Classification

  - arg_name: IMPORTANCES
    param_type: output_data
    name: 特征重要度数据结果输出
    description: 输出每个特征对结果的重要程度。
    data_type: csv
    data_semantic: Feature Importances

  - arg_name: LABEL_AS_ID
    param_type: param
    name: 使用标签作为标识
    description: 在分类结果中使用训练区域标签作为标识符，假设所有标签值都是整数！
    is_required: false
    data_type: enum
    data_semantic: Use Label as Identifier
    specification:
      default: 0
      enum:
      - 0
      - 1

  - arg_name: RF_TREE_COUNT
    param_type: param
    name: 树的数量
    description: 需要创建的树的数量
    is_required: True
    data_type: int
    data_semantic: Tree Count
    specification:
      default: 32
      range:
      - "[1,)"

  - arg_name: RF_TREE_SAMPLES
    param_type: param
    name: 树的样本数
    description: 指定每棵树用于学习的样本总数占总样本数的比例。
    is_required: True
    data_type: float
    data_semantic: Samples per Tree
    specification:
      default: 1.0
      range:
      - "[0.0,1.0]"

  - arg_name: RF_REPLACE
    param_type: param
    name: 是否替换样本
    description: 是否从训练数据中抽取样本进行替代
    is_required: True
    data_type: enum
    data_semantic: Sample with Replacement
    specification:
      default: 1
      enum:
      - 0
      - 1

  - arg_name: RF_SPLIT_MIN_SIZE
    param_type: param
    name: 最小节点尺寸
    description: 节点拆分所需的样例数。选择1表示完全成长。
    is_required: True
    data_type: int
    data_semantic: Minimum Node Split Size
    specification:
      default: 1
      range:
      - "[1,)"


  - arg_name: RF_NODE_FEATURES
    param_type: param
    name: 节点特征数
    description: 0表示对数处理，1表示平方根处理，2表示所有特征
    is_required: True
    data_type: enum
    data_semantic: Features per Node
    specification:
      default: 1
      enum:
        - 0
        - 1
        - 2


  - arg_name: RF_STRATIFICATION
    param_type: param
    name: 分层策略
    description: 指定分层策略。要么没有，要么类样本数量相等，要么与类样本所占比例成正比，0是没有，1是相等，2是成比例
    is_required: True
    data_type: enum
    data_semantic: Stratification
    specification:
      default: 0
      enum:
        - 0
        - 1
        - 2

application:
  domain: 格网数据分类
  objective: 根据先验信息对待预测数据进行分类型预测
  mechanism: 收集所有局决策树分类投票结果后，将投票次数最多的类别指定为最终的输出
operation:
  usage: 该算法须指定输入图像文件、训练区、训练标签字段、预测结果存放字段及输出路径，其他参数均可默认
  exec_example:
  - docker run -v $(pwd):/data registry.cn-hangzhou.aliyuncs.com/onesis-geomodels/sagagis:debian-8.5.0 imagery_vigra 9 -FEATURES /data/nb_saga_test.tif -TRAINING /data/nb_saga_class.shp -CLASSES /data/out_rf.tif -IMPORTANCES /data/IMPORTANCES.csv -LABEL_AS_ID 0 -RF_TREE_COUNT 32 -RF_TREE_SAMPLES 1.0 -RF_REPLACE 1 -RF_SPLIT_MIN_SIZE 1 -RF_NODE_FEATURES 1 -RF_STRATIFICATION 0
  license:
  - SAGA-GIS-GNU General Public
technique:
  language:
  - C++
  os:
  - Linux
  - Windows
  dependencies:
  - name: SAGA-GIS
    version: 8.5.0
source:
  maintainer: Han Li
  organization: Beijing University of Civil Engineering and Architecture
  contact: hli020319@gmail.com
  integrated_softwares:
  - name: SAGA-GIS
    version: 8.5.0
    license: GNU General Public
  references:
  - https://saga-gis.sourceforge.io/saga_tool_doc/8.1.0/imagery_vigra_9.html
