I am using the MSD algorithm to reduce 3D datapoints to 2D.
There are situations where the algorithm will return results which appear to mirror the original data on the y-axis or x-axis. I would like to preserve the original x-y view perspective.
In the plot below you can see the original x-y data plotted (the z-component removed).
The MSD algorithm produces the transformed points on the subplot on the right.
enter image description here
Using the point labels as reference you can see that the output is mirrored.
Is there a way that I can prevent this mirroring effect on the transformed points?
I can generate the correct output for this example by mirroring the transformed points on the y-axis (As shown below). However this is sub-optimal and I would prefer the returned MSD transformation to correctly orientate the returned datapoints without this manual interference.
enter image description here
The current code I have looks like this:
# Extract relevant columns
points = df[['X', 'Y', 'Z']].values
# Calculate pairwise distances and perform MDS
distances = np.sqrt(np.sum((points[:, None, :] - points[None, :, :]) ** 2, axis=-1))
mds = MDS(n_components=2, dissimilarity='precomputed', n_init=70, max_iter=200, eps=1e-5, random_state=0)
transformed_points = mds.fit_transform(distances)
Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.