-
Notifications
You must be signed in to change notification settings - Fork 0
/
Demo.m
44 lines (41 loc) · 1.15 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
%% scWMC DEMO:
%% Clear all variables
clear;
addpath('code/lib/PROPACK','code/utils');
%% Load the data
% There are three datasets in the .mat file. There are the true data set,
% Drop-out data set, and the bulk data set.
load('code/data/demo_data.mat')
data_sc = data_dropout;
%% Parameters
Par.lam = 0.8;
Par.rho = 0.8 ;
Par.mu1 = 0.00001;
Par.mu2 = 0.00001;
Par.iter = 100;
%% Run scWMC
dataRecovered = impute(data_sc, Par);
dataRecovered = max(dataRecovered, 0);
index = find(data_sc);
dataRecovered(index) = data_sc(index);
%% SAVE result
% writematrix(dataRecovered,'data/scWMC.csv');
Fro_error = norm(dataRecovered - data_true, 'fro');
disp(['****** L_2 error is ' num2str(Fro_error) '******']);
R = corrcoef(dataRecovered, data_true);
disp(['******Pearson is ' num2str(R(1,2)) '******']);
%% Plot the results
gcf = figure(1);
set(gcf, 'Position', [100, 500, 1200, 300])
subplot(1,3,1)
imagesc(log10(data_true 1))
title('True Data')
axis off
subplot(1,3,2)
imagesc(log10(data_sc 1))
title('Drop-out Data')
axis off
subplot(1,3,3)
imagesc(log10(dataRecovered 1))
title('Imputed Data by scWMC')
axis off