{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/hyperparameters/mars/v1/schema.json",
  "title": "rtemis MARSHyperparameters",
  "description": "Multivariate Adaptive Regression Splines (earth). See `setup_MARS`.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "degree": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Maximum degree of interaction. 1 builds an additive model with no interaction terms.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "penalty": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "number",
          "minimum": -1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "number",
                "minimum": -1
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Generalized Cross Validation penalty per knot. NULL uses 3 when @degree is greater than 1 and 2 otherwise. 0 penalizes terms but not knots, and -1 removes the penalty.",
      "x-rtemis": {
        "type": "number",
        "tunable": true
      }
    },
    "nk": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Maximum number of terms, including the intercept, created by the forward pass. NULL lets earth derive it from the number of features.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "nprune": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "integer",
          "minimum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Maximum number of terms, including the intercept, retained after pruning. NULL keeps every term the forward pass created.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "thresh": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0,
          "exclusiveMaximum": 1
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "number",
                "minimum": 0,
                "exclusiveMaximum": 1
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Forward pass stopping threshold: stop once adding a term changes R-squared by less than this.",
      "x-rtemis": {
        "type": "number",
        "tunable": true
      }
    },
    "minspan": {
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Minimum number of observations between knots. 0 derives the value internally, and a negative value instead sets the maximum number of equally spaced knots per feature.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "endspan": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 0
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Minimum number of observations before the first and after the final knot. 0 derives the value internally.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "newvar_penalty": {
      "oneOf": [
        {
          "type": "number",
          "minimum": 0
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "number",
                "minimum": 0
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Penalty for adding a feature not already in the model during the forward pass. 0 applies no penalty; useful values typically range from 0.01 to 0.2.",
      "x-rtemis": {
        "type": "number",
        "tunable": true
      }
    },
    "fast_k": {
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 0
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Maximum number of parent terms considered at each step of the forward pass. 0 disables Fast MARS, which is slower but builds a better model.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "pmethod": {
      "type": "string",
      "enum": ["backward", "none", "exhaustive", "forward", "seqrep", "cv"],
      "description": "Pruning method. \"cv\" selects the number of terms by cross-validation and requires @nfold. Multiclass classification allows only \"backward\" and \"none\".",
      "x-rtemis": {
        "type": "string"
      }
    },
    "nfold": {
      "type": "integer",
      "minimum": 0,
      "description": "Number of cross-validation folds used to estimate out-of-fold R-squared. 0 disables cross-validation. Cannot exceed the number of cases in the training data.",
      "x-rtemis": {
        "type": "integer",
        "data_bound": "n_cases"
      }
    },
    "ncross": {
      "type": "integer",
      "minimum": 1,
      "description": "Number of times the @nfold cross-validation is repeated. Applies only when @nfold is greater than 1.",
      "x-rtemis": {
        "type": "integer"
      }
    },
    "stratify": {
      "type": "boolean",
      "description": "Stratify the cross-validation folds on the outcome. Applies only when @nfold is greater than 1.",
      "x-rtemis": {
        "type": "boolean"
      }
    },
    "fast_beta": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Fast MARS aging coefficient. 0 sometimes gives better results.",
      "x-rtemis": {
        "type": "number"
      }
    },
    "ifw": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "boolean"
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Inverse Frequency Weighting in classification.",
      "x-rtemis": {
        "type": "boolean",
        "tunable": true
      }
    }
  }
}
