{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/hyperparameters/ranger/v1/schema.json",
  "title": "rtemis RangerHyperparameters",
  "description": "Ranger random forest. See `setup_Ranger`.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "num_trees": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 500,
      "description": "Number of trees."
    },
    "mtry": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": null,
      "description": "Number of features considered at each split. NULL = ranger default. Cannot exceed the number of features in the training data."
    },
    "importance": {
      "type": "string",
      "enum": ["none", "impurity", "impurity_corrected", "permutation"],
      "default": "impurity",
      "description": "Variable importance mode."
    },
    "write_forest": {
      "type": "boolean",
      "default": true,
      "description": "Save the forest object (required for prediction)."
    },
    "probability": {
      "type": "boolean",
      "default": false,
      "description": "Grow a probability forest (classification only)."
    },
    "min_node_size": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": null,
      "description": "Minimal node size. NULL = ranger default by task type."
    },
    "min_bucket": {
      "type": ["integer", "null"],
      "minimum": 1,
      "default": null,
      "description": "Minimal number of samples in a terminal node (survival only)."
    },
    "max_depth": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 0
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 0
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": null,
      "description": "Maximal tree depth. NULL or 0 = unlimited."
    },
    "replace": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "array",
          "items": {
            "type": "boolean"
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": true,
      "description": "Sample with replacement."
    },
    "sample_fraction": {
      "oneOf": [
        {
          "type": "number",
          "maximum": 1,
          "exclusiveMinimum": 0
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "maximum": 1,
            "exclusiveMinimum": 0
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 1,
      "description": "Fraction of observations to sample per tree."
    },
    "case_weights": {
      "type": ["array", "null"],
      "items": {
        "type": "number",
        "minimum": 0
      },
      "minItems": 1,
      "default": null,
      "description": "Per-observation sampling weights. Must have one value per case."
    },
    "class_weights": {
      "type": ["array", "null"],
      "items": {
        "type": "number",
        "minimum": 0
      },
      "minItems": 1,
      "default": null,
      "description": "Per-class weights (classification only). Must have one value per class."
    },
    "splitrule": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": null,
      "description": "Splitting rule (task-dependent). NULL = ranger default."
    },
    "num_random_splits": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 1,
      "description": "Random splits per candidate variable (extratrees splitrule)."
    },
    "alpha": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 0.5,
      "description": "Significance threshold to allow splitting (maxstat splitrule)."
    },
    "minprop": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 0.1,
      "description": "Lower quantile of covariate distribution considered for splitting (maxstat splitrule)."
    },
    "poisson_tau": {
      "type": "number",
      "exclusiveMinimum": 0,
      "default": 1,
      "description": "Tau parameter (poisson splitrule)."
    },
    "always_split_variables": {
      "type": ["array", "null"],
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "default": null,
      "description": "Variables always included as split candidates. Values must name training features."
    },
    "scale_permutation_importance": {
      "type": "boolean",
      "default": false,
      "description": "Scale permutation importance by its standard error."
    },
    "local_importance": {
      "type": "boolean",
      "default": false,
      "description": "Compute local (per-observation) permutation importance."
    },
    "regularization_factor": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 1,
      "description": "Regularization factor penalizing variables with many split points."
    },
    "regularization_usedepth": {
      "type": "boolean",
      "default": false,
      "description": "Apply the regularization factor with node depth."
    },
    "keep_inbag": {
      "type": "boolean",
      "default": false,
      "description": "Record how often each observation is in-bag per tree."
    },
    "holdout": {
      "type": "boolean",
      "default": false,
      "description": "Hold-out mode: hold out samples with case weight 0."
    },
    "quantreg": {
      "type": "boolean",
      "default": false,
      "description": "Prepare quantile prediction (regression only)."
    },
    "time_interest": {
      "type": ["array", "null"],
      "items": {
        "type": "number"
      },
      "minItems": 1,
      "default": null,
      "description": "Time points of interest for survival prediction."
    },
    "oob_error": {
      "type": "boolean",
      "default": true,
      "description": "Compute the OOB prediction error."
    },
    "save_memory": {
      "type": "boolean",
      "default": false,
      "description": "Use the memory-saving (slower) splitting mode."
    },
    "verbose": {
      "type": "boolean",
      "default": true,
      "description": "Show ranger computation status."
    },
    "node_stats": {
      "type": "boolean",
      "default": false,
      "description": "Save additional node statistics."
    },
    "seed": {
      "type": ["integer", "null"],
      "default": null,
      "description": "Random seed. NULL = generated from R."
    },
    "na_action": {
      "type": "string",
      "enum": ["na.learn", "na.omit", "na.fail"],
      "default": "na.learn",
      "description": "How to handle missing values."
    },
    "ifw": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "array",
          "items": {
            "type": "boolean"
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": false,
      "description": "Inverse Frequency Weighting in classification."
    },
    "split_select_weights": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "minItems": 1
        },
        {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            "minItems": 1
          },
          "minItems": 1
        }
      ],
      "description": "Optional per-feature split-selection probabilities in [0, 1]: a single vector applied to every tree, or a list of length `num_trees` with one weight vector per tree. null uses the ranger default."
    },
    "respect_unordered_factors": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "enum": ["partition", "ignore", "order"]
        },
        {
          "type": "boolean"
        }
      ],
      "description": "Handling of unordered factors: \"partition\", \"ignore\", or \"order\"; or a logical (TRUE corresponds to \"partition\"). null uses the ranger default."
    },
    "inbag": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 0
            }
          },
          "minItems": 1
        }
      ],
      "description": "Optional manually-set in-bag counts: a list of length `num_trees`, each a per-observation vector of non-negative counts. null uses the ranger default (bootstrap sampling)."
    }
  }
}
