Algorithm Search⌘K

Algorithmresearch

IA-Select

Also called intent-aware select, intent-aware diversification.

Greedily picks documents that maximize the probability that each query intent is satisfied by at least one result; a (1 - 1/e) approximation.

Time
O(n log n + n k m) worst
Space
O(n + m) extra
Where
k = the number of results; m = the number of intents; n = the number of candidate documents
Properties
deterministiciterative
Origin
Rakesh Agrawal, Sreenivas Gollapudi, Alan Halverson, Samuel Ieong, 2009

IA-Select is a greedy algorithm for search result diversification that builds a result list one document at a time, each time adding the document that most increases the probability that the user finds at least one satisfying result. Rakesh Agrawal, Sreenivas Gollapudi, Alan Halverson and Samuel Ieong introduced it in 2009 with a distribution over the intents (categories) of the query. The objective is submodular, so the Nemhauser, Wolsey and Fisher theorem makes the greedy list at least 1−1/e1 - 1/e of the optimum. Unlike maximal marginal relevance, which only compares documents with each other, IA-Select models the intents explicitly; xQuAD uses the same coverage term but mixes it with plain relevance.

In plain words

A short query such as "jaguar" can mean a car, an animal or a football team. A list of ten car pages is perfect for some users and useless for the rest. IA-Select knows roughly how many users mean each thing, and how well each page serves each meaning. It picks the page that helps the most users first. After that, the users who are already served count for less, so the next page is the one that helps most of the users who are still waiting. Repeating this gives a list where popular meanings come first, and a rare meaning gets a page once a page for it would help more of the waiting users than one more page for a popular meaning. The list is never far from the best possible list, and the method can prove how far.

The problem

The input is a query qq, a set DD of nn candidate documents, a set CC of mm categories with probabilities P(c∣q)P(c \mid q) that sum to 1, a value V(d∣q,c)∈[0,1]V(d \mid q, c) \in [0, 1] for each document and category, and a length kk. The value is the probability that dd satisfies a user whose intent is cc; it is 00 when dd does not belong to cc. The users are assumed to have one intent each, and given the intent, the documents satisfy them independently. The probability that a set SS satisfies the user is

P(S∣q)=∑c∈CP(c∣q)(1−∏d∈S(1−V(d∣q,c))),P(S \mid q) = \sum_{c \in C} P(c \mid q) \Big(1 - \prod_{d \in S} \big(1 - V(d \mid q, c)\big)\Big),

and the task is to find SS with ∣S∣=k|S| = k that maximizes it. Agrawal et al. prove that this is NP-hard by a reduction from maximum coverage: with uniform P(c∣q)P(c \mid q) and values 00 or 11, P(S∣q)P(S \mid q) is the fraction of the categories that SS covers.

The algorithm

IA-Select keeps U(c)U(c), the probability that the intent is cc and no chosen document satisfies it. The gain of a document is the expected number of these still unsatisfied users that it satisfies:

  1. IA-SELECT(D, P, V, k)
  2. 1for each category c: U(c) ← P(c | q)
  3. 2S ← empty list
  4. 3while some document is not in S and |S| < k:
  5. 4for each d not in S, in id order:
  6. 5g(d) ← Σ over c of U(c) · V(d | q, c)
  7. 6b ← the d with the largest g(d), ties to the smaller id; append b to S
  8. 7for each category c of b:
  9. 8U(c) ← (1 − V(b | q, c)) · U(c)
  10. 9return S

The paper calls U(c)U(c) "the conditional probability" that the intent is cc given that the documents so far failed, but line L8 does not renormalize it, and the analysis needs the unnormalized form: U(c)U(c) is a joint probability, and the gain of line L5 is then the exact increase of P(S∣q)P(S \mid q).

Example

Table 1 of the paper has two equally likely intents and three documents:

