Nov 20

We are given a covariance matrix, and we’d like to generate n vectors, whose coordinates’ covariance matrix is equal to given. We also like each coordinate to have given mean.
Here is a code:

function numbers = randomcov(n, covMatrix, offset)
    x=randn(n,length(covMatrix(1,:)));
    numbers = x*inv(chol(cov(x)))*chol(covMatrix);
    for i=1:length(offset)
        numbers(:,i) = offset(i)+numbers(:,i)-mean(numbers(:,i));
    end
end

Usage:
n – number of vectors to generate
covMatrix – given covariance matrix
offset – vector of means of each coordinate

Example:

Read More


May 10

Internet is a really great thing! I’m able to watch lectures from such great universities as Stanford or MIT.

Here is Machine learning course from Stanford:

And Introduction to algorithms course conducted by Charles Leiserson (coauthor of “Cormen’s book”).

and MIT OpenCourseWare – nearly 2000 courses from MIT.