Dimension Reduction - Diagnostic - Goodness of Fit Plot

Chart the original Euclidean distances between data points (x-axis) versus Euclidean distances in reduced 2-dimensional space. The Spearman's rank correlation coefficient is shown.
This blog post describe the interpretation of plots with dimension reduction performed by different algorithms.
Note that t-SNE is particularly sensitive to the choice of random seed (which can be amended via the R code) and consequently the t-SNE correlation coefficient may vary depending on the seed.
How to Create
- Add the object by selecting from the menu Create > Dimension Reduction > Diagnostic > Goodness of Fit Plot
- Under Inputs > Dimension Reduction select a t-SNE, MDS, or PCA analysis output.
Example
Example output:
Input Example:
An analysis using t-SNE, MDS, or PCA.
Options
Dimension Reduction An R Output containing a principal components, multidimensional scaling or t-SNE analysis.
Maximum points The maximum number of points to plot. If the object contains more data points, a random sample is taken.
Code
var __webpack_modules__ = ({});
// The module cache
var __webpack_module_cache__ = {};
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
// Return the exports of the module
return module.exports;
}
// webpack/runtime/rspack_version
(() => {
__webpack_require__.rv = () => ("1.7.2")
})();
// webpack/runtime/rspack_unique_id
(() => {
__webpack_require__.ruid = "bundler=rspack@1.7.2";
})();
var heading_text = "Goodness of Fit Plot";
if (!!form.setObjectInspectorTitle)
form.setObjectInspectorTitle(heading_text);
else
form.setHeading(heading_text);
form.dropBox({ name: "inputItem", label: "Dimension reduction", types: ["R:flipFactorAnalysis,2Dreduction,principal,princomp,fa"],
prompt: "PCA, t-SNE or MDS output" });
form.numericUpDown({ name: "formMaxPoints", label: "Maximum points", default_value: 1000, increment: 1, minimum: 2, maximum: Number.MAX_SAFE_INTEGER,
prompt: "Maximum points to display, random sampling is used if the output contains more points" });
library(flipDimensionReduction)
goodness.of.fit <- GoodnessOfFitPlot(QInputs(inputItem), max.points = formMaxPoints)