{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.rtemis.org/hyperparameters/knn/v1/schema.json",
  "title": "rtemis KNNHyperparameters",
  "description": "k-Nearest Neighbors (kknn). See `setup_KNN`.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "k": {
      "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": "Number of neighbors. Must be less than the number of training cases.",
      "x-rtemis": {
        "type": "integer",
        "tunable": true
      }
    },
    "kernel": {
      "oneOf": [
        {
          "type": "string",
          "enum": ["rectangular", "triangular", "epanechnikov", "biweight", "triweight", "cos", "inv", "gaussian", "rank", "optimal"]
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": ["rectangular", "triangular", "epanechnikov", "biweight", "triweight", "cos", "inv", "gaussian", "rank", "optimal"]
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Kernel used to weight neighbors by distance; \"rectangular\" gives unweighted KNN.",
      "x-rtemis": {
        "type": "string",
        "tunable": true
      }
    },
    "distance": {
      "oneOf": [
        {
          "type": "number",
          "exclusiveMinimum": 0
        },
        {
          "type": "object",
          "properties": {
            "candidates": {
              "type": "array",
              "items": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "minItems": 2,
              "description": "Values to tune over; the tuner selects one."
            }
          },
          "required": ["candidates"],
          "additionalProperties": false
        }
      ],
      "description": "Parameter of the Minkowski distance: 1 is Manhattan, 2 is Euclidean.",
      "x-rtemis": {
        "type": "number",
        "tunable": true
      }
    },
    "scale": {
      "type": "boolean",
      "description": "Scale features to unit variance before computing distances.",
      "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
      }
    }
  }
}
