{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/hyperparameters/v1/schema.json",
  "title": "rtemis Hyperparameters",
  "description": "Language-independent algorithm hyperparameters: an algorithm name and an algorithm-specific `hyperparameters` object, validated per-algorithm against schema.rtemis.org/hyperparameters/<algorithm>/v1. Mirrors the `{algorithm, hyperparameters}` wire format consumed by `.list_to_Hyperparameters`.",
  "type": "object",
  "required": ["algorithm", "hyperparameters"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "const": "https://schema.rtemis.org/hyperparameters/v1/schema.json",
      "description": "JSON Schema URI for this config instance."
    },
    "algorithm": {
      "type": "string",
      "enum": ["GLM", "GAM", "CART", "GLMNET", "LightCART", "LightRF", "LightGBM", "LightRuleFit", "Isotonic", "LinearSVM", "RadialSVM", "TabNet", "Ranger"],
      "description": "Supervised-learning algorithm name (matches `setup_<algorithm>`)."
    },
    "hyperparameters": {
      "type": "object",
      "description": "Variant-specific parameters. Validated per `algorithm` below."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "GLM"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/glm/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "GAM"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/gam/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "CART"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/cart/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "GLMNET"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/glmnet/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "LightCART"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/lightcart/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "LightRF"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/lightrf/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "LightGBM"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/lightgbm/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "LightRuleFit"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/lightrulefit/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "Isotonic"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/isotonic/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "LinearSVM"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/linearsvm/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "RadialSVM"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/radialsvm/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "TabNet"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/tabnet/v1/schema.json"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "algorithm": {
            "const": "Ranger"
          }
        },
        "required": ["algorithm"]
      },
      "then": {
        "properties": {
          "hyperparameters": {
            "$ref": "https://schema.rtemis.org/hyperparameters/ranger/v1/schema.json"
          }
        }
      }
    }
  ]
}
