📄 sparsecovariancestest2.m.svn-base
字号:
%A script to test the efficiency of sparse covariances
clear;
rand('state',22);
numExamples = 1000;
numFeatures = 500;
numLabels = 100;
tol = 10^-5;
%X = rand(numExamples, numFeatures);
X = sprand(numExamples, numFeatures, 0.1);
Y = sparse(sign(rand(numExamples, numLabels)-0.5));
X = centerData(X);
Y = full(Y);
KX = full(X*X');
%If KX is full and Y is sparse computaion is slow
%If both are sparse computation is faster
%If both are full, computation is much faster
for i= 1:20
fprintf('Iteration %d\n', i);
[covariances, bs] = sparseCovariances(KX, KX, Y, Y, (1:numExamples)');
%[alignments, bs] = sparseAlignments(KX, KX, Y, Y, (1:numExamples)');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -