# Random-sampling mechanism

A random-sampling mechanism (RSM) is a truthful mechanism that uses sampling in order to achieve approximately-optimal gain in prior-free mechanisms and prior-independent mechanisms.
Suppose we want to sell some items in an auction and achieve maximum profit. The crucial difficulty is that we do not know how much each buyer is willing to pay for an item. If we know, at least, that the valuations of the buyers are random variables with some known probability distribution, then we can use a Bayesian-optimal mechanism. But often we do not know the distribution. In this case, random-sampling mechanisms provide an alternative solution.

## RSM in large markets
### Market-halving scheme

When the market is large, the following general scheme can be used:$^{:341–344}$
* The buyers are asked to reveal their valuations.
* The buyers are split to two sub-markets, $M_{L}$ ("left") and $M_{R}$ ("right"), using simple random sampling: each buyer goes to one of the sides by tossing a fair coin.
* In each sub-market $M_{s}$, an empirical distribution function $F_{s}$ is calculated.
* The Bayesian-optimal mechanism (Myerson's mechanism) is applied in sub-market $M_{R}$ with distribution $F_{L}$, and in $M_{L}$ with $F_{R}$.
This scheme is called "Random-Sampling Empirical Myerson" (RSEM).
The declaration of each buyer has no effect on the price he has to pay; the price is determined by the buyers in the other sub-market. Hence, it is a dominant strategy for the buyers to reveal their true valuation. In other words, this is a truthful mechanism.
Intuitively, by the law of large numbers, if the market is sufficiently large then the empirical distributions are sufficiently similar to the real distributions, so we expect the RSEM to attain near-optimal profit. However, this is not necessarily true in all cases. It has been proved to be true in some special cases.
The simplest case is digital goods auction. There, step 4 is simple and consists only of calculating the optimal price in each sub-market. The optimal price in $M_{L}$ is applied to $M_{R}$ and vice versa. Hence, the mechanism is called "Random-Sampling Optimal Price" (RSOP). This case is simple because it always calculates feasible allocations. I.e, it is always possible to apply the price calculated in one side to the other side. This is not necessarily the case with physical goods.
Even in a digital goods auction, RSOP does not necessarily converge to the optimal profit. It converges only under the bounded valuations assumption: for each buyer, the valuation of the item is between 1 and $h$, where $h$ is some constant. The convergence rate of RSOP to optimality depends on $h$. The convergence rate also depends on the number of possible "offers" considered by the mechanism.
To understand what an "offer" is, consider a digital goods auction in which the valuations of the buyers, in dollars, are known to be bounded in $[1,h]$. If the mechanism uses only whole dollar prices, then there are only $h$ possible offers.
In general, the optimization problem may involve much more than just a single price. For example, we may want to sell several different digital goods, each of which may have a different price. So instead of a "price", we talk on an "offer". We assume that there is a global set $G$ of possible offers. For every offer $g\in G$ and agent $i$, $g(i)$ is the amount that agent $i$ pays when presented with the offer $g$. In the digital-goods example, $G$ is the set of possible prices. For every possible price $p$, there is a function $g_{p}$ such that $g_{p}(i)$ is either 0 (if $v_{i}<p$) or $p$ (if $v_{i}\geq p$).
For every set $S$ of agents, the profit of the mechanism from presenting the offer $g$ to the agents in $S$ is:
    $g(S):=\sum _{i\in S}g(i)$
and the optimal profit of the mechanism is:
    $OPT_{G}(S):=\max _{g\in G}g(S)$
The RSM calculates, for each sub-market $M_{s}$, an optimal offer $g_{s}$, calculated as follows:
       $g_{s}:=\arg \max _{g\in G}g(M_{s})$
The offer $g_{L}$ is applied to the buyers in $M_{R}$, i.e.: each buyer $i\in M_{R}$ who said that $g_{L}(i)>0$ receives the offered allocation and pays $g_{L}(i)$; each buyer in $M_{R}$ who said that $g_{L}(i)=0$ do not receive and do not pay anything. The offer $g_{R}$ is applied to the buyers in $M_{L}$ in a similar way.

### Profit-oracle scheme

Profit oracle is another RSM scheme that can be used in large markets. It is useful when we do not have direct access to agents' valuations (e.g. due to privacy reasons). All we can do is run an auction and watch its expected profit. In a single-item auction, where there are $n$ bidders, and for each bidder there are at most $K$ possible values (selected at random with unknown probabilities), the maximum-revenue auction can be learned using:
    $O(n^{2}K^{2})$
calls to the oracle-profit.

## RSM in small markets

RSMs were also studied in a worst-case scenario in which the market is small. In such cases, we want to get an absolute, multiplicative approximation factor, that does not depend on the size of the market.

### Market-halving, digital goods

The first research in this setting was for a digital goods auction with Single-parameter utility.
For the Random-Sampling Optimal-Price mechanism, several increasingly better approximations have been calculated:
* By, the mechanism profit is at least 1/7600 of the optimal.
* By, the mechanism profit is at least 1/15 of the optimal.
* By, the mechanism profit is at least 1/4.68 of the optimal, and in most cases 1/4 of the optimal, which is tight.

### Single-sample, physical goods

When the agents' valuations satisfy some technical regularity condition (called monotone hazard rate), it is possible to attain a constant-factor approximation to the maximum-profit auction using the following mechanism:
* Sample a single random agent and query his value (the agents are assumed to have single-parameter utility).
* On the other agents, run a VCG auction with reserve-price determined by the sampled agent.
The profit of this mechanism is at least ${n-1 \over 4n}$, where $n$ is the number of agents. This is 1/8 when there are two agents, and grows towards 1/4 as the number of agents grows. This scheme can be generalized to handle constraints on the subsets of agents that can win simultaneously (e.g., there is only a finite number of items). It can also handle agents with different attributes (e.g. young vs. old bidders).

## Sample complexity

The sample complexity of a random-sampling mechanism is the number of agents it needs to sample in order to attain a reasonable approximation of the optimal welfare.
The results in imply several bounds on the sample-complexity of revenue-maximization of single-item auctions:
* For a $1/4$-approximation of the optimal expected revenue, the sample-complexity is $1$ - a single sample suffices. This is true even when the bidders are not i.i.d.
* For a $1-\epsilon$-approximation of the optimal expected revenue, when the bidders are i.i.d OR when there is an unlimited supply of items (digital goods), the sample-complexity is $O(1/\epsilon ^{2})$ when the agents' distributions have monotone hazard rate, and $O(1/\epsilon ^{3})$ when the agents' distributions are regular but do not have monotone-hazard-rate.
The situation becomes more complicated when the agents are not i.i.d (each agent's value is drawn from a different regular distribution) and the goods have limited supply. When the agents come from $k$ different distributions, the sample complexity of $1-\epsilon$-approximation of the optimal expected revenue in single-item auctions is:
* at most $O({k^{10} \over \epsilon ^{7}}\ln ^{3}{k \over \epsilon })$ - using a variant of the empirical Myerson auction.
* at least $\Omega ({k \over {\sqrt {\epsilon \ln k}}})$ (for monotone-hazard-rate regular valuations) and at least $\Omega ({k \over \epsilon })$ (for arbitrary regular valuations).
discuss arbitrary auctions with single-parameter utility agents (not only single-item auctions), and arbitrary auction-mechanisms (not only specific auctions). Based on known results about sample complexity, they show that the number of samples required to approximate the maximum-revenue auction from a given class of auctions is:
    $O{\bigg({H \over \epsilon })^{2}(D\ln({H \over \epsilon })+\ln({1 \over \delta })){\bigg )}$
where:
* the agents' valuations are bounded in $[1,H]$,
* the pseudo-VC dimension of the class of auctions is at most $D$,
* the required approximation factor is $1-\epsilon$,
* the required success probability is $1-\delta$.
In particular, they consider a class of simple auctions called $t$-level auctions: auctions with $t$ reserve prices (a Vickrey auction with a single reserve price is a 1-level auction). They prove that the pseudo-VC-dimension of this class is $O(nt\ln(nt))$, which immediately translates to a bound on their generalization error and sample-complexity. They also prove bounds on the representation error of this class of auctions.

## Envy

A disadvantage of the random-sampling mechanism is that it is not envy-free. E.g., if the optimal prices in the two sub-markets $M_{L}$ and $M_{R}$ are different, then buyers in each sub-market are offered a different price. In other words, there is price discrimination. This is inevitable in the following sense: there is no single-price strategyproof auction that approximates the optimal profit.