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
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.dissimilarity? | "euclidean" | "precomputed" | Dissimilarity measure to use: Default Value 'euclidean' |
opts.eps? | number | Relative 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? | number | Maximum number of iterations of the SMACOF algorithm for a single run. Default Value 300 |
opts.metric? | boolean | If 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? | number | Number of dimensions in which to immerse the dissimilarities. Default Value 2 |
opts.n_init? | number | Number 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? | number | The 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? | boolean | Whether use and return normed stress value (Stress-1) instead of raw stress calculated by default. Only supported in non-metric MDS. |
opts.random_state? | number | Determines the random number generator used to initialize the centers. Pass an int for reproducible results across multiple function calls. See Glossary. |
opts.verbose? | number | Level of verbosity. Default Value 0 |
Returns
Defined in: generated/manifold/MDS.ts:23 (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:310 (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:266 (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:358 (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:335 (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:381 (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
Name | Type |
---|---|
pythonBridge | PythonBridge |
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:288 (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
Name | Type | Description |
---|---|---|
opts | object | - |
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? | any | Not 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
Name | Type | Description |
---|---|---|
opts | object | - |
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? | any | Not used, present for API consistency by convention. |
Returns
Promise
<ArrayLike
[]>
Defined in: generated/manifold/MDS.ts:219 (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
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/manifold/MDS.ts:107 (opens in a new tab)