lvdmaaten.github.io | Website of Laurens van der Maaten
kandi X-RAY | lvdmaaten.github.io Summary
kandi X-RAY | lvdmaaten.github.io Summary
Website of Laurens van der Maaten.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of lvdmaaten.github.io
lvdmaaten.github.io Key Features
lvdmaaten.github.io Examples and Code Snippets
Community Discussions
Trending Discussions on lvdmaaten.github.io
QUESTION
I have a symmetric similarity matrix that I want to use as input into Rtsne (https://cran.r-project.org/web/packages/Rtsne/index.html).
...ANSWER
Answered 2020-Jul-08 at 14:18divide the matrix by the total of its sum
QUESTION
I am using Principle Component Analysis on the features extracted from different layers of CNN. I have downloaded the toolbox of dimension reduction from here.
I have a total of 11232 training images and feature for each image is 6532. so the feature matrix is like that 11232x6532
If I want top 90% features I can easily do that and training accuracy using SVM of reduced data is 81.73% which is fair.
However, when I try the testing data which have 2408 images and features of each image is 6532. so feature matrix for testing data is 2408x6532
. In that case the output for top 90% feature is not correct it shows 2408x2408
.
and the testing accuracy is 25%.
Without using dimension reduction the training accuracy is 82.17% and testing accuracy is 79%.
Update:
Where X
is the data and no_dims
is required number of dimensions at output.
the output of this PCA function is variable mappedX
and structure mapping
.
ANSWER
Answered 2018-Mar-19 at 10:43It looks like you're doing dimensionality reduction on both the training and testing data separately. During training, you're supposed to remember the principal scores or basis vectors of the examples during training. Remember that you are finding a new representation of your data with a new set of orthogonal axes based on the training data. During testing, you repeat the exact same procedure as you did with the training data as you are representing the data with respect to these basis vectors. Therefore, you use the basis vectors for the training data to reduce your data down. You are only getting a 2408 x 2408
matrix because you are performing PCA on the test examples as it is impossible to produce basis vectors beyond the rank of the matrix in question (i.e. 2408).
Retain your basis vectors from the training stage and when it's time to perform classification in the testing stage, you must use the same basis vectors from the training stage. Remember that in PCA, you must centre your data by performing mean subtraction prior to the dimensionality reduction. To do this, in your code we note that the basis vectors are stored in mapping.M
and the associated mean vector is stored in mapping.mean
. When it comes to the testing stage, make sure you mean subtract your test data with the mapping.mean
from the training stage:
QUESTION
I've been exploring different dimensionality reduction algorithms, specifically PCA and T-SNE. I'm taking a small subset of the MNIST dataset (with ~780 dimensions) and attempting to reduce the raw down to three dimensions to visualize as a scatter plot. T-SNE can be described in great detail here.
I'm using PCA as an intermediate dimensional reduction step prior to T-SNE, as described by the original creators of T-SNE on the source code from their website.
I'm finding that T-SNE takes forever to run (10-15 minutes to go from a 2000 x 25 to a 2000 x 3 feature space), while PCA runs relatively quickly (a few seconds for a 2000 x 780 => 2000 X 20).
Why is this the case? My theory is that in the PCA implementation (directly from primary author's source code in Python), he utilizes Numpy dot product notations to calculate X
and X.T
:
ANSWER
Answered 2017-Aug-22 at 19:21The main reason for t-SNE being slower than PCA is that no analytical solution exists for the criterion that is being optimised. Instead, a solution must be approximated through gradient descend iterations.
In practice, this means lots of for loops. Not in the least the main iteration for-loop in line 129, that runs up to max_iter=1000
times. Additionally, the x2p
function iterates over all data points with a for loop.
The reference implementation is optimised for readability, not for computational speed. The authors link to an optimised Torch implementation as well, which should speed up the computation a lot. If you want to stay in pure Python, I recommend the implementation in Scikit-Learn, which should also be a lot faster.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install lvdmaaten.github.io
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page