Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convergence issues and sratmax #354

Closed
clayfos opened this issue Apr 12, 2020 · 2 comments
Closed

Convergence issues and sratmax #354

clayfos opened this issue Apr 12, 2020 · 2 comments

Comments

@clayfos
Copy link

clayfos commented Apr 12, 2020

I apologize if this should be asked elsewhere. This is not a bug/issue or a feature request, just a question about convergence criteria.

I've been experimenting with using metaMDS on a matrix of dissimilarity scores for a large collection of protein sequences. I'm having significant difficulty reaching a solution, repeatedly seeing:

*** No convergence -- monoMDS stopping criteria:
    32: stress ratio > sratmax

Out of curiosity, I tried setting sratmax manually, increasing it from the default 0.99999 to 0.9999999. This allows me to achieve a solution relatively reliably.

Here's my command (I've tried changing various parameters like # of iterations and random starts, as well reading through the Convergence Problems section under help(metaMDS). I've also tested several popular metrics to generate the dissimilarity matrices for protein sequences):

results.nmds <- metaMDS(dissimilarity.scores, k = 3,
                        maxit = 1000, 
                        trymax = 300,
                        wascores = FALSE,
                        autotransform = FALSE,
                        trace = 2,
                        noshare = FALSE,
                        parallel = 4)

From reading the help for monoMDS, I know that iterations stop once the stress ratio between two iterations goes above the sratmax value. What exactly is happening when I raise the sratmax value? Does that mean that the stress ratio between two iterations must be even closer to identical (1) to stop the iterations for that particular random start, or am I way off? Is this appropriate, if the sratmax threshold appears to be preventing the finding of a solution, assuming there's nothing else odd with the data?

Thanks!

@jarioksa
Copy link
Contributor

jarioksa commented Apr 24, 2020

If sratmax is exactly one, the iteration does not go anywhere but the stress remains exactly constant. If sratmax is almost one (say, 1 - 1-9), then the stress improvement is very flat and the iteration is going almost nowhere, and this could continue for ever. So we say that the game is over if hardly anything happens. It is a similar rule as maxit: if you have tried too many steps, just let it be and start again. The limits in monoMDS (that are used in metaMDS) were based on traditional wisdom of the elders. We already made some of these criteria stricter in 2012 (commit 5868c89), but did not touch sratmax then. Perhaps it is time to make that stricter, too. (NB., the traditional wisdom was based on older non-R software which used single precision numbers where you cannot be very strict, but R uses double precision and we did not adapt to this change in architecture.) I'll see this.

jarioksa added a commit that referenced this issue May 13, 2020
wish of github issue #354
@jarioksa
Copy link
Contributor

I have now implemented a bit (10 times) stricter sratmax. It seems that for many purposes this could be even stricter, but even the new limit takes convergence criterion so close to numerical precision of digital computers that stricter limits would give numerically too different test results in different computer systems.

jarioksa added a commit that referenced this issue Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants