{
  "slug": "frequency-encoder",
  "name": "gizza-ai/frequency-encoder",
  "version": "0.1.0",
  "title": "Frequency Encoder — Replace CSV Categories With Their Counts — gizza.ai",
  "description": "Frequency/count encode a CSV categorical column: replace each value with its occurrence count, share, percent, or log-count. Rare-category pooling, replace or append.",
  "tags": [
    "frequency encoding",
    "count encoding",
    "categorical encoding",
    "feature engineering",
    "high cardinality",
    "csv encoder",
    "machine learning preprocessing"
  ],
  "category": "encoding",
  "urls": {
    "page": "https://gizza.ai/tools/frequency-encoder/",
    "markdown": "https://gizza.ai/tools/frequency-encoder/index.md",
    "descriptor": "https://gizza.ai/tools/frequency-encoder/tool.json",
    "deep_link_example": "https://gizza.ai/tools/frequency-encoder/?data=product_id%2Cprice%0AX%2C10%0AY%2C20%0AX%2C30%0AZ%2C40%0AX%2C50%0AY%2C60&column=product_id&mode=count&output=replace&blank=count&min_count=0&case_sensitive=true&decimals=4&has_header=true&delimiter=comma"
  },
  "cli": "gizza tool frequency-encoder \"product_id,price\nX,10\nY,20\nX,30\nZ,40\nX,50\nY,60\" 'column=product_id'",
  "tool": {
    "description": "Replace a categorical CSV column with how often each value occurs, turning a high-cardinality column into a single numeric feature without one-hot column explosion (count / frequency encoding). Modes: raw count, frequency share (0-1), percent, or log-count. Supports replace-in-place or append-new-column output, rare-category pooling below a minimum count, case-insensitive grouping, blank-cell handling (count / NaN / zero), decimal rounding, header or 1-based index column selection, and comma/tab/semicolon/pipe delimiters.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "blank": {
          "default": "count",
          "description": "How to treat blank cells: 'count' makes blanks their own category, 'nan' writes NaN, 'zero' writes 0. With nan/zero, blank rows are excluded from the counts and from the frequency denominator.",
          "enum": [
            "count",
            "nan",
            "zero"
          ],
          "type": "string"
        },
        "case_sensitive": {
          "default": true,
          "description": "Count values differing only in case separately. Turn off to group 'Paris', 'PARIS', and 'paris' as one value.",
          "type": "boolean"
        },
        "column": {
          "description": "Categorical column to encode: a header name, or a 1-based column number when there is no header. Example: product_id.",
          "type": "string"
        },
        "data": {
          "description": "CSV text to encode. The chosen column is replaced (or a new column appended) with how often each value occurs.",
          "type": "string"
        },
        "decimals": {
          "default": 4,
          "description": "Number of decimal places for frequency, percent, and log-count values. Raw counts are always whole numbers.",
          "maximum": 15,
          "minimum": 0,
          "type": "integer"
        },
        "delimiter": {
          "default": "comma",
          "description": "CSV delimiter used to read and write the data.",
          "enum": [
            "comma",
            "tab",
            "semicolon",
            "pipe"
          ],
          "type": "string"
        },
        "has_header": {
          "default": true,
          "description": "Treat the first CSV row as headers. Turn off to select the column by 1-based number.",
          "type": "boolean"
        },
        "min_count": {
          "default": 0,
          "description": "Pool rare categories: values occurring fewer than this many times share one combined count, so rare levels collapse into a single group. 0 or 1 disables pooling.",
          "maximum": 100000,
          "minimum": 0,
          "type": "integer"
        },
        "mode": {
          "default": "count",
          "description": "What each value becomes: 'count' = raw number of rows with that value; 'frequency' = share of rows (0-1); 'percent' = share x 100; 'log-count' = ln(1 + count), which compresses very skewed distributions.",
          "enum": [
            "count",
            "frequency",
            "percent",
            "log-count"
          ],
          "type": "string"
        },
        "output": {
          "default": "replace",
          "description": "Replace the column in place, or keep it and append a new <name>_count / _freq / _pct / _logcount column.",
          "enum": [
            "replace",
            "append"
          ],
          "type": "string"
        }
      },
      "required": [
        "data",
        "column"
      ],
      "type": "object"
    }
  }
}