Skip to content

"Filter by value" with top n results gives more results than expected #541

@stijn-uva

Description

@stijn-uva

The 'Filter by value' processor in 4CAT has an 'is in the top n results for this attribute' mode which, for example, returns the top 100 items from a dataset sorted by a given column, e.g. likes.

It does this by getting the top 100 values for that column and returning all items with that value, but if (for example) multiple items have the same amount of plays, it will select all of those. So potentially more than 100 matching items are returned.

The naive solution would be return sorted(items, reverse=True)[:100] but sorted() happens in-memory, and that should be avoided for this to also work with (very) large datasets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingprocessorsInvolves self-contained analyticalprocessors.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions