Skip to content

Commit

Permalink
binary FA on newsgroups
Browse files Browse the repository at this point in the history
git-svn-id: https://pmtk3.googlecode.com/svn/trunk@2771 b6abd7f4-f95b-11de-aa3c-59de0406b4f5
  • Loading branch information
[email protected] committed Apr 13, 2011
1 parent 5f1ea48 commit 36943c9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions demos/binaryFaDemoNewsgroups.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@

% This file is from pmtk3.googlecode.com

requireStatsToolbox; % cmdscale

setSeed(0);
loadData('20news_w100');
% documents, wordlist, newsgroups, groupnames
labels = double(full(documents))'; % 16,642 documents by 100 words (sparse logical matrix)
[N,D] = size(labels);
perm = randperm(N);
data = labels(1:perm(100), 1:50);
data = labels(1:perm(500), :);
[N,D] = size(data);
maxIter = 6; % EM convergers really fast

% Latent 2d embedding
%{
% Latent 2d embedding - very poor
% We don't request loglik hist for speed
[model2d] = binaryFAfit(data, 2, 'maxIter',maxIter, 'verbose', true);
Expand All @@ -31,6 +33,7 @@
text(muPost2d(1,d), muPost2d(2,d), wordlist{d});
end
title(sprintf('latent 2d embedding of %d newsgroups words', D))
%}


% Latent higher dim embedding
Expand All @@ -44,7 +47,7 @@
% muPost is L*N, reduce to N*2 for vis purposes using MDS
dst = pdist(muPostBig','Euclidean');
[mdsCoords,eigvals] = cmdscale(dst);

eigVals(1:5)

figure; hold on
% We need to plot points before text
Expand Down

0 comments on commit 36943c9

Please sign in to comment.