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

Support entropy in Aggregation function #12247

Open
Tracked by #12254
Weijun-H opened this issue Aug 30, 2024 · 4 comments
Open
Tracked by #12254

Support entropy in Aggregation function #12247

Weijun-H opened this issue Aug 30, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@Weijun-H
Copy link
Member

Is your feature request related to a problem or challenge?

Calculates Shannon entropy of a column of values.

Describe the solution you'd like

D CREATE TABLE entropy (vals UInt32,strings String);
D INSERT INTO entropy VALUES (1, 'A'), (1, 'A'), (1,'A'), (1,'A'), (2,'B'), (2,'B'), (2,'C'), (2,'D');
D
D SELECT entropy(vals), entropy(strings) FROM entropy;
┌───────────────┬──────────────────┐
│ entropy(vals) │ entropy(strings) │
│    double     │      double      │
├───────────────┼──────────────────┤
│           1.0 │             1.75 │
└───────────────┴──────────────────┘

Describe alternatives you've considered

No response

Additional context

https://duckdb.org/docs/sql/functions/aggregates#entropyx
https://clickhouse.com/docs/en/sql-reference/aggregate-functions/reference/entropy

@Weijun-H Weijun-H added the enhancement New feature or request label Aug 30, 2024
@Weijun-H Weijun-H changed the title Support entropy in Aggregation function Support entropy in Aggregation function Aug 30, 2024
@dharanad
Copy link
Contributor

Haven't worked on a problem like this before. I would like to give this a try.

@thinh2
Copy link
Contributor

thinh2 commented Aug 30, 2024

take

@alamb
Copy link
Contributor

alamb commented Sep 9, 2024

Given #12357 we may want to move this function to some other repo rather than the core

@thinh2
Copy link
Contributor

thinh2 commented Sep 11, 2024

thank for notify @alamb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants