-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_latents.m
26 lines (22 loc) · 878 Bytes
/
load_latents.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function [examples_at_step] = load_latents(filename, pos_or_neg) %pos_or_neg = 0 means both types of examples,
%pos_or_neg = 1 means only postives
%pos_or_neg = -1 means only negatives
num_kernels=5;
spl= load(filename);
if abs(pos_or_neg)<1e-4,
spl = abs(spl);
elseif pos_or_neg >.5,
disp 'pos only'
spl = spl.*(spl>0);
elseif pos_or_neg<.5,
spl = -spl.*(spl<0);
end
num_examples = size(spl,2)/num_kernels;
assert(floor(num_examples)==num_examples);
examples_at_step = ones(size(spl,1),num_kernels);
for j=1:num_kernels,
matrix = spl(:,j:num_kernels:size(spl,2));
examples_at_step(:,j) = sum(matrix,2);
end
plot(examples_at_step);
end