eigenvector

spectral clustering

主宰稳场 提交于 2019-12-21 11:23:10
问题 First off I must say that I'm new to matlab (and to this site...) , so please excuse my ignorance. I'm trying to write a function in matlab that will use Spectral Clustering to split a set of points into two clusters. my code is as follows function Groups = TrySpectralClustering(data) dist_mat = squareform(pdist(data)); W= zeros(length(data),length(data)); for i=1:length(data), for j=(i+1):length(data), W(i,j)=10^(-dist_mat(i,j)); W(j,i)=W(i,j); end end D = zeros(length(data),length(data));

spectral clustering

半腔热情 提交于 2019-12-21 11:23:04
问题 First off I must say that I'm new to matlab (and to this site...) , so please excuse my ignorance. I'm trying to write a function in matlab that will use Spectral Clustering to split a set of points into two clusters. my code is as follows function Groups = TrySpectralClustering(data) dist_mat = squareform(pdist(data)); W= zeros(length(data),length(data)); for i=1:length(data), for j=(i+1):length(data), W(i,j)=10^(-dist_mat(i,j)); W(j,i)=W(i,j); end end D = zeros(length(data),length(data));

Computing eigenvectors of a sparse matrix in R

我与影子孤独终老i 提交于 2019-12-21 05:21:15
问题 I am trying to compute the m first eigenvectors of a large sparse matrix in R. Using eigen() is not realistic because large means N > 10 6 here. So far I figured out that I should use ARPACK from the igraph package, which can deal with sparse matrices. However I can't get it to work on a very simple (3x3) matrix: library(Matrix) library(igraph) TestDiag <- Diagonal(3, 3:1) TestMatrix <- t(sparseMatrix(i = c(1, 1, 2, 2, 3), j = c(1, 2, 1, 2, 3), x = c(3/5, 4/5, -4/5, 3/5, 1)))

eigenvectors from numpy.eig not orthogonal

让人想犯罪 __ 提交于 2019-12-20 07:18:05
问题 my problem is the following: using scipy.linalg.eig to get eigenvectors and eigenvalues i see that all my eigenvalues have multiplicity 1 yet when i run the code below it doesn't confirm that the eigenvectors are orthogonal as they should be in this case. any reason why this would be? or how to fix it? import scipy as SP import numpy as NP from scipy import linalg from numpy import linspace,asscalar,argsort import cmath import time matA=SP.array([[-0.0001, 0., 0., 0.00001, 0., 0., 0.00002, 0.

Plot a Correlation Circle in Python

百般思念 提交于 2019-12-20 01:43:33
问题 I've been doing some Geometrical Data Analysis (GDA) such as Principal Component Analysis (PCA). I'm looking to plot a Correlation Circle... these look a bit like this: Basically, it allows to measure to which extend the Eigenvalue / Eigenvector of a variable is correlated to the principal components (dimensions) of a dataset. Anyone knows if there is a python package that plots such data visualization? 回答1: I agree it's a pity not to have it in some mainstream package such as sklearn. Here

how to calculate 2^n modulo 1000000007 , n = 10^9

早过忘川 提交于 2019-12-17 20:22:53
问题 what is the fastest method to calculate this, i saw some people using matrices and when i searched on the internet, they talked about eigen values and eigen vectors (no idea about this stuff)...there was a question which reduced to a recursive equation f(n) = (2*f(n-1)) + 2 , and f(1) = 1, n could be upto 10^9.... i already tried using DP, storing upto 1000000 values and using the common fast exponentiation method, it all timed out im generally weak in these modulo questions, which require

Are eigenvectors returned by R function eigen() wrong?

别说谁变了你拦得住时间么 提交于 2019-12-17 17:12:17
问题 #eigen values and vectors a <- matrix(c(2, -1, -1, 2), 2) eigen(a) I am trying to find eigenvalues and eigenvectors in R. Function eigen works for eigenvalues but there are errors in eigenvectors values. Is there any way to fix that? 回答1: Some paper work tells you the eigenvector for eigenvalue 3 is (-s, s) for any non-zero real value s ; the eigenvector for eigenvalue 1 is (t, t) for any non-zero real value t . Scaling eigenvectors to unit-length gives s = ± sqrt(0.5) = ±0.7071068 t = ± sqrt

finding eigenvalues of huge and very sparse matrix

删除回忆录丶 提交于 2019-12-13 04:24:27
问题 I have the following problem. There is a matrix A of size NxN , where N = 200 000 . It is very sparse, there are exactly M elements in each row, where M={6, 18, 40, 68, 102} (I have 5 different scenarios), the rest are zeros. Now I would like to get all the eigenvalues and eigenvectors of matrix A . Problem is, I cannot put matrix A into memory as it is around 160 GB of data. What I am looking for is a software that allows nice storing of sparse matrix (without zeros, my matrix is just few MB

Largest eigenvalues (and corresponding eigenvectors) in C++

走远了吗. 提交于 2019-12-12 14:37:00
问题 What is the easiest and fastest way (with some library, of course) to compute k largest eigenvalues and eigenvectors for a large dense matrix in C++? I'm looking for an equivalent of MATLAB's eigs function; I've looked through Armadillo and Eigen but couldn't find one, and computing all eigenvalues takes forever in my case (I need top 10 eigenvectors for an approx. 30000x30000 dense non-symmetric real matrix). Desperate, I've even tried to implement power iterations by myself with Armadillo's

Finding eigenvectors and eigenvalues of a sparse matrix with ARPACK ( called form PYTHON, MATLAB or as a FORTRAN subroutine)

主宰稳场 提交于 2019-12-12 10:17:26
问题 Few days ago I asked a question how to find the eigenvalues of a large sparse matrix. I got no answers, so I decided to describe a potential solution. One question remains: Can I use the python implementation of ARPACK to compute the eigenvalues of a asymmetric sparse matrix. At the beginning I would like to say that it is not at all necessary to call the subroutines of ARPACK directly using FOTRAN driver program. That is quite difficult and I never got it going. But one can do the following: