c71dea1c929f08d290142f50679a06303eb5bd9c,Python/phate/mds.py,,embed_MDS,#,37
Before Change
// MDS embeddings, each gives a different output.
X_dist = squareform(pdist(X, distance_metric))
if how == "classic":
// classical MDS as defined in cmdscale
// Y = cmdscale(X_dist)[0][:,:ndim]
Y = cmdscale_fast(X_dist, ndim)
elif how == "metric":
// First compute CMDS
Y_cmds = cmdscale_fast(X_dist, ndim)
// Metric MDS from sklearn
Y = MDS(n_components=ndim, metric=True, max_iter=3000, eps=1e-12,
dissimilarity="precomputed", random_state=seed, n_jobs=n_jobs,
n_init=1).fit_transform(X_dist, init=Y_cmds)
elif how == "nonmetric":
// First compute CMDS
Y_cmds = cmdscale_fast(X_dist, ndim)
// Then compute Metric MDS
Y_mmds = MDS(n_components=ndim, metric=True, max_iter=3000, eps=1e-12,
dissimilarity="precomputed", random_state=seed,
n_jobs=n_jobs, n_init=1).fit_transform(X_dist,
init=Y_cmds)
// Nonmetric MDS from sklearn using metric MDS as an initialization
Y = MDS(n_components=ndim, metric=False, max_iter=3000, eps=1e-12,
dissimilarity="precomputed", random_state=seed, n_jobs=n_jobs,
n_init=1).fit_transform(X_dist, init=Y_mmds)
else:
raise ValueError("Allowable "how" values for MDS: "classic", "
""metric", or "nonmetric". "
""{}" was passed.".format(how))
return Y
After Change
// initialize all by CMDS
Y = cmdscale_fast(X_dist, ndim)
if how in ["metric", "nonmetric"]:
log_debug("Performing metric MDS on "
"{} of shape {}...".format(type(X_dist),
X_dist.shape))
// Metric MDS from sklearn
Y = MDS(n_components=ndim, metric=True, max_iter=3000, eps=1e-12,
dissimilarity="precomputed", random_state=seed, n_jobs=n_jobs,
n_init=1).fit_transform(X_dist, init=Y)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: KrishnaswamyLab/PHATE
Commit Name: c71dea1c929f08d290142f50679a06303eb5bd9c
Time: 2018-05-30
Author: scottgigante@gmail.com
File Name: Python/phate/mds.py
Class Name:
Method Name: embed_MDS
Project Name: KrishnaswamyLab/PHATE
Commit Name: e0e0edc8d1b6478acfce87702592d4c084dc2ee4
Time: 2018-05-31
Author: scottgigante@gmail.com
File Name: Python/phate/phate.py
Class Name: PHATE
Method Name: fit
Project Name: KrishnaswamyLab/PHATE
Commit Name: be95ff167e1ea0195e32beb0618228d18a4098eb
Time: 2018-05-28
Author: scottgigante@gmail.com
File Name: Python/phate/phate.py
Class Name: PHATE
Method Name: transform