Evolve explanations with Thompson item selection and blind local competition.
More...
Evolve explanations with Thompson item selection and blind local competition.
Run the QD-Rec search loop using caller-supplied scoring and generation.
Item embeddings guide the contextual bandit. Separate embeddings of
item-hypothesis pairs determine the archive neighborhood. A novel
recommendation enters the archive directly. Otherwise, a blind
comparison with its nearest neighbor determines replacement.
The bandit observes every scored and fully processed proposal,
including rejected ones.
:param items: Nonempty sequence of distinct hashable item identifiers.
:param item_embeddings: Aligned item embeddings, L2 normalized at construction.
:param neighbors: Number of recommendations passed to the novelty judge.
:param exemplars: Number of archive recommendations passed to the proposer.
:param diversity_weight: Weight of cosine novelty in the item acquisition.
:param prior_precision: Positive isotropic precision of the linear model's prior.
:param noise_variance: Positive observation variance of normalized rewards.
:param selection: "thompson" or "uniform". With zero exemplars, uniform
selection gives the independent proposal control.
:param seed: Private random seed for item selection, exemplars, and comparisons.
Definition at line 68 of file qd_rec.py.
| qdpy.algorithms.qd_rec.QDRec.run |
( |
| self, |
|
|
| propose, |
|
|
| score, |
|
|
| embed, |
|
|
| novel, |
|
|
| compare, |
|
|
* | , |
|
|
| budget, |
|
|
| initial = () ) |
Warm-start from supplied recommendations and spend additional proposal calls.
Return cumulative statistics after a fixed number of proposals.
:param propose: (item, exemplars, rng) -> hypothesis string.
:param score: Recommendation -> quality in [0, 1].
:param embed: Recommendation -> nonzero vector for cosine matching.
:param novel: (candidate, nearest_recommendations) -> Boolean.
:param compare: (first, second) -> index of the preferred recommendation.
The order is randomized and scores are withheld.
:param budget: Number of proposer calls. Duplicates still consume calls.
:param initial: Optional Recommendation seeds, scored separately
and admitted without local competition.
Definition at line 204 of file qd_rec.py.