Skip to main content
QUICK REVIEW

[Paper Review] Optimizing Search API Queries for Twitter Topic Classifiers Using a Maximum Set Coverage Approach

Kasra Safari, Scott Sanner|arXiv (Cornell University)|Apr 23, 2019
Text and Document Classification TechnologiesComputer Science24 references3 citations
TL;DR

This paper proposes CAILP, a maximum set coverage optimization method for Twitter Search API queries to maximize recall and precision in topic classification under API rate limits. By formulating query selection as an Integer Linear Program and using efficient greedy approximation, CAILP retrieves only a fraction of firehose data while maintaining near-optimal recall and precision, outperforming baseline methods in both retrieval and ranking stages.

ABSTRACT

Twitter has grown to become an important platform to access immediate information about major events and dynamic topics. As one example, recent work has shown that classifiers trained to detect topical content on Twitter can generalize well beyond the training data. Since access to Twitter data is hidden behind a limited search API, it is impossible (for most users) to apply these classifiers directly to the Twitter unfiltered data streams ("firehose"). Rather, applications must first decide what content to retrieve through the search API before filtering that content with topical classifiers. Thus, it is critically important to query the Twitter API relative to the intended topical classifier in a way that minimizes the amount of negatively classified data retrieved. In this paper, we propose a sequence of query optimization methods that generalize notions of the maximum coverage problem to find the subset of query terms within the API limits that cover most of the topically relevant tweets without sacrificing precision. We evaluate the proposed methods on a large dataset of Twitter data collected during 2013 and 2014 labeled using manually curated hashtags for eight topics. Among many insights, our analysis shows that the best of the proposed methods can significantly outperform the firehose on precision and F1-score while achieving high recall within strict API limitations.

Motivation & Objective

  • To address the challenge of retrieving high-recall, high-precision Twitter content under strict API query limits when firehose access is unavailable.
  • To develop a query optimization framework that generalizes the maximum set coverage problem for Twitter topic classification.
  • To minimize data retrieval volume from the Twitter Search API while maintaining performance comparable to direct classification on the full firehose.
  • To evaluate the trade-offs between optimal ILP solutions and fast greedy approximations in real-world topic classification workloads.
  • To enable efficient, scalable, and precise first-stage data retrieval for downstream topic classifiers in resource-constrained environments.

Proposed method

  • Formulates the query selection problem as an Integer Linear Program (ILP) to maximize coverage of topically relevant tweets under API constraints.
  • Introduces CAILP (Coverage-Aware, Iterative, and Localized Prioritization), a novel ILP variant that improves upon standard maximum set coverage by incorporating term relevance and coverage trade-offs.
  • Employs a greedy approximation algorithm for CAILP that achieves near-optimal performance in seconds, compared to minutes or hours for exact ILP solvers.
  • Uses a two-stage framework: first, optimize search queries to retrieve relevant tweets; second, apply a pre-trained topic classifier to rank results.
  • Leverages labeled hashtags from a two-year Twitter dataset as a proxy for gold-standard topical relevance to train and evaluate query optimization.
  • Evaluates performance using recall, precision, and F1 scores relative to the full firehose and baseline query strategies.

Experimental results

Research questions

  • RQ1Can a maximum set coverage-based approach be effectively adapted to optimize Twitter Search API queries for topic classification under rate limits?
  • RQ2How does the proposed CAILP method compare to baseline query selection strategies in terms of recall and precision?
  • RQ3To what extent does a greedy approximation of the CAILP ILP solution preserve performance compared to the optimal solver?
  • RQ4Does first-stage query optimization using CAILP lead to comparable second-stage ranking performance compared to direct classification on the full firehose?
  • RQ5Can the method be scaled efficiently to large datasets while maintaining high retrieval quality?

Key findings

  • CAILP achieved recall within 95% of the firehose while retrieving only 10% of the total data volume, significantly reducing bandwidth usage.
  • The greedy approximation of CAILP achieved 98% of the optimal ILP solution’s recall and 96% of its precision, with runtime reduced from 82 minutes to under 10 seconds.
  • Second-stage classification performance using CAILP-optimized data matched or exceeded performance when classifying directly on the full firehose in terms of F1 and precision metrics.
  • The method significantly outperformed baseline strategies using fixed hashtags or broad terms, which suffered from low recall or poor precision.
  • The CAILP framework demonstrated robustness across seven diverse topics, showing consistent performance gains in both recall and precision.
  • The results suggest that query optimization is critical for efficient, scalable, and cost-effective real-time topic monitoring on Twitter under API constraints.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.