Skip to content

Feature: expose MAX_CATEGORICAL_CARD and MAX_DIMENSION_GROUPS as tunable CLI/web options #743

Description

@yakew7

Where: faircode/detect.py (MAX_CATEGORICAL_CARD = 20), faircode/profiler.py (MAX_DIMENSION_GROUPS = 50), faircode/cli.py, faircode/SPEC.md section 7.

Current gap: SPEC.md section 7's "Defaults (single place to tune)" table lists MAX_CATEGORICAL_CARD and MAX_DIMENSION_GROUPS alongside MIN_SHARE_THRESHOLD, IMBALANCE_FLAG, etc., but only five of those constants actually got CLI/web overrides: --min-share, --intersection-floor, --imbalance-flag, --missing-flag, --min-group-size. MAX_CATEGORICAL_CARD (the 2-20 distinct-value window for generic-categorical auto-detection) and MAX_DIMENSION_GROUPS (the 50-group identifier/date-column drop cutoff) are plain hardcoded module constants with no flag anywhere (grep -n "max.categorical\|max.dimension" faircode/cli.py returns nothing). A dataset with a legitimately-categorical column of 21-40 distinct values (e.g. a detailed occupation or diagnosis-code field) currently falls outside the auto-detect window and can only be rescued one column at a time via --map col=categorical, rather than the user simply raising the cardinality ceiling once for the whole run.

Repro:

$ grep -n "MAX_CATEGORICAL_CARD\|MAX_DIMENSION_GROUPS" faircode/detect.py faircode/profiler.py
faircode/detect.py:...: MAX_CATEGORICAL_CARD = 20
faircode/profiler.py:...: MAX_DIMENSION_GROUPS = 50
$ grep -n "max.categorical\|max.dimension" faircode/cli.py
(no output)

Suggested approach: add --max-categorical-card N and --max-dimension-groups N to profile/compare (and matching threshold inputs in profiler.html's "Advanced thresholds" panel), threaded through _resolve_opts/opts the same way the other five tunables are, with the current 20/50 as defaults.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions