Documentation
Classes
MDS

MDS

Multidimensional scaling.

Read more in the User Guide.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new MDS(opts?: object): MDS;

Parameters

NameTypeDescription
opts?object-
opts.dissimilarity?"euclidean" | "precomputed"Dissimilarity measure to use: Default Value 'euclidean'
opts.eps?numberRelative tolerance with respect to stress at which to declare convergence. The value of eps should be tuned separately depending on whether or not normalized\_stress is being used. Default Value 0.001
opts.max_iter?numberMaximum number of iterations of the SMACOF algorithm for a single run. Default Value 300
opts.metric?booleanIf true, perform metric MDS; otherwise, perform nonmetric MDS. When false (i.e. non-metric MDS), dissimilarities with 0 are considered as missing values. Default Value true
opts.n_components?numberNumber of dimensions in which to immerse the dissimilarities. Default Value 2
opts.n_init?numberNumber of times the SMACOF algorithm will be run with different initializations. The final results will be the best output of the runs, determined by the run with the smallest final stress. Default Value 4
opts.n_jobs?numberThe number of jobs to use for the computation. If multiple initializations are used (n\_init), each run of the algorithm is computed in parallel. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all processors. See Glossary for more details.
opts.normalized_stress?booleanWhether use and return normed stress value (Stress-1) instead of raw stress calculated by default. Only supported in non-metric MDS.
opts.random_state?numberDetermines the random number generator used to initialize the centers. Pass an int for reproducible results across multiple function calls. See Glossary.
opts.verbose?numberLevel of verbosity. Default Value 0

Returns

MDS

Defined in: generated/manifold/MDS.ts:23 (opens in a new tab)

Methods

dispose()

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Signature

dispose(): Promise<void>;

Returns

Promise<void>

Defined in: generated/manifold/MDS.ts:156 (opens in a new tab)

fit()

Compute the position of the points in the embedding space.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Input data. If dissimilarity=='precomputed', the input should be the dissimilarity matrix.
opts.init?ArrayLike[]Starting configuration of the embedding to initialize the SMACOF algorithm. By default, the algorithm is initialized with a randomly chosen array.
opts.y?anyNot used, present for API consistency by convention.

Returns

Promise<any>

Defined in: generated/manifold/MDS.ts:173 (opens in a new tab)

fit_transform()

Fit the data from X, and returns the embedded coordinates.

Signature

fit_transform(opts: object): Promise<ArrayLike[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Input data. If dissimilarity=='precomputed', the input should be the dissimilarity matrix.
opts.init?ArrayLike[]Starting configuration of the embedding to initialize the SMACOF algorithm. By default, the algorithm is initialized with a randomly chosen array.
opts.y?anyNot used, present for API consistency by convention.

Returns

Promise<ArrayLike[]>

Defined in: generated/manifold/MDS.ts:219 (opens in a new tab)

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

get_metadata_routing(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/manifold/MDS.ts:268 (opens in a new tab)

init()

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Signature

init(py: PythonBridge): Promise<void>;

Parameters

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/manifold/MDS.ts:107 (opens in a new tab)

set_fit_request()

Request metadata passed to the fit method.

Note that this method is only relevant if enable\_metadata\_routing=True (see sklearn.set\_config). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

Signature

set_fit_request(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.init?string | booleanMetadata routing for init parameter in fit.

Returns

Promise<any>

Defined in: generated/manifold/MDS.ts:305 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/manifold/MDS.ts:21 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/manifold/MDS.ts:20 (opens in a new tab)

_py

PythonBridge

Defined in: generated/manifold/MDS.ts:19 (opens in a new tab)

id

string

Defined in: generated/manifold/MDS.ts:16 (opens in a new tab)

opts

any

Defined in: generated/manifold/MDS.ts:17 (opens in a new tab)

Accessors

dissimilarity_matrix_

Pairwise dissimilarities between the points. Symmetric matrix that:

Signature

dissimilarity_matrix_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/manifold/MDS.ts:382 (opens in a new tab)

embedding_

Stores the position of the dataset in the embedding space.

Signature

embedding_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/manifold/MDS.ts:338 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/manifold/MDS.ts:430 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/manifold/MDS.ts:407 (opens in a new tab)

n_iter_

The number of iterations corresponding to the best stress.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/manifold/MDS.ts:453 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/manifold/MDS.ts:94 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/manifold/MDS.ts:98 (opens in a new tab)

stress_

The final value of the stress (sum of squared distance of the disparities and the distances for all constrained points). If normalized\_stress=True, and metric=False returns Stress-1. A value of 0 indicates “perfect” fit, 0.025 excellent, 0.05 good, 0.1 fair, and 0.2 poor [1].

Signature

stress_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/manifold/MDS.ts:360 (opens in a new tab)