doc V(⋅∣c1)V(\cdot \mid c_1) V(⋅∣c2)V(\cdot \mid c_2)
d1 0.8 0.8
d2 1 0
d3 0 1
step U(c1)U(c_1) U(c2)U(c_2) g(d1) g(d2) g(d3) pick P(S∣q)P(S \mid q)
1 0.5 0.5 0.8 0.5 0.5 d1 0.8
2 0.1 0.1 0.1 0.1 d2 0.9
3 0 0.1 0.1 d3 1.0

For k=1k = 1 the greedy choice d1 is optimal. For k=2k = 2 the greedy list d1, d2 has value 0.90.9, while d2 and d3 together reach 1.01.0. So no single ordering is optimal for every kk, and the greedy result can be below the optimum. The loss here, 0.90.9 against 1.01.0, is well inside the bound 1−1/e≈0.6321 - 1/e \approx 0.632. Section 3.7 of the paper works a larger example with intents of probability 0.70.7 and 0.30.3 over ten documents.

Correctness

The file proofs/correctness.md proves the guarantees. Line L8 keeps the invariant U(c)=P(c∣q)∏d∈S(1−V(d∣q,c))U(c) = P(c \mid q) \prod_{d \in S} (1 - V(d \mid q, c)), so the gain of line L5 equals P(S∪{d}∣q)−P(S∣q)P(S \cup \{d\} \mid q) - P(S \mid q). The marginal gain is a sum of products of numbers in [0,1][0, 1], and adding documents only adds factors, so the objective is monotone and submodular, with value 00 on the empty set. The theorem of Nemhauser, Wolsey and Fisher then gives

P(Sgreedy∣q)≥(1−(1−1k)k)max⁡∣S∣=kP(S∣q)≥(1−1e)max⁡∣S∣=kP(S∣q).P(S_{\text{greedy}} \mid q) \ge \Big(1 - \big(1 - \tfrac{1}{k}\big)^k\Big) \max_{|S| = k} P(S \mid q) \ge \Big(1 - \frac{1}{e}\Big) \max_{|S| = k} P(S \mid q).

The paper's Theorem 2 states this for "a submodular set function"; the bound also needs monotonicity and f(∅)=0f(\emptyset) = 0, which this objective has. When each document belongs to only one category, IA-Select is optimal for every kk (Theorem 1 of the paper). The reduction from maximum coverage and the max coverage inapproximability result mean that no polynomial-time algorithm can guarantee a better constant unless P = NP.

Proof: IA-Select is greedy on a monotone submodular objective, so it is a (1 - 1/e) approximationfull

Let CC be a finite set of categories (intents) with P(c∣q)≥0P(c \mid q) \ge 0 and ∑cP(c∣q)=1\sum_c P(c \mid q) = 1, and let DD be a finite set of documents with values V(d∣q,c)∈[0,1]V(d \mid q, c) \in [0, 1], taken as 00 when cc is not a category of dd. Write P(c)P(c) and V(d,c)V(d, c) for short. For S⊆DS \subseteq D define

f(S)=P(S∣q)=∑c∈CP(c)(1−∏d∈S(1−V(d,c))),f(S) = P(S \mid q) = \sum_{c \in C} P(c) \Big(1 - \prod_{d \in S} \big(1 - V(d, c)\big)\Big),

the objective of Agrawal et al. (Equation 1 of their paper). The task is to find SS with ∣S∣=k|S| = k that maximizes ff.

Lemma 1 (invariant). Before each pass of the loop of line L3, with SS the set of documents chosen so far, U(c)=P(c)∏d∈S(1−V(d,c))U(c) = P(c) \prod_{d \in S} (1 - V(d, c)) for every cc.

Proof. Line L1 sets U(c)=P(c)U(c) = P(c), the empty product. Lines L7 and L8 multiply U(c)U(c) by 1−V(b,c)1 - V(b, c) for the new document bb and each category of bb; for the other categories the factor would be 11. □\square

So U(c)U(c) is the probability that the intent is cc and no chosen document satisfies it. It is not a conditional probability: in the example of the paper, 0.70.7 becomes 0.350.35 and is not renormalized.

Lemma 2 (the gain is the marginal gain). Line L5 computes g(d)=f(S∪{d})−f(S)g(d) = f(S \cup \{d\}) - f(S).

Proof. For each cc, adding dd multiplies the product of ff by 1−V(d,c)1 - V(d, c), so the term of cc grows by P(c)∏d′∈S(1−V(d′,c))⋅V(d,c)=U(c)V(d,c)P(c) \prod_{d' \in S} (1 - V(d', c)) \cdot V(d, c) = U(c) V(d, c) by Lemma 1. Summing over the categories of dd gives line L5. □\square

Lemma 3 (the objective). f(∅)=0f(\emptyset) = 0, ff is monotone, and ff is submodular: for A⊆B⊆DA \subseteq B \subseteq D and d∉Bd \notin B, f(A∪{d})−f(A)≥f(B∪{d})−f(B)≥0f(A \cup \{d\}) - f(A) \ge f(B \cup \{d\}) - f(B) \ge 0.

Proof. The empty product is 11, so f(∅)=0f(\emptyset) = 0. By Lemma 2 the marginal gain at SS is ∑cP(c)V(d,c)∏d′∈S(1−V(d′,c))\sum_c P(c) V(d, c) \prod_{d' \in S} (1 - V(d', c)). Every factor lies in [0,1][0, 1], so the gain is at least 00, and each product over BB is the product over AA times more factors in [0,1][0, 1], so it is no larger. □\square

Agrawal et al. state the theorem of Nemhauser, Wolsey and Fisher (their Theorem 2) for "a submodular set function". The guarantee needs more: the function must also be monotone with f(∅)=0f(\emptyset) = 0. Lemma 3 shows that ff has both properties, so the conclusion holds here.

Theorem 4 (approximation). If ∣D∣≥k|D| \ge k, the set GG that IA-Select returns satisfies f(G)≥(1−(1−1/k)k)f(O)≥(1−1/e) f(O)f(G) \ge \big(1 - (1 - 1/k)^k\big) f(O) \ge (1 - 1/e)\, f(O) for every O⊆DO \subseteq D with ∣O∣=k|O| = k. If ∣D∣<k|D| < k, it returns DD, which is optimal.

Proof. The scan of lines L4 to L6 keeps a document with the largest value of line L5, so by Lemma 2 each pick bi+1b_{i+1} maximizes the marginal gain over the remaining documents, whatever the tie rule. Let GiG_i be the first ii picks and O={o1,…,ok}O = \{o_1, \ldots, o_k\}. By monotonicity and submodularity (Lemma 3),

f(O)≤f(Gi∪O)≤f(Gi)+∑j=1k(f(Gi∪{oj})−f(Gi))≤f(Gi)+k (f(Gi+1)−f(Gi)),f(O) \le f(G_i \cup O) \le f(G_i) + \sum_{j=1}^{k} \big(f(G_i \cup \{o_j\}) - f(G_i)\big) \le f(G_i) + k\, \big(f(G_{i+1}) - f(G_i)\big),

where the middle step adds the elements of OO one at a time and bounds each gain by its gain at GiG_i, and the last step uses that bi+1b_{i+1} has the largest gain (a document of OO already in GiG_i has gain 00). So f(O)−f(Gi+1)≤(1−1/k)(f(O)−f(Gi))f(O) - f(G_{i+1}) \le (1 - 1/k)(f(O) - f(G_i)). From f(G0)=0f(G_0) = 0, f(O)−f(Gk)≤(1−1/k)kf(O)≤e−1f(O)f(O) - f(G_k) \le (1 - 1/k)^k f(O) \le e^{-1} f(O). If ∣D∣<k|D| < k, every set of at most kk documents is a subset of DD, and f(D)f(D) is the largest value by monotonicity. □\square

The test file checks Theorem 4 against the optimum over all kk-subsets on random instances.

Theorem 5 (one category per document). If every document has at most one category with a positive value, IA-Select is optimal for every kk.

