Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metadata detection] Add a cardinality cap when choosing between categorical vs. numerical #1584

Closed
npatki opened this issue Sep 14, 2023 · 0 comments · Fixed by #1610
Closed
Assignees
Labels
feature:metadata Related to describing the dataset feature request Request for a new feature
Milestone

Comments

@npatki
Copy link
Contributor

npatki commented Sep 14, 2023

This issue is for the in-progress metadata-improvment branch, which aims to improve the accuracy of metadata detection from datasets.

Background

Sometimes a column may be represented using int/float values but it is actually encoding distinct categories. For example, an HTTP error code such as 404 or 200. To distinguish between numerical vs. categorical, the metadata detection looks at the cardinality, or the # of unique values in a column.

Current logic: If cardinality < (length of data)/10, then mark it as "categorical"

Problem

The current logic is giving too much tolerance for cardinality for large datasets. Eg. with 500K rows, we allow a cardinality of up to 50K.

Expected behavior

We propose capping the cardinality at 10. Which means using the following logic:

# pseudocode
if cardinality(column) < min(len(column)/10, 10):
    sdtype = "categorical"
@npatki npatki added feature request Request for a new feature feature:metadata Related to describing the dataset labels Sep 14, 2023
@amontanez24 amontanez24 added this to the 1.5.0 milestone Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:metadata Related to describing the dataset feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants