From ebef5b7a78daf9912f5d7af19b0f580699da0b4b Mon Sep 17 00:00:00 2001 From: Aaron Montag Date: Tue, 1 Dec 2015 09:40:21 +0100 Subject: [PATCH 1/3] changed ... to .. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aeb9614..34a1f81 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ configure the build process, e.g., cd code/dipha-pss mkdir build cd build -cmake ... +cmake .. make ``` From 22f4fefbbc6d6005fd6e4a61ecb2c561410c120c Mon Sep 17 00:00:00 2001 From: Aaron Montag Date: Wed, 9 Dec 2015 17:35:12 +0100 Subject: [PATCH 2/3] load the kernel-file into matlab --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 34a1f81..2121507 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,7 @@ the MATLAB interface to libsvm (see the libsvm documentation on how to compile the MATLAB interface). ```matlab +kernel = load('/tmp/kernel.txt'); labels = [ones(10,1);ones(10,1)*2]; % Create labels for training pos = randsample(1:20,15); % Indices of diagrams used for training neg = setdiff(1:20,pos); % Indices of diagrams used for testing From 9737919be78debe3676d592a747c16e8764f2acd Mon Sep 17 00:00:00 2001 From: Aaron Montag Date: Thu, 10 Dec 2015 13:15:21 +0100 Subject: [PATCH 3/3] minor fixes. "| sort" was essential for me to make the example work, randsample does not work for octave --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2121507..947ec47 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ In ```/tmp/``` we create such a list via ```bash cd /tmp/ -find . -name 'dmat*.pd' > diagrams.list +find . -name 'dmat*.pd' | sort > diagrams.list ``` Finally, we execute ```diagram_distance``` and compute features up to dimension two (set via ```---dim```). In our example, we compute @@ -260,7 +260,7 @@ time parameter of the kernel (set via ```--time```) to 0.1. ```bash -cd code/dipha-pss/build/bin +cd code/dipha-pss/build ./diagram_distance --inner_product --time 0.1 --dim 1 /tmp/diagrams.list > /tmp/kernel.txt ``` @@ -272,8 +272,8 @@ the MATLAB interface). ```matlab kernel = load('/tmp/kernel.txt'); labels = [ones(10,1);ones(10,1)*2]; % Create labels for training -pos = randsample(1:20,15); % Indices of diagrams used for training -neg = setdiff(1:20,pos); % Indices of diagrams used for testing +pos = sort(randperm(20)(1:15)); % Indices of diagrams used for training +neg = setdiff(1:20,pos); % Indices of diagrams used for testing model = svmtrain(labels(pos),[(1:length(pos))' kernel(pos,pos)], '-t 4 -c 1'); [pred,acc,~] = svmpredict(labels(neg), [(1:5)' kernel(neg,pos)], model); disp(acc);