-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathdemo.m
62 lines (37 loc) · 1.24 KB
/
demo.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% This file is part of OLSTEC package.
%
% Created by H.Kasai on June 07, 2017
clc;
clear;
close all;
%% set paramters
tensor_dims = [100, 100, 200];
rank = 5;
fraction = 0.1;
inverse_snr = 1e-4;
%% generate tensor
data_subtype = 'Static';
[A, ~, ~, Omega, ~, ~, ~, ~, ~, ~, ~, ~] = generate_synthetic_tensor(tensor_dims, rank, fraction, inverse_snr, data_subtype);
%% OLSTEC
tic;
options.verbose = 2;
[Xsol_olstec, infos_olstec, sub_infos_olstec] = olstec(A, Omega, [], tensor_dims, rank, [], options);
elapsed_time_olstec = toc;
%% plotting
fs = 20;
figure;
semilogy(sub_infos_olstec.inner_iter, sub_infos_olstec.err_residual, '-r', 'linewidth', 2.0);
legend('OLSTEC');
ax1 = gca;
grid on;
set(ax1,'FontSize',fs);
xlabel('data stream index','FontName','Arial','FontSize',fs,'FontWeight','bold');
ylabel('normalized residual error','FontName','Arial','FontSize',fs,'FontWeight','bold');
figure;
semilogy(sub_infos_olstec.inner_iter, sub_infos_olstec.err_run_ave, '-r', 'linewidth', 2.0);
legend('OLSTEC');
ax1 = gca;
grid on;
set(ax1,'FontSize',fs);
xlabel('data stream index','FontName','Arial','FontSize',fs,'FontWeight','bold');
ylabel('running average error','FontName','Arial','FontSize',fs,'FontWeight','bold');