Proof. Group the documents by category, and inside category cc sort them by value, vc,1≥vc,2≥⋯v_{c,1} \ge v_{c,2} \ge \cdots. Taking the ii-th document of cc after the first i−1i - 1 adds hc,i=P(c) vc,i∏l<i(1−vc,l)h_{c,i} = P(c)\, v_{c,i} \prod_{l < i}(1 - v_{c,l}), and hc,i≤hc,i−1h_{c,i} \le h_{c,i-1} because vc,i≤vc,i−1v_{c,i} \le v_{c,i-1} and 1−vc,i−1≤11 - v_{c,i-1} \le 1. A set that takes jcj_c documents from cc has the value ∑cP(c)(1−∏(1−v))\sum_c P(c)(1 - \prod(1 - v)) over its documents, which is at most ∑c∑i≤jchc,i\sum_c \sum_{i \le j_c} h_{c,i}, because the term of cc grows with each value and is symmetric, so the jcj_c largest values of cc maximize it. So f(O)f(O) is at most the sum of kk entries of the sequences hc,⋅h_{c,\cdot}, taken as prefixes, and since each sequence is non-increasing, at most the sum of the kk largest entries of all sequences together. IA-Select takes, inside each category, the documents in the order of their values, because the gain U(c)V(d,c)U(c) V(d, c) has the same U(c)U(c) for all documents of cc. So at each step its gain is the largest head among the sequences, and kk steps of taking the largest head of non-increasing sequences give the kk largest entries. So f(G)f(G) reaches the bound. □\square

Agrawal et al. state this result as their Theorem 1 and Corollary 1.

Lemma 6 (hardness). Maximizing ff under ∣S∣=k|S| = k is NP-hard.

Proof. Given an instance of maximum coverage, with ground set CC and sets DD, let P(c)=1/∣C∣P(c) = 1/|C| and V(d,c)=1V(d, c) = 1 if c∈dc \in d and 00 otherwise. Then f(S)f(S) is the fraction of CC covered by SS, so an optimal SS for ff solves the coverage instance. □\square

This is the reduction of Lemma 1 of Agrawal et al. With max coverage inapproximability, no polynomial-time algorithm has a better constant than 1−1/e1 - 1/e unless P = NP.

Greedy is not always optimal. Table 1 of the paper: P(c1)=P(c2)=0.5P(c_1) = P(c_2) = 0.5, V(d1,⋅)=(0.8,0.8)V(d_1, \cdot) = (0.8, 0.8), V(d2,⋅)=(1,0)V(d_2, \cdot) = (1, 0), V(d3,⋅)=(0,1)V(d_3, \cdot) = (0, 1). The first pick is d1d_1 with gain 0.80.8, against 0.50.5 for the others. Then U=(0.1,0.1)U = (0.1, 0.1), both remaining documents gain 0.10.1, and the tie rule gives d2d_2, so f({d1,d2})=0.9f(\{d_1, d_2\}) = 0.9, while f({d2,d3})=1f(\{d_2, d_3\}) = 1. Here 0.9≥(1−1/e)⋅1≈0.6320.9 \ge (1 - 1/e) \cdot 1 \approx 0.632, as Theorem 4 requires.

Cost. Let n=∣D∣n = |D|, m=∣C∣m = |C| and e=∑d∣{c:V(d,c)>0}∣≤nme = \sum_d |\{c : V(d, c) > 0\}| \le nm. Each of the kk passes computes nn gains in O(e)O(e) total time and updates at most mm values, so IA-Select runs in O(nlog⁡n+ke)=O(nlog⁡n+nmk)O(n \log n + k e) = O(n \log n + nmk) time with O(n+m)O(n + m) extra space.

Complexity

Each of the at most kk passes computes nn gains, each a sum over the categories of a document, and updates at most mm values of UU. With at most mm categories per document the time is O(nlog⁡n+nkm)O(n \log n + nkm), including the sort of the ids, and with sparse values it is O(nlog⁡n+k(n+e))O(n \log n + k(n + e)), where ee is the number of nonzero values. The extra space is O(n+m)O(n + m). Lazy evaluation with a priority queue of stale gains, which is valid for any submodular objective, usually cuts the number of gain computations a lot.

Properties

  • Explicit. It needs a set of intents, their probabilities and per-intent values, for example from a query classifier and per-intent relevance scores.
  • Monotone submodular objective. Every pick has a non-negative gain, and the gain of a document never grows as the list grows.
  • Approximation. At least 1−1/e1 - 1/e of the optimum for every kk, and optimal when each document has one category.
  • Not a ranking by relevance. Once an intent is well served, its documents drop in gain, so a highly relevant document can fall below a weaker document of another intent. This breaks the assumptions of the probability ranking principle on purpose.
  • Deterministic. The tie rule fixes the output.

Variants and improvements

  • Intent-aware measures. The same paper defines NDCG-IA, MAP-IA and MRR-IA: a measure is computed for each intent with the judgments of that intent and averaged with the weights P(c∣q)P(c \mid q). See nDCG and mean reciprocal rank for the base measures, and alpha-nDCG for a related measure of novelty and coverage.
  • xQuAD. xQuAD adds the relevance P(d∣q)P(d \mid q) to the same coverage term, with a weight λ\lambda, and takes its aspects from query reformulations.
  • Max coverage. With values 00 and 11, IA-Select is greedy max coverage with weights on the elements.
  • Ranked lists. The objective ignores the order inside SS. For a ranking, one runs the loop with kk equal to the length of the list and uses the order of the picks, which is what the test collections evaluate.

When to use it

Use IA-Select when you have a taxonomy of intents and a classifier that gives each query a distribution over them, and when you want to maximize the chance that every likely intent finds a good result near the top. If the intents come from query reformulations, or if you want to keep more of the first ranking, xQuAD is the closer fit; if you have no intents at all, MMR needs only a similarity function. The gains reported for IA-Select in the paper and in later comparisons are measurements on particular data sets and intent models.

Pitfalls

  • The values must be probabilities. The guarantee and the meaning of UU need V(d∣q,c)∈[0,1]V(d \mid q, c) \in [0, 1]. Raw retrieval scores such as BM25 must be calibrated or normalized first. The implementation rejects values outside the range.
  • A bad intent distribution. If P(c∣q)P(c \mid q) is wrong, the algorithm faithfully optimizes the wrong objective. A rare but missing intent gets no document at all.
  • Value 1 stops an intent. A document with V=1V = 1 for an intent sets U(c)U(c) to 0, and no further document of that intent can gain anything. Clipping values below 1 keeps some redundancy.
  • Do not renormalize U. Dividing UU by its sum after each step looks natural, since the paper calls it a conditional probability, but it changes the gains and loses the link to the objective.
  • The bound is on the objective. The 1−1/e1 - 1/e guarantee is about P(S∣q)P(S \mid q) under the model, not about measured user satisfaction.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

ia_select.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ia-select/. The authors are listed in prov/PXB2Y2.jsonl.
"""IA-Select (Agrawal, Gollapudi, Halverson and Ieong, 2009).

The objective of a set S of documents is

    P(S | q) = sum over c of P(c | q) * (1 - prod over d in S of (1 - V(d | q, c))),

the probability that at least one document of S satisfies the user, when
the user's intent c is drawn from P(c | q) and the documents satisfy
independently given c. IA-Select adds documents one by one. It keeps
U(c), the probability that intent c is the intent and is not yet
satisfied, starting from P(c | q), and picks the document with the largest
gain sum over c of U(c) V(d | q, c), which is the exact increase of
P(S | q). Ties go to the smaller id.
"""

from itertools import combinations


def objective(selected, p_cat, value):
    """P(S | q) for the documents in selected."""
    total = 0.0
    for c, p in p_cat.items():
        miss = 1.0
        for d in selected:
            miss *= 1.0 - value[d].get(c, 0.0)
        total += p * (1.0 - miss)
    return total


def ia_select_steps(docs, p_cat, value, k):
    """Return the list of (document, gain at the time it was picked)."""
    for d in docs:
        for c, v in value[d].items():
            if c not in p_cat or not 0.0 <= v <= 1.0:
                raise ValueError("V(d | q, c) must lie in [0, 1] for a known category")
    u = dict(p_cat)  # @line L1
    rest = sorted(set(docs))
    chosen = []  # @line L2
    while rest and len(chosen) < k:  # @line L3
        best, best_gain = None, None
        for d in rest:  # @line L4
            gain = sum(u[c] * v for c, v in value[d].items())  # @line L5
            if best_gain is None or gain > best_gain:  # ties keep the smaller id
                best, best_gain = d, gain
        chosen.append((best, best_gain))  # @line L6
        rest.remove(best)
        for c, v in value[best].items():  # @line L7
            u[c] *= 1.0 - v  # @line L8
    return chosen  # @line L9


def ia_select(docs, p_cat, value, k):
    """Return the documents that IA-Select picks, in order."""
    return [d for d, _ in ia_select_steps(docs, p_cat, value, k)]


def best_subset(docs, p_cat, value, k):
    """The exact optimum over all subsets of size min(k, |docs|), by enumeration."""
    size = min(k, len(docs))
    best, best_val = (), -1.0
    for s in combinations(sorted(docs), size):
        v = objective(s, p_cat, value)
        if v > best_val:
            best, best_val = s, v
    return list(best), best_val
test_ia_select.py 109 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ia-select/. The authors are listed in prov/PXB2Y2.jsonl.

import math
import random

import pytest

from ia_select import best_subset, ia_select, ia_select_steps, objective

TOL = 1e-12
RATIO = 1.0 - 1.0 / math.e

# Table 1 of Agrawal et al. (2009): no single ordering is optimal for every k.
P_TABLE1 = {"c1": 0.5, "c2": 0.5}
V_TABLE1 = {1: {"c1": 0.8, "c2": 0.8}, 2: {"c1": 1.0}, 3: {"c2": 1.0}}


def random_instance(rng, n, m, single=False):
    weights = [rng.random() + 0.01 for _ in range(m)]
    total = sum(weights)
    p_cat = {f"c{i}": w / total for i, w in enumerate(weights)}
    value = {}
    for d in range(1, n + 1):
        cats = list(p_cat)
        if single:
            chosen = [rng.choice(cats)]
        else:
            chosen = [c for c in cats if rng.random() < 0.6] or [rng.choice(cats)]
        value[d] = {c: rng.choice([rng.random(), 1.0, 0.5]) for c in chosen}
    return p_cat, value


def test_greedy_is_not_optimal_on_table_1():
    docs = [1, 2, 3]
    assert ia_select(docs, P_TABLE1, V_TABLE1, 1) == [1]
    greedy = ia_select(docs, P_TABLE1, V_TABLE1, 2)
    assert greedy == [1, 2]
    g = objective(greedy, P_TABLE1, V_TABLE1)
    opt, best = best_subset(docs, P_TABLE1, V_TABLE1, 2)
    assert opt == [2, 3]
    assert math.isclose(g, 0.9, rel_tol=TOL) and math.isclose(best, 1.0, rel_tol=TOL)
    assert g >= RATIO * best


def test_gain_is_the_exact_marginal_gain():
    rng = random.Random(5)
    for _ in range(50):
        p_cat, value = random_instance(rng, rng.randint(1, 9), rng.randint(1, 5))
        docs = list(value)
        prefix = []
        for d, gain in ia_select_steps(docs, p_cat, value, len(docs)):
            before = objective(prefix, p_cat, value)
            prefix.append(d)
            assert math.isclose(gain, objective(prefix, p_cat, value) - before, rel_tol=1e-9, abs_tol=1e-12)
            # The pick maximizes the marginal gain over the remaining documents.
            others = [x for x in docs if x not in prefix]
            for x in others:
                alt = objective(prefix[:-1] + [x], p_cat, value) - before
                assert alt <= gain + 1e-12


