{
  "$id": "https://schema.rtemis.org/hyperparameters/glmtree/v1/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "rtemis GLMTreeHyperparameters",
  "description": "Model-Based Recursive Partitioning: a tree with a GLM in each leaf. See `setup_GLMTree`.",
  "type": "object",
  "properties": {
    "regressors": {
      "description": "Features entering the linear model in each leaf. NULL uses every feature; an empty model is not expressible here, since a tree of intercepts is a decision tree and CART fits one. Values must name training features.",
      "type": ["array", "null"],
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "x-rtemis": {
        "type": "string",
        "container": "array",
        "data_bound": "feature_names"
      }
    },
    "partitioning_variables": {
      "description": "Features the tree may split on. NULL uses every feature. Values must name training features.",
      "type": ["array", "null"],
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "x-rtemis": {
        "type": "string",
        "container": "array",
        "data_bound": "feature_names"
      }
    },
    "alpha": {
      "description": "Significance level a parameter-instability test must reach before a node is split. The one setting that governs tree size.",
      "oneOf": [
        {
          "type": "number",
          "maximum": 1,
          "exclusiveMinimum": 0
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "number",
                "maximum": 1,
                "exclusiveMinimum": 0
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "number",
        "tunable": true
      }
    },
    "bonferroni": {
      "description": "Bonferroni-adjust the test p-values for the number of partitioning variables.",
      "type": "boolean",
      "x-rtemis": {
        "type": "boolean"
      }
    },
    "minsize": {
      "description": "Fewest cases a node may hold. NULL uses ten times the number of parameters in a leaf's model, which scales with the number of regressors and can forbid splitting entirely on a wide design. Cannot exceed the number of cases in the training data.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "integer",
        "tunable": true,
        "data_bound": "n_cases"
      }
    },
    "maxdepth": {
      "description": "Deepest the tree may grow. NULL is unlimited.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "mtry": {
      "description": "Partitioning variables sampled at each node. NULL tests every one. Cannot exceed the number of features in the training data.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "integer",
        "tunable": true,
        "data_bound": "n_features"
      }
    },
    "trim": {
      "description": "Trimming for the split-point search: a fraction of cases below 1, a count at or above it.",
      "oneOf": [
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "number",
                "minimum": 0
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "number",
        "tunable": true
      }
    },
    "breakties": {
      "description": "Break ties in numeric partitioning variables by adding noise.",
      "type": "boolean",
      "x-rtemis": {
        "type": "boolean"
      }
    },
    "prune": {
      "description": "Post-prune the grown tree by an information criterion. NULL keeps every split the tests admitted.",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "enum": ["AIC", "BIC"]
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["AIC", "BIC"]
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "string",
        "tunable": true
      }
    },
    "restart": {
      "description": "Restart each leaf's model from scratch rather than from its parent's fit.",
      "type": "boolean",
      "x-rtemis": {
        "type": "boolean"
      }
    },
    "dfsplit": {
      "description": "Count each split against the degrees of freedom when pruning.",
      "type": "boolean",
      "x-rtemis": {
        "type": "boolean"
      }
    },
    "numsplit": {
      "description": "Where a numeric split is placed: at the last value of the left branch, or midway between it and the next.",
      "oneOf": [
        {
          "type": "string",
          "enum": ["left", "center"]
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["left", "center"]
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "string",
        "tunable": true
      }
    },
    "catsplit": {
      "description": "How a categorical variable is split: into two groups of levels, or one branch per level.",
      "oneOf": [
        {
          "type": "string",
          "enum": ["binary", "multiway"]
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["binary", "multiway"]
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "string",
        "tunable": true
      }
    },
    "ordinal": {
      "description": "Test statistic for an ordered partitioning variable.",
      "oneOf": [
        {
          "type": "string",
          "enum": ["chisq", "max", "L2"]
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["chisq", "max", "L2"]
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "string",
        "tunable": true
      }
    },
    "vcov": {
      "description": "Covariance estimator the instability test is built on.",
      "type": "string",
      "enum": ["opg", "info", "sandwich"],
      "x-rtemis": {
        "type": "string"
      }
    },
    "nrep": {
      "description": "Simulation replicates for the p-value of an ordinal split statistic.",
      "type": "integer",
      "minimum": 1,
      "x-rtemis": {
        "type": "integer"
      }
    },
    "ifw": {
      "description": "Inverse Frequency Weighting in classification.",
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "description": "Values to tune over; the tuner selects one.",
              "type": "array",
              "items": {
                "type": "boolean"
              },
              "minItems": 2
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "x-rtemis": {
        "type": "boolean",
        "tunable": true
      }
    }
  },
  "additionalProperties": false
}
