Added multidimensional scaling to project distance separated items to a k dimensional space#20
Open
kanishkamisra wants to merge 7 commits intojuliasilge:mainfrom
Open
Added multidimensional scaling to project distance separated items to a k dimensional space#20kanishkamisra wants to merge 7 commits intojuliasilge:mainfrom
kanishkamisra wants to merge 7 commits intojuliasilge:mainfrom
Conversation
…ces to a k dimensional space
Contributor
Author
|
Learning a lot about Travis CI from this commit! |
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
========================================
- Coverage 65.99% 60.7% -5.3%
========================================
Files 11 12 +1
Lines 247 257 +10
========================================
- Hits 163 156 -7
- Misses 84 101 +17
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since
widyrhas two distance based functions, namelypairwise_deltaandpairwise_dist, I was wondering if we can take it a step further and add functionality for the data analyst/scientist to scale these pairwise distances to k dimensions. This is done in base R usingcmdscalethat takes a distance matrix and returns a matrix with each item as a row and each of the k dimensions as columns. The points are calculated such that the distance is maintained.Example:
In the tidy, widy way, I figured the following way to do this when we have a distance based result from a widyr method:
This can be used for something as shown below, where we compare the distances between the austen books separated by euclidean distance:
I've also solved #13 by adding a
fill_valueargument inwidely(previously used fill = 0 for all pairwise functions making correlations take 0 values for missing data instead of NAs) and in case ofpairwise_cor, it'll be NA and 0 otherwise.