@pytest.mark.parametrize("seed", range(150))
def test_at_least_one_minus_one_over_e_of_brute_force(seed):
    rng = random.Random(seed)
    n = rng.randint(1, 9)
    p_cat, value = random_instance(rng, n, rng.randint(1, 5))
    docs = list(value)
    for k in range(0, n + 1):
        greedy = ia_select(docs, p_cat, value, k)
        assert len(greedy) == min(k, n) and len(set(greedy)) == len(greedy)
        g = objective(greedy, p_cat, value)
        _, best = best_subset(docs, p_cat, value, k)
        assert g <= best + TOL
        assert g >= RATIO * best - TOL


@pytest.mark.parametrize("seed", range(60))
def test_optimal_when_each_document_has_one_category(seed):
    rng = random.Random(1000 + seed)
    n = rng.randint(1, 9)
    p_cat, value = random_instance(rng, n, rng.randint(1, 4), single=True)
    docs = list(value)
    for k in range(0, n + 1):
        g = objective(ia_select(docs, p_cat, value, k), p_cat, value)
        _, best = best_subset(docs, p_cat, value, k)
        assert math.isclose(g, best, rel_tol=1e-9, abs_tol=TOL)


def test_random_search_finds_non_optimal_instances():
    rng = random.Random(42)
    gaps = 0
    worst = 1.0
    for _ in range(300):
        p_cat, value = random_instance(rng, 6, 3)
        docs = list(value)
        g = objective(ia_select(docs, p_cat, value, 2), p_cat, value)
        _, best = best_subset(docs, p_cat, value, 2)
        if g < best - 1e-9:
            gaps += 1
            worst = min(worst, g / best)
    assert gaps > 0 and worst >= RATIO


def test_rejects_bad_values():
    with pytest.raises(ValueError):
        ia_select([1], {"c": 1.0}, {1: {"c": 1.5}}, 1)
    with pytest.raises(ValueError):
        ia_select([1], {"c": 1.0}, {1: {"x": 0.5}}, 1)

History

Agrawal, Gollapudi, Halverson and Ieong presented the problem and IA-Select at WSDM 2009 under the title "Diversifying search results". They framed diversification as maximizing the probability that the average user finds at least one useful result, proved the problem NP-hard, showed that the objective is submodular, and applied the 1978 greedy bound of Nemhauser, Wolsey and Fisher. They also defined intent-aware versions of the standard measures. The paper became a reference point for explicit diversification, and xQuAD in 2010 built on the same coverage term.

References

  1. Rakesh Agrawal, Sreenivas Gollapudi, Alan Halverson and Samuel Ieong, Diversifying search results, Proceedings of the Second ACM International Conference on Web Search and Data Mining (WSDM 2009), 5-14, Section 3 (Equation 1, the objective P(S | q)), Section 3.3 (Lemma 1, NP-hardness from Max Coverage, and the instance of Table 1), Section 3.4 (Lemma 2, submodularity), Section 3.5 (Algorithm 1, IA-Select), Section 3.6 (Theorem 1 and Corollary 1, optimality with one category per document; Theorem 2 and Corollary 2, the (1 - 1/e) bound), Section 3.7 (a worked example), Section 4 (NDCG-IA, MAP-IA and MRR-IA)
  2. George L. Nemhauser, Laurence A. Wolsey and Marshall L. Fisher, An analysis of approximations for maximizing submodular set functions, I, Mathematical Programming 14, 265-294, 1978, the bound 1 - (1 - 1/k)^k for the greedy algorithm on a monotone submodular function with f of the empty set equal to 0, under the constraint of at most k elements
  3. Rodrygo L. T. Santos, Craig Macdonald and Iadh Ounis, Exploiting query reformulations for web search result diversification, Proceedings of the 19th International Conference on World Wide Web (WWW 2010), 881-890, Section 2 (the approach of Agrawal et al. as explicit diversification with a taxonomy), Section 5 (a simulated best case of IA-Select with the official TREC 2009 Web track sub-topics as classes) and Section 6 (Table 2, IA-Select as a baseline)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example