{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/hyperparameters/conditionalsuperlearner/v1/schema.json",
  "title": "rtemis ConditionalSuperLearnerHyperparameters",
  "description": "Conditional SuperLearner: an oracle routes each case to one of a library of experts. See `setup_ConditionalSuperLearner`.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "base_learners": {
      "type": "array",
      "items": {
        "$ref": "https://schema.rtemis.org/hyperparameters/v1/schema.json"
      }
    },
    "inner_resampling_config": {
      "$ref": "https://schema.rtemis.org/resampler/v1/schema.json"
    },
    "expand_search_spaces": {
      "type": "boolean",
      "description": "Expand a base learner's search space into one library entry per grid combination, rather than tuning it by inner resampling.",
      "x-rtemis": {
        "type": "boolean"
      }
    },
    "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
      }
    },
    "meta_learner": {
      "$ref": "https://schema.rtemis.org/hyperparameters/v1/schema.json"
    },
    "n_iterations": {
      "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": "Alternations between fitting the oracle and refitting the experts.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "loss": {
      "type": ["string", "null"],
      "enum": [
        "squared_error",
        "log_loss",
        null
      ],
      "description": "Per-case loss the oracle minimizes. NULL = squared error, which for classification is the Brier score.",
      "x-rtemis": {
        "type": "string",
        "default_on_null": true
      }
    },
    "init": {
      "type": "string",
      "enum": ["full", "random"],
      "description": "Region each expert starts from: the whole training fold, or a random partition of it.",
      "x-rtemis": {
        "type": "string"
      }
    },
    "min_region_size": {
      "type": "integer",
      "minimum": 1,
      "description": "Fewest cases an expert's region may hold before the expert keeps its previous fit instead of being refitted.",
      "x-rtemis": {
        "type": "integer"
      }
    }
  }
}
