{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/hyperparameters/cart/v1/schema.json",
  "title": "rtemis CARTHyperparameters",
  "description": "CART decision tree (rpart). See `setup_CART`.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "cp": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 0.01,
      "description": "Complexity parameter."
    },
    "maxdepth": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1,
          "maximum": 30
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 20,
      "description": "Maximum depth of tree (rpart limit: 30)."
    },
    "minsplit": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 2,
      "description": "Minimum number of observations in a node to attempt a split."
    },
    "minbucket": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": 1,
      "description": "Minimum number of observations in a terminal node."
    },
    "prune_cp": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "array",
          "items": {
            "type": "number",
            "minimum": 0
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": null,
      "description": "Complexity for cost-complexity pruning after the tree is built."
    },
    "method": {
      "type": "string",
      "enum": ["auto", "anova", "class", "poisson", "exp"],
      "default": "auto",
      "description": "Splitting method. auto = set from outcome type."
    },
    "model": {
      "type": "boolean",
      "default": true,
      "description": "Keep a copy of the model frame in the result."
    },
    "maxcompete": {
      "type": "integer",
      "minimum": 0,
      "default": 4,
      "description": "Number of competitor splits retained in the output."
    },
    "maxsurrogate": {
      "type": "integer",
      "minimum": 0,
      "default": 5,
      "description": "Number of surrogate splits retained in the output."
    },
    "usesurrogate": {
      "type": "integer",
      "minimum": 0,
      "maximum": 2,
      "default": 2,
      "description": "How to use surrogates in the splitting process."
    },
    "surrogatestyle": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1,
      "default": 0,
      "description": "Controls the selection of the best surrogate."
    },
    "xval": {
      "type": "integer",
      "minimum": 0,
      "default": 0,
      "description": "Number of rpart-internal cross-validation folds."
    },
    "cost": {
      "type": ["array", "null"],
      "items": {
        "type": "number",
        "exclusiveMinimum": 0
      },
      "minItems": 1,
      "default": null,
      "description": "Variable costs. Must have one value per feature."
    },
    "ifw": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "array",
          "items": {
            "type": "boolean"
          },
          "minItems": 1,
          "description": "Tuning search values."
        }
      ],
      "default": false,
      "description": "Inverse Frequency Weighting in classification."
    }
  }
}
