When the index is a tuple

A fit with no answer to find

Half of all random 3 × 3 × 2 tensors, and most larger ones, have no rank-three decomposition, because their pencil has a complex pair. A rank-n fit to one of them does not wander and does not stall. Two starts settle at the same error to five digits, and that error is the distance from the tensor to the surface where its pencil has a double eigenvalue — found with no fitting at all, and matched to within one and a half per cent. Meanwhile the fit's terms grow without limit, like the square root of the sweep count, while the fitted pencil's two closest eigenvalues close on each other at exactly the rate the terms grow. The error has an answer; the decomposition does not.

Worth reading first: A nearest point that is not there · An iteration that walks out of the set.

The rank that stops being typical counted the random n × n × 2 tensors whose real rank is n. Such a tensor is a pencil of two n × n slices, (A,B)(A, B), and its rank is n exactly when the eigenvalues of A−1BA^{-1}B are all real, n + 1 otherwise. The share of rank n was 0.786 at n = 2, 0.500 at 3, 0.264 at 4 and 0.039 at 6, falling like a Gaussian in n: the lower rank is typical in theory and disappears in practice. The essay ended on the version of that result an algorithm meets. On a draw whose pencil has a complex pair, a rank-n fit “cannot converge to an exact decomposition and may not converge at all. How its residual and the size of its terms behave over iterations — whether it looks like the swamps alternating least squares is known for or like a divergence — is measurable on the same draws.”

The two possibilities it names are different failures, and the difference is the whole of this essay. A nearest point that is not there built the first: a tensor at distance zero from the rank-two set that no rank-two tensor equals, approached by rank-two tensors whose terms grow without limit while their error falls. A random rank-(n + 1) tensor is not at distance zero from anything. Whether a fit to one finds a best approximation, wanders, or does something else is not settled by that construction.

The same split at every size

Three sizes, n = 2, 3 and 4. At each, random pencils are drawn from seeded Gaussian entries and sorted by their eigenvalues; the first eight with a complex pair and the first four with only real eigenvalues are kept. Each is fitted by alternating least squares at rank n, from two random starts, for 8,000 sweeps, recording at every sweep the relative error and the size of the largest rank-one term — the product of its three columns’ norms, the quantity an iteration that walks out of the set found climbing in a swamp.

Alternating least squares of rank 2 on two random 2 × 2 × 2 tensors, one whose pencil has a complex pair and one whose pencil does notThe relative error and the size of the largest rank-one term against the sweep, on logarithmic axes, over 8000 sweeps. On the tensor whose pencil has only real eigenvalues the error falls to 1.7e-13 and the terms settle at 2.74. On the tensor whose pencil has a complex pair the error settles at 0.1752 and stays there while the largest term keeps growing, to 67, at about the 0.48 power of the sweep count.rank 2, 8000 sweepscomplex pair: error0.18complex pair: largest term67real pencil: error1.7·10⁻¹³110¹10²10³10⁻¹⁶10⁻¹³10⁻¹⁰10⁻⁷10⁻⁴10⁻¹10²sweeprelative error, term sizecomplex pair: errorcomplex pair: largest termreal pencil: errorreal pencil: largest terma settled error, and terms that are notno best approximation to settle on
Fig. 1 A rank-n fit to two random n × n × 2 tensors, one whose pencil has a complex pair and one whose pencil does not: the relative error and the largest term’s size against the sweep. The dial sets n.

The real pencils do what the algebra says they can. At n = 2 the fit’s error falls to 1.7⋅10−131.7 \cdot 10^{-13} within a few hundred sweeps and the terms settle at their exact sizes. At n = 3 two of the four real draws need more than 8,000 sweeps — their error is still 10−310^{-3} at the end, the slow convergence a fit that has an answer and cannot stop measured — but none of them has terms that grow.

The complex pencils all do something else, and it is the same something at every size. The error falls for a few hundred sweeps and stops falling: at n = 2 the first draw’s error is 0.1764 at sweep 300, 0.1756 at sweep 1,000 and 0.1752 at sweep 8,000. The largest term does not stop. It is 14.5 at sweep 300, 24.5 at sweep 1,000 and 66.8 at sweep 8,000 — growing like the 0.48th power of the sweep count, and still growing when the run ends.

Two starts, one error

The first thing worth knowing about a fit with no exact answer is whether its answer depends on where it started. Alternating least squares on a tensor with several local minima can end at a different error from every start; the rank a sweep can vouch for built a rule on how often starts agree.

Here they agree, and to many digits. At n = 2 the two starts’ final errors differ by between 4⋅10−74 \cdot 10^{-7} and 6⋅10−46 \cdot 10^{-4} of the error on all eight complex draws — on five of them by less than 10−510^{-5}. At n = 3 they differ by at most a quarter of a per cent; at n = 4, where the fits are further from settled at 8,000 sweeps, by up to six per cent on one draw and under one per cent on the other seven. Whatever the fits are approaching, they are approaching the same number from different directions.

That number is not an artefact of the iteration, and it can be computed without one.

The error is the distance to a surface

The error a rank-two fit settles at, against the distance from the tensor to the surface where its pencil has a double eigenvalueEight random 2 × 2 × 2 tensors whose pencils have a complex pair. Horizontally, the distance from each to the zero set of its pencil's discriminant, found by a constrained Newton iteration with no alternating least squares in it; vertically, the relative error alternating least squares reaches after 8000 sweeps. Every point is on or just above the diagonal: the fit's error exceeds the distance by between 0.02 and 1.53 per cent.fit ÷ distance, less oneleast excess over the distance1.8·10⁻⁴greatest0.01510⁻²10⁻¹110⁻²10⁻¹1distance to the double-eigenvalue surfaceerror the fit settles atdashed: equalitytwo routes to one number
Fig. 2 Eight random 2 × 2 × 2 tensors with complex pencils: the error the rank-two fit settles at, against the distance from the tensor to the surface where its pencil has a double eigenvalue. The dashed line is equality.

A sum of n real rank-one terms has a pencil whose eigenvalues are all real — each term contributes one, the ratio of its two third-index coefficients. So every rank-n tensor lies in the region where the pencil’s eigenvalues are real, and so does every limit of rank-n tensors. A tensor whose pencil has a complex pair is outside that region, and the nearest the fit can come to it is the nearest point of the region’s boundary: the surface on which two real eigenvalues have merged into one.

For a 2 × 2 × 2 tensor the surface is a polynomial’s zero set. The determinant of A+tBA + tB is a quadratic in t, its discriminant is positive when the two eigenvalues are real and distinct, negative when they are a complex pair and zero when they coincide — it is Cayley’s hyperdeterminant up to sign. The distance from a tensor to that zero set is a constrained minimisation in eight variables, and a Newton iteration on its stationarity conditions solves it to the rounding level without alternating least squares or rank-one terms anywhere in it.

The figure at the top of the page sets the two numbers beside each other. On all eight draws the fit’s error after 8,000 sweeps is above the distance to the surface by between 0.02 and 1.5 per cent, and never below it. The fit is approaching the distance to the boundary, from above, as far as it has got. The error has an answer, and the answer is a property of the tensor — how far its complex pair is from becoming a real double eigenvalue.

How much a missing rank costs

The eight draws above were the first eight of their kind, so their distances — from 0.023 to 0.21 — are a sample of what a rank-two fit loses on a random rank-three tensor rather than a description of it. The distance is cheap to compute without any fitting, so the distribution can be had directly.

How far four hundred random rank-three 2 × 2 × 2 tensors are from the rank-two set, against how far their pencil's eigenvalues are off the real axisOf 1828 random 2 × 2 × 2 tensors with Gaussian entries, the first 400 whose pencil has a complex pair. Vertically, the relative distance from each to the zero set of its pencil's discriminant, which is the error a rank-two fit settles at; horizontally, the complex pair's imaginary part divided by its distance from the origin of the projective line. The median distance is 0.061, one in ten is below 0.0085 and one in ten above 0.170, and the largest is 0.330. The tilt orders the distances only loosely.400 rank-three tensorsmedian distance0.061one in ten below0.0085one in ten above0.1710⁻²10⁻¹110⁻⁴10⁻³10⁻²10⁻¹the complex pair's tilt off the real axisdistance to the rank-two setmedianone dot for each tensorwhat a rank-two fit cannot recover
Fig. 3 Four hundred random rank-three 2 × 2 × 2 tensors: each one’s relative distance to the rank-two set against how far its pencil’s complex pair is off the real axis, on logarithmic axes, with the median drawn across.

Drawing Gaussian tensors until four hundred have a complex pair takes 1,828 of them, a share of 21.9 per cent against the 1−π/4=21.51 - \pi/4 = 21.5 the earlier essay measured. Their distances to the rank-two set run from 10−410^{-4} to 0.33 of the tensor’s norm, with a median of 0.061: a rank-two fit to a typical rank-three tensor leaves six per cent of it, one in ten leaves more than seventeen, and one in ten less than one. None of that is noise in the fit; it is the distance from the tensor to the nearest thing the fit can produce, and the fit gets to within a per cent of it.

The pencil’s eigenvalues give a reading of the distance before anything is computed, and it is a poor one. A complex pair that sits close to the real axis — a small imaginary part relative to its distance from the origin of the projective line — is closer to becoming a real double eigenvalue, and the median distance does rise with that tilt: 0.005 among the fourteen draws whose tilt is below a tenth, 0.087 among the 259 whose tilt is above 0.4. But the rank correlation between the two is only 0.51, and the scatter in the figure spans two decades of distance at every tilt. How far a tensor is from the rank-two set depends on the whole pencil and not only on where its eigenvalues are; the eigenvalues carry about half of the ordering, and what carries the rest is not measured here.

That bears on the earlier essay’s count. It found the rank-n share falling like a Gaussian in n, so that at n = 8 almost every tensor has rank n + 1. What the count did not say is how much rank n + 1 is the higher rank. If most rank-three tensors were within 10−410^{-4} of the rank-two set, the lower rank would be typical for every practical purpose and the count a technicality; at n = 2 the median distance is six per cent, which is a property any application fitting a rank-two model would see.

Approached and never reached

How close the rank-two fit's two pencil eigenvalues have come to each other, against the size of its largest termFor four random 2 × 2 × 2 tensors with complex pencils, at 30 to 8000 sweeps: the distance between the two eigenvalues of the fitted tensor's pencil — both real at every snapshot — against the size of its largest rank-one term, on logarithmic axes. The product of the two stays within a factor of 2.13 along each run: the eigenvalues close on each other as one over the size of the terms, approaching a double eigenvalue that a sum of two rank-one terms can only reach with terms of infinite size.the product holdsseed 202: gap × size, last1.2seed 203: gap × size, last2.5seed 209: gap × size, last2seed 213: gap × size, last2.410¹10²10⁻²10⁻¹1largest term's sizegap between the two eigenvaluesevery eigenvalue drawn is realheading for a double eigenvalue
Fig. 4 The distance between the fitted tensor’s two pencil eigenvalues against the size of its largest term, for four draws at 30 to 8,000 sweeps, on logarithmic axes.

The surface’s nearest point has a pencil with a double eigenvalue, and the fit can only reach it in the limit. Two rank-one terms with the same eigenvalue are, together, a rank-two tensor whose pencil has a double eigenvalue with two independent eigenvectors; the nearest point generically has one, a Jordan block, and a Jordan block is not a sum of two rank-one terms. It is the limit of two terms whose eigenvalues approach each other while their sizes grow to cancel the difference.

That is what the fit is doing. Its pencil’s two eigenvalues are real at every sweep, as they must be, and they close on each other: on the first draw they are 0.155 apart at sweep 30, 0.048 at sweep 1,000 and 0.0175 at sweep 8,000. The product of that gap and the largest term’s size stays between 1.17 and 1.19 along the whole run, and within a factor of 2.2 on every one of the four draws drawn: the eigenvalues close at exactly the rate the terms grow. A nearest point that is not there built this kind of limit by hand for the tensor at distance zero — two terms that grow as one over a vanishing parameter and cancel — and the fit finds the same construction on its own, at a positive distance, from a random start.

An inverse square, not an exchange rate

How far above the distance to the boundary a rank-two fit still is, against the size of its largest termFour random 2 × 2 × 2 tensors with complex pencils, at 100 to 8000 sweeps: the fit's relative error minus the distance to the double-eigenvalue surface, against the size of its largest rank-one term, on logarithmic axes. The points fall along a slope of minus two — the excess halves when the terms grow by forty per cent — where on the border-rank tensor, whose distance to the rank-two set is zero, the error falls along a slope of minus one. The two reference lines start from the first point.at 8000 sweepsseed 202: excess × size squared0.24seed 203: excess × size squared0.31seed 209: excess × size squared0.18seed 213: excess × size squared0.510¹10²10⁻⁵10⁻⁴10⁻³10⁻²largest term's sizeerror − distance to the boundaryslope −2slope −1dashed: slope minus two · dotted: minus onean inverse square, not the swamp's exchange rate
Fig. 5 For four draws, the fit’s error minus the distance to the boundary against the largest term’s size, at 100 to 8,000 sweeps, on logarithmic axes, with reference slopes of minus two and minus one.

The two cases of a missing nearest point now differ in a number that can be measured. On the border-rank tensor the error itself goes to zero, and it goes as one over the size of the terms: the repair that costs exactly itself measured that exchange rate and the price of a ridge that refuses to pay it. On a random rank-three tensor the error goes to a positive distance, and what goes to zero is the excess over it. The figure plots that excess against the term size, and every draw falls along a slope of minus two. The product of the excess and the square of the size is 0.18 to 0.50 across the four draws at 8,000 sweeps and moves by under a factor of two over the run, while the product with the size alone falls more than fivefold.

So the exchange rate is worse here by a square. On the border-rank tensor a tenfold larger term buys a tenfold smaller error. Here a tenfold larger term buys a hundredfold smaller excess — which sounds better until it is set against what the excess is an excess over. It is the last digits of an error that is already settled in its first three, and the price of each further digit is a factor of 10\sqrt{10} in the size of the terms, paid in cancellation.

Every draw diverges, at its own rate

How fast the largest term grows over the second half of a rank-n fit, for every draw, by pencil sizeThe exponent of the largest rank-one term's growth with the sweep count, from the thousandth sweep to the eight-thousandth, for eight tensors with a complex pair and four with only real eigenvalues at each of n = 2, 3 and 4. Every complex draw grows, at exponents from 0.32 to 1.14; the real draws that converged do not grow at all, and the dashed line is one half, the square-root growth of the two-by-two case.exponent, sweeps 1,000 to 8,000slowest growth, complex pair0.3223400.250.50.7511.25pencil size ngrowth exponent of the largest termcomplex pairreal pencilfilled: complex pair · open: real pencilevery complex draw diverges
Fig. 6 The growth exponent of the largest term between sweep 1,000 and sweep 8,000, for every complex and every real draw at n = 2, 3 and 4. The dashed line is one half.

At n = 2 the terms grow at exponents between 0.39 and 0.49 of the sweep count on all eight draws, close to the square root the inverse-square law implies if the excess falls like one over the sweeps. At n = 3 and 4 the exponents spread, from 0.32 to 1.14: some fits grow faster than the square root and one barely faster than the cube root. Larger pencils have more eigenvalues, and a complex pair can be pushed onto the real axis next to either of its real neighbours or both, so the path to the boundary is not unique in its shape even when the distance is. But on every one of the twenty-four complex draws the exponent is above 0.3, and on every real draw that converged it is zero.

What a code should do with this

A settled error is not a found answer. Every stopping rule a fitting code applies watches the error, and on these tensors the error settles to five digits within a few hundred sweeps. A code that stops there returns terms that are already several times the tensor’s own norm and cancelling, and the next run, from another start, returns different large terms with the same error. A still error is not a settled one found stopping rules fooled by plateaus on the way to an answer; here the error is not on a plateau, it is at its limit, and what is unsettled is everything else.

The pencil says which case a tensor is in, for nothing. An n × n × 2 tensor’s rank question is an eigenvalue question about an n × n matrix. Before fitting at rank n, the eigenvalues of A−1BA^{-1}B say whether a rank-n decomposition exists; if they include a complex pair, the best a rank-n fit can do is the distance to the boundary, and its terms will diverge whatever it is started from. At n = 4 that is three random tensors in four.

And the distance is a better number to report than the fit. For a 2 × 2 × 2 tensor it is the distance to the discriminant’s zero set, computed directly, and the fit’s error agrees with it to within one and a half per cent after 8,000 sweeps and is never below it. A quantity that the fit approaches from above, and that can be computed without the fit, is a certificate for how good the fit can get.

What three sizes do not show

Three pencil sizes and a few dozen draws, all with standard Gaussian entries. The boundary distance is computed only at n = 2, where the surface is one polynomial; at n = 3 and 4 the surface is the set of pencils with any double eigenvalue, and the claim that the fits approach its distance is the n = 2 measurement carried over by the argument, not measured. The fits are plain alternating least squares with a tiny ridge, run for 8,000 sweeps; a regularised or line-searched fit would trade some of the divergence for some of the error, which the repair that costs exactly itself priced on the border-rank tensor and which is not priced here. And the n × n × 2 shape is the one whose rank question reduces to a pencil; for three slices or more the rank is not decided by one eigenvalue problem, and whether random tensors there also lack best approximations at their lower typical rank is a different question.

Still open: the distance at larger n, a fit that stops on purpose, and three slices

The boundary at n = 3 and 4. The distance to the set of pencils with a double eigenvalue is a minimisation over pencils, and for n above two its constraint is the vanishing of a discriminant of degree n(n−1)n(n-1). Computing it — by Newton on the eigenvalue-coincidence condition rather than on the polynomial — would say whether the fits’ common error at n = 3 is that distance to the same precision as at n = 2, and whether the n = 4 draw whose two starts disagree by six per cent is one where the two starts are heading for two different nearest points.

A fit that stops at the distance. If the distance can be computed, a fit can be stopped when its error is within a stated fraction of it, before its terms have grown. The prediction with a sign is that at a tolerance of one per cent the terms are still within a factor of three of the tensor’s norm on every draw at n = 2, because the excess falls as the square of the size and one per cent is reached early.

Three slices. An n × n × 3 tensor’s typical real ranks are not decided by one pencil. Whether its lower typical rank also has random tensors with no best approximation — and whether a fit there settles at a distance and diverges in its terms in the same way — is the question that would say whether this page describes pencils or real tensors.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A flat tag is an object no other essay names yet.

Alternating least-squaresBorder-rankCP decompositionDegeneracyGeneralised eigenvalue problemMatrix pencilTensor rank