CentreForDigitalHumanities / CentreForDigitalHumanities/Textcavator

Handling high number of categories in histogram term frequency

Open
#961 0 comments 0 reactions 0 assignees View on GitHub
visualisation
Dominant language
Python
Stars
12
Forks
3
Avg merge
3d 3m
Merged PRs (30d)
9

Description

The histogram can be configured so that the maximum number of bins in the graph is greater than the total number of categories. (I think this is capped at 100.) This is useful for fields with many values like the speaker of a speech, or the debate (#735). The graph should return the top n speakers (to use that as a running example) - essentially the speakers most relevant for your query.

For document frequencies, this means that the elasticsearch request will return the categories with the highest number of matching documents, so that's fine.

For the term frequency (relative or absolute), the categories are retrieved from this document request with size _n_, and then the frequency is counted within each of the returned categories.

This has the problem that the speakers with the highest number of matching speeches do not necessarily have the highest relative term frequency. Highly relevant speakers with few total speeches may not make the top _n_ because their absolute number of documents is low.

What the graph should really do in this case is analyse _all_ categories and then filter the top _n_ when generating the actual graph.

However, this becomes problematic when the number of categories is very large. Say that we have 200 years of debates with 200 debates per year on average, i.e. 40.000 debates in total. If 1 in 4 debates mentions our search term, and we have a document limit of 10.000, we can analyse exactly 1 speech per debate - so relative term frequencies are kind of meaningless.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the histogram's term-frequency handling and the Elasticsearch requests that retrieve categories, focusing on how the bin limit and document limit affect relative and absolute frequencies. Use the examples in this issue to evaluate the current behavior and determine a scalable approach; done means the graph selects relevant top categories without making relative frequencies misleading for large category sets.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, python
Domain
analytics, data, search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.