Limit points of the iterative scaling procedure

Erik Aas

Abstract

The iterative scaling procedure (ISP) is an algorithm which computes a sequence of matrices, starting from some given matrix. The objective is to find a matrix ’proportional’ to the given matrix, having given row and column sums. In many cases, for example if the initial matrix is strictly positive, the sequence is convergent. It is known that the sequence has at most two limit points. When these are distinct, convergence to these two points can be slow. We give an efficient algorithm which finds the limit points, invoking the ISP only on subproblems for which the procedure is convergent.

Introduction

The iterative scaling procedure (ISP) is an algorithm which, given an m × n entrywise nonnegative matrix A and positive numbers r_{1}, …, r_{m}, c_{1}, …, c_{n} attempts to find a matrix diagonally equivalent to A, having row sums r_{i} and column sums c_{j}. Two matrices A and A′ are diagonally equivalent if there are strictly positive numbers x_{1}, …, x_{m}, y_{1}, …, y_{n} such that a_{ij} = x_{i}a′_{ij}y_{j} for all i, j.

The ISP has been applied in a variety of contexts, the most interesting of which perhaps being the ranking of webpages [3]. A discrete version of the algorithm is used by the Zürich City Council to distribute seats in parliamentary elections [5].

We proceed by defining the ISP. Throughout, A will denote a fixed nonnegative m × n matrix, and r_{1}, …, r_{m}, c_{1}, …, c_{n} fixed positive numbers. We occasionally think of the r_{i} and c_{j} as functions; thus r_{i} and r(i) denote the same thing. We further assume that there is no row or column in A containing only zeros. All matrices considered will be nonnegative entry by entry and denoted by capital letters. Matrix entries will be denoted by the corresponding lower case letters. For example, the (i, j) entry in A is denoted a_{ij}. By the row adjustment (to r_{1}, …, r_{m}) R(A) of A we mean the matrix whose (i, j) entry is x_{i}a_{ij}, where row multiplier x_{i} is defined as x_{i} = \frac{r_{i}}{∑_{j} a_{ij}}. We define the column adjustment C(A), and column multipliers y_{j} (to c_{1}, …, c_{n}) similarly. Note that R(A) = A = C(A) in case A has both the desired row and column sums.

The iterative scaling procedure consists of adjusting rows and columns alternatingly, starting with A. The iterates under the scaling procedure are defined to be

B(k + 1) := R(C(k)),

and

C(k) = C(B(k))

for k ≥ 1 and B(1) = R(A).

It is known that the sequences B(k) and C(k) are convergent [1], and that if there is any matrix D with both the desired row sums and column sums, with the property that a_{ij} = 0 ⇒ d_{ij} = 0, then those two limits are equal ([1], see also [4]). If there is no such matrix D, the limits can clearly not be equal. In fact, if the limits are not equal, but ∑_{i} r_{i} = ∑_{j} c_{j}, then the support of the limit points are not equal to the support of the initial matrix, that is, some entries in the matrix tend to zero during the ISP. The objective of this note is to describe an algorithm which finds these entries efficiently (in time less than quadratic in input size - using the ISP itself to find these entries can require arbitrarily many steps, though not on realistic instances). Proving that the algorithm works is non-trivial, and gives some insight into the structure of the limit points.

We will use the following observation in what follows. If we scale the desired row sums by a common factor t, then this gives new ISP sequence B′(k), C′(k) closely related to the original sequence; we have B′(k) = tB(k) and C′(k) = C(k) for all k ≥ 1.

Acknowledgements I am very thankful to Fabian Reffel who read an early version of this note, finding a serious error and providing many helpful suggestions. I also thank Kai-Friedrike Oelbsmann and the Augsburg group headed by Prof. Friedrich Pukelsheim for telling me about the present problem and electoral methods in general.

An example

We choose the following initial data, writing the desired row and column sums on the borders of the matrix A.

4 4 2 1
6 1 0 0 0
6 1 1 0 0
4 1 1 7 2
1 1 1 9 6

After 1000 iterations we get the following matrices:

B(500) = ( \begin{matrix}6 & 0 & 0 & 0 \\ 0.171 & 5.83 & 0 & 0 \\ 0.00907 & 0.309 & 2.61 & 1.08 \\ 0.00132 & 0.0447 & 0.486 & 0.468 \end{matrix} ) and

C(500) = ( \begin{matrix}3.88 & 0 & 0 & 0 \\ 0.111 & 3.77 & 0 & 0 \\ 0.00587 & 0.2 & 1.69 & 0.697 \\ 0.000851 & 0.0289 & 0.314 & 0.303 \end{matrix} ) .

The actual (to three decimal places) limit matrices are

B = ( \begin{matrix}6 & 0 & 0 & 0 \\ 0 & 6 & 0 & 0 \\ 0 & 0 & 2.83 & 1.17 \\ 0 & 0 & 0.508 & 0.492 \end{matrix} ) and C = ( \begin{matrix}4 & 0 & 0 & 0 \\ 0 & 4 & 0 & 0 \\ 0 & 0 & 1.7 & 0.705 \\ 0 & 0 & 0.305 & 0.295 \end{matrix} ) .

Now we give some further examples which will be useful when reading the next sections, using notation and terminology introduced there.

We have Ψ(B) = (I_{1}, J_{1}) where I_{1} = {1, 2}, J_{1} = {1, 2}. One can check that we have φ(A, r, c) = Ψ(B) in this case, as expected.

In step I of the algorithm, we find the splitting consisting of the blocks (I_{1}, J_{1}) and (I_{2}, J_{2}) where I_{2} = {3, 4} and J_{2} = {3, 4}.

In step II applied to the block (I_{1}, J_{1}) we find the subset I_{3} = {1} ⊆ I_{1} with the property r(I_{3}) = 6 = \frac{12}{8} 4 = \frac{r(I_{1})}{c(J_{1})} c(N(I_{3}) ∩ J_{1}). So the result of applying step II to (I_{1}, J_{1}) is (I_{3}, J_{3}) and (I_{4}, J_{4}) := (I_{1}\I_{3}, J_{1}\J_{3}). Applying step II to any of the blocks (I_{2}, J_{2}), (I_{3}, J_{3}) or (I_{4}, J_{4}) yields nothing new, so the final splitting found is {(I_{2}, J_{2}), (I_{3}, J_{3}), (I_{4}, J_{4})}, which coincides with the decomposition of B.

Limit points

Let (for the remainder of this note) B, C denote the limits of the sequences B(k), C(k).

By a splitting S we mean a set of pairs (I, J) of sets of row respectively column indices, with the property that the sets {I : ∃J : (I, J) ∈ S} form a partition of some underlying set of rows (which will always be the set of rows of A below) and a similar statement holds for the sets J. We call any pair I, J of rows respectively columns a block. An elementary refinement of a splitting consists of replacing a pair (I, J) with (I_{1}, J_{1}) and (I_{2}, J_{2}) such that I_{1}, I_{2} partition I and J_{1}, J_{2} partition J. If the splitting S′ is obtained by performing a sequence of elementary refinements on the splitting S then we say that S′ is a refinement of S.

By the decomposition of a matrix B we will mean the splitting I_{1}, …, I_{r}, J_{1}, …, J_{r} of the row and column sets of B such that b_{ij} ≠ 0 ⇒ i ∈ I_{k} and j ∈ J_{k} for some k, minimal with respect to refinement.

In this section we will describe the decomposition of B. Since the decomposition of B and of C coincide, we will only mention the decomposition of B in what follows.

Let S(A) := {(i, j) : a_{ij} ≠ 0} denote the support of A. By definition, S(A) = S(R(A)) = S(C(A)). Clearly S(B) = S(C) ⊆ S(A), C(B) = C, and R(C) = B.

For subsets of rows I, define r(I) := ∑_{i∈I} r_{i} and c(J) similarly for subsets J of columns.

Let x_{i} and y_{j} be such that x_{i}b_{ij} = c_{ij} and c_{ij}y_{j} = b_{ij}. Hence x_{i}b_{ij}y_{j} = b_{ij} and thus x_{i}y_{j} = 1 whenever (i, j) ∈ S(B). Let I_{1}, …, I_{r}, J_{1}, …, J_{r} be the decomposition of B. Then x_{i} is constant for i ∈ I_{k} for each k and y_{j} is constant in J_{k} for each k, and if i ∈ I_{k}, j ∈ J_{k} we have x_{i} = 1/y_{j} = \frac{r(I_{k})}{c(J_{k})} .

First, note that for each k, the submatrix B[I_{k}, J_{k}] is a matrix with row sums r_{i} and column sums \frac{r(I_{k})}{c(J_{k})} c_{j}. Similarly, C[I_{k}, J_{k}] has column sums c_{j}

and row sums \frac{c(J_{k})}{r(I_{k})} r_{i}. Whenever k ≠ l, we have B[I_{k}, J_{l}] = C[I_{k}, J_{l}] = 0.

We will say a block (I, J) is feasible if there is some I × J matrix M with row sums r_{i}, column sums \frac{r(I)}{c(J)} c_{j} and S(M) ⊆ S(A). A splitting is feasible if all its blocks are feasible. So the decomposition of B is clearly feasible.

The quotient of a block (I, J) is the number r(I)/c(J).

The first block

We now give some definitions and lemmas needed for describing the algorithm.

Lemma 1. Let p_{1}, …, p_{n}, q_{1}, …, q_{n} be positive real numbers. Then min_{i} \frac{p_{i}}{q_{i}} ≤ \frac{p_{1}+···+p_{n}}{q_{1}+···+q_{n}} ≤ max_{i} \frac{p_{i}}{q_{i}}. If any of the two inequalities is in fact an equality, then all the p_{i}/q_{i} are equal.

Proof. This follows by induction, the case n = 2 being easy.

It is important to note that min_{i} p_{i}/ max_{j} p_{j} ≤ (p_{1} + ⋯ + p_{n})/(q_{1} + ⋯ + q_{n}) is a considerably weaker statement than Lemma 1.

We will use the following simple generalization of a well-known theorem by Philip Hall (see eg. [2]).

Lemma 2. Suppose r_{1} + ⋯ + r_{m} = t(c_{1} + ⋯ + c_{n}) where t is some positive real number. There is a matrix B with S(B) ⊆ S(A) and row sums r_{i} and column sums tc_{j} if and only if there is no subset I of rows such that r(I) > tc(N(I)), where N(I) = {j ∈ [n] : ∃i : a_{ij} ≠ 0}.

For initial data A, r, c, we define a subset φ(A, r, c) of rows. In fact φ(A, r, c) will depend only on the support of A, and not on the non-zero values themselves.

We define φ(A, r, c) as the subset I of rows such that r(I)/c(N(I)) is maximal and #I is maximal among those I maximizing r(I)/c(N(I)). Let us prove that φ(A, r, c) is well defined.

Lemma 3. If I_{1} and I_{2} satisfy the definition of φ(A, r, c), then I_{1} = I_{2}.

Proof. We have r(I_{1}) + r(I_{2}) = r(I_{1} ∪ I_{2}) + r(I_{1} ∩ I_{2}) and c(N(I_{1})) + c(N(I_{2})) = c(N(I_{1})∪N(I_{2}))+c(N(I_{1})∩N(I_{2})) ≥ c(N(I_{1} ∪I_{2}))+c(N(I_{1} ∩ I_{2})). Therefore

\frac{r(I_{1}) + r(I_{2})}{c(N(I_{1})) + c(N(I_{2}))} ≤ \frac{r(I_{1} ∪ I_{2}) + r(I_{1} ∩ I_{2})}{c(N(I_{1} ∪ I_{2})) + c(N(I_{1} ∩ I_{2}))} .

By Lemma 1 either I_{1} ∪ I_{2} or I_{1} ∩ I_{2} shows that neither I_{1} nor I_{2} can satisfy the definition of φ(A, r, c).

Using linear programming, it is easy to compute φ(A, r, c).

Though it will follow from proposition 1, it is interesting to note that we can prove directly that (I, N(I)) is feasible, where I = φ(A, r, c).

Lemma 4. Let I = φ(A, r, c). Then the block (I, N(I)) is feasible.

Proof. Suppose (I, N(I)) is not feasible. By Lemma 2 there is then some I′ ⊆ I such that r(I′) > \frac{r(I)}{c(N(I))} c(N(I′)), or \frac{r(I′)}{c(N(I′))} > \frac{r(I)}{c(N(I))} . But this contradicts the choice of I.

Consider the decomposition D′ of B and denote by Ψ(B) the block obtained by merging all blocks with maximal quotient into a single block (which will have this same quotient). We will denote by D the splitting obtained from D′ after this merge. Of course, the blocks in D are all feasible (since this is true for D′). Proposition 1. Let I = φ(A, r, c). We have (I, N(I)) = Ψ(B).

Proof. Let (I_{1}, J_{1}) = Ψ(B). We wish to prove that I_{1} = I and J_{1} = N(I). We do this in two steps.

• J_{1} = N(I_{1}): Suppose this is not the case. Then there are p ∈ I_{1}, q ∉ J_{1} such that a_{pq} ≠ 0. Denote by (I_{2}, J_{2}) the block in the decomposition of B such that q ∈ J_{2}. Let y_{j}(k) be the column multipliers used when computing C(B(k)) = C(k) and x_{i}(k) the row multipliers used when computing R(C(B(k))) = B(k + 1). We know that x_{p}(k) → \frac{r(I_{1})}{c(J_{1})} and y_{q}(k) →

\frac{c(J_{2})}{r(I_{2})} as k → ∞. Therefore x_{p}(k)y_{q}(k) → \frac{r(I_{1})}{c(J_{1})} \frac{c(J_{2})}{r(I_{2})} > 1. Choose η > 0 and K such that x_{p}(k)y_{q}(k) > 1 + η for all k ≥ K. Hence b_{pq}(K + n) > (1 + η)^{n}b_{pq}(K) → ∞ as n → ∞. This contradicts the fact that all entries in the B(k) are bounded by max(r_{1} + ⋯ + r_{m}, c_{1} + ⋯ + c_{n}).

• I = I_{1}:

By the previous step and the definition of I it suffices to show that I ⊆ I_{1}. It follows from the previous step that r(I)/c(N(I)) ≥ r(I_{1})/c(J_{1}). Let (I′, J′) ∈ D. We first show that r(I ∩ I′)/c(N(I ∩ I′) ∩ J′) ≤ r(I′)/c(J′). Suppose not. Then N(I ∩ I′) ∩ J′ ≠ J′, since otherwise r(I ∩ I′)/c(N(I ∩ I′) ∩ J′) = r(I ∩ I′)/c(J′) ≤ r(I′)/c(J′). Let I′′ = I ∩ I′. By lemma ? the subblock (I′′, N(I′′) ∩ J′) of (I′, J′) shows that (I′, J′) is not feasible, a contradiction. Note that

\frac{r(I)}{c(N(I))} = \frac{∑_{(I′,J′)} r(I ∩ I′)}{∑_{(I′,J′)} c(N(I) ∩ J′)} ≤ \frac{∑_{(I′,J′)} r(I ∩ I′)}{∑_{(I′,J′)} c(N(I ∩ I′) ∩ J′)} (1)

where the sums range over all (I′, J′) ∈ D with I ∩ I′ ≠ ∅. Since I_{1}, J_{1} has maximal quotient in D, for any (I′, J′) ∈ D, r(I ∩ I′)/c(N(I∩I′)∩J′) ≤ r(I′)/c(J′) ≤ r(I_{1})/c(J_{1}) ≤ r(I)/c(N(I)). By the formula above and Lemma 1, all the numbers r(I ∩ I′)/c(N(I ∩ I′) ∩ J′) therefore have to be equal, and this common value is r(I)/c(N(I)). Now, suppose r(I_{1})/c(N(I_{1})) < r(I)/c(N(I)). Take any term (I′, J′) in (1). We then have \frac{r(I∩I′)}{c(N(I∩I′)∩J′)} = \frac{r(I)}{c(N(I))} > \frac{r(I_{1})}{c(J_{1})} ≥ \frac{r(I′)}{c(J′)} . But by Lemma 2, this contradicts (I′, J′) being feasible. So r(I_{1})/c(N(I_{1})) = r(I)/c(N(I)). Using a similar argument as in the previous paragraph, if we have any I′ ≠ I occurring in (1), then this will contradict (I′, J′) being feasible. Thus the only term in (1) is \frac{r(I∩I_{1})}{c(N(I∩I_{1})∩J_{1})} , and consequently I ⊆ I_{1}.

The algorithm

The algorithm consists of two steps, I and II. We first describe step I.

The output of step I is the splitting given by the blocks (I_{1}, J_{1}), …, (I_{r}, J_{r}) where (I_{1}, J_{1}) = φ(A, r, c), (I_{2}, J_{2}) = φ(A[I′, J′], r_{|I′}, c_{|J′}) with I′ = [m] − I, J′ = [n] − J and so on. Here we think of r and c as functions, and r_{|I′} et.c. denotes restriction.

It follows from Lemma 1 that the decomposition of B is a refinement of the splitting S obtained in step I.

Step II consists of finding this refinement. This is implicit already in the work of Pretzel [4], but we give a description here for completeness. It is sufficient to describe step II for a single block of S, which we assume to be all of A for ease of notation. Using linear programming we can determine whether there is a proper subset I ⊆ [m] such that r(I) = \frac{r([m])}{c([n])} c(N(I)). In case there are none, the output is just the original block. In case there is such a block I, we output (I, N(I)) and ([m]−I, [n]−N(I)) and apply step II recursively to these two blocks.

To show that this indeed generates D, it is sufficient to prove the following lemma, where we have assumed r([m]) = c([n]) for ease of notation.

Lemma 5. If the only I satisfying r(I) ≥ c(N(I)) are I = ∅ and [m], then S(A) = S(B).

Proof. Suppose (p, q) ∈ S(B)\S(A). By theorem 1 in [4], the support of B is the largest possible among all matrices B′ with row sums r_{i} column sums c_{j} and satisfying S(B′) ⊆ S(A).

Therefore, for any ε > 0, there is no matrix with support a subset of S(A), row sums r′_{i} and column sums c′_{j}, where r′_{i} = r_{i} for i ≠ p, r′_{i} = r_{i} −ε and c′_{j} = c_{j} for j ≠ q and c′_{q} = c_{q} − ε. By lemma 2, this means there is some proper subset I′ = I′(ε) of rows such that r′(I′) > c′(N(I′)). Letting ε → 0 (and observing that the number of possible subsets I′ is finite) this gives us a proper subset I′ with r(I′) = c(N(I′)), a contradiction.

Now, again referring to [4], if change A by setting the entries in S(A)\S(B) to 0, the ISP limit points will not change. However numerical experiments suggest that convergence is much quicker than without the change.

As a small example of this, take the matrix from the example above, set the entries outside the splitting found ((1, 3), (1, 4), (2, 1), (2, 3), and (2, 4)) to zero. Then it takes about 3 iterations to get as close to (B, C) in the example, as B(500) and C(500) from earlier are from (B, C).

Future work

I would like to mention some related extensions and problems.

First, most results above seem to carry over to the much more general setting of Theorem 5.2 in [1], but I have not explored this further.

Second, there is a natural version of the ISP with continuous time, as follows. Let ϑ ∈ [0, 1], and define R_{ϑ}(A)_{ij} = x_{i}^{ϑ}A_{ij}, and C_{ϑ}(A)_{ij} = A_{ij}y_{j}^{ϑ}. Now we can define F_{α,β} = R_{α}C_{β}, and ask about the properties of lim_{ε→0} lim_{n→∞} F_{αε,βε}^{(n)}(A). The matrix F_{α,β}(A) will be diagonally equivalent to A and from this it follows (cf. [4]) that the limit lim_{ε→0} lim_{n→∞} F_{αε,βε}^{(n)}(A) will be the same as the ordinary ISP limit of A if the latter exists. It is not clear what happens in the general case when that limit does not exist.

Finally, the ISP can of course be defined for arbitrary, not necessarily nonnegative, A, r, c. Two issues arise in this case. One problem is that we may obtain matrices having marginals equal to 0 during the iteration. This could probably be avoided by using the continuous version described above; it seems reasonable such a system would repel from matrices having some marginal close to 0. Also, it will not be possible to prove the analogous statements about the limit points, since they are not true. For example, applying ISP (with discrete time) to the initial data

\begin{aligned}& 4 & 6 \\ 13 & 1 & 2 \\ −12 & 3 & 4 \end{aligned}

gives a sequence with period 4. This cycle appears to be unstable.

Appendix: computing φ

We give an algorithm for finding φ(A, r, c) in O(m + n) operation. [define N. determine how many steps an operation is].

N has a source A and a sink B. We have a variable t. Initially t = 0.1. [determine suitable minimum]

Suppose I, J is a cut. Then tc(N(I)) + r(I^{c}) < tc[n]. Let t = \frac{r(I^{c})}{c[n]−c(N(I))} and continue. The number of vertices I ∪ J increases monotonically.

References

[1] Imre Csiszár and Paul C. Shields: Information theory and statistics, now Publishers, Delft (2004), section 5.2.

[2] László Lovász and Michael D. Plummer: Matching theory, Elsevier, Amsterdam (1986).

[3] Philip A. Knight: The Sinkhorn-Knopp algorithm: convergence and applications, Dagstuhl Seminar Proceedings 07071, 2008.

[4] Oliver Pretzel: Convergence of the iterative scaling procedure, Journal of the London Mathematical Society, 21, 379-384, (1980).

[5] Friedrich Pukelsheim: An L^{1}-Analysis of the Iterative Proportional Fitting Procedure, preprint 2012. Retrieved at

   opus.bibliothek.uni-augsburg.de.