https://github.com/Hongyu-Miao/DMI
Raw File
Tip revision: fb3e484da2ecff9ab22c28df7fb91ffedea92bb5 authored by Hongyu Miao on 13 September 2016, 14:27:07 UTC
Add files via upload
Tip revision: fb3e484
gene_demo.m
%In case of the environment problem
clear all;
close all;

fprintf('DMI method starts:\n');

ts = importdata('X.mat');
gsd = importdata('bg.mat');
[N, T] = size(ts);

D = (ts(:,2:T)-ts(:,1:(T-1)));
X = ts(:,1:(T-1));

% amount of iterations and control the penalty of l21 norm and l1 norm with different alpha and beta respectively.
K = 1000;
alpha = 0.081; beta = 0.22;

% ADMM method solves this problem and then give the prediction A1
A1 = ADMM2AFast(D,X,N,alpha,beta,K,gsd,gsd);
% if there could be non-positive number in the practical case ,please
% delete abs

fprintf('Calculation is done here!\n');

load('FromID.mat');% this file contains array 'a'
load('ToID.mat');% this file contains array 'b'
load('name.mat');
f1 = fopen('scores_edges_filtered.txt','w+');
for i = 1:length(a)
    namea = strsplit(name{a(i)}, '\t');
    nameb = strsplit(name{b(i)}, '\t');
    fprintf(f1,'%s\t%s\t%s\t%s\t%f\n',namea{1},namea{2},nameb{1},nameb{2},full(A1(b(i),a(i))));
end
fclose(f1);

fprintf('Please check the result in scores_edges_filtered.txt\n');
back to top