-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ben Vincent
committed
May 14, 2017
1 parent
229d050
commit 95e8dc0
Showing
6 changed files
with
74 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
filename,id | ||
AC-kirby27.txt,AC | ||
BL-kirby27.txt,BL | ||
bv-kirby27.txt,BV | ||
CS-kirby27.txt,CS | ||
EP-kirby27.txt,EP | ||
JR-kirby27.txt,JR | ||
KA-kirby27.txt,KA | ||
LJ-kirby27.txt,LJ | ||
LY-kirby27.txt,LY | ||
NA-kirby27.txt,NA | ||
rm-kirby27.txt,RM | ||
SB-kirby27.txt,SB | ||
SK-kirby27.txt,SK | ||
VD-kirby27.txt,VD | ||
vs-kirby27.txt,VS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,71 @@ | ||
classdef test_PlotAllModels < matlab.unittest.TestCase | ||
|
||
properties | ||
data | ||
savePath = tempname(); % matlab auto-generated temp folders | ||
end | ||
|
||
properties (TestParameter) | ||
% model = {'ModelHierarchicalME_MVNORM',... | ||
% 'ModelHierarchicalME',... | ||
% 'ModelHierarchicalMEUpdated',... | ||
% 'ModelMixedME',... | ||
% 'ModelSeparateME',... | ||
% 'ModelHierarchicalLogK',... | ||
% 'ModelMixedLogK',... | ||
% 'ModelSeparateLogK',... | ||
% 'ModelSeparateNonParametric',... | ||
% 'ModelHierarchicalExp1', 'ModelMixedExp1', 'ModelSeparateExp1'} | ||
model = getAllParametricModelNames; | ||
pointEstimateType = {'mean','median','mode'} | ||
model = getAllParametricModelNames; | ||
pointEstimateType = {'mean','median','mode'}; | ||
dataset = {'kirby', 'non_parametric'}; | ||
chains = {2,3} | ||
end | ||
|
||
%% CLASS-LEVEL SETUP/TEARDOWN ----------------------------------------- | ||
methods (TestClassSetup) | ||
function setup(testCase) | ||
% assuming this is running on my maching | ||
addpath('~/git-local/delay-discounting-analysis/ddToolbox') | ||
%datapath = '~/git-local/delay-discounting-analysis/demo/datasets/kirby'; | ||
datapath = '~/git-local/delay-discounting-analysis/demo/datasets/non_parametric'; | ||
|
||
% only analyse 2 people, for speed of running tests | ||
filesToAnalyse = allFilesInFolder(datapath, 'txt'); | ||
filesToAnalyse = filesToAnalyse(1:2); | ||
|
||
testCase.data = Data(datapath, 'files', filesToAnalyse); | ||
end | ||
end | ||
|
||
|
||
% methods (TestClassSetup) | ||
% function setup(testCase) | ||
% end | ||
% end | ||
|
||
|
||
methods(TestClassTeardown) | ||
|
||
function remove_temp_directory(testCase) | ||
rmdir(testCase.savePath,'s') | ||
end | ||
|
||
function delete_stan_related_outputs(testCase) | ||
delete('*.data.R') | ||
delete('*.csv') | ||
end | ||
|
||
function close_figures(testCase) | ||
close all | ||
end | ||
|
||
end | ||
|
||
|
||
%% THE ACTUAL TESTS --------------------------------------------------- | ||
|
||
methods (Test) | ||
|
||
function plot(testCase, model) | ||
% make model | ||
|
||
function plot(testCase, model, dataset) | ||
|
||
%% Set up data | ||
datapath = ['~/git-local/delay-discounting-analysis/demo/datasets/' dataset]; | ||
% assuming this is running on my maching | ||
addpath('~/git-local/delay-discounting-analysis/ddToolbox') | ||
% only analyse 2 people, for speed of running tests | ||
filesToAnalyse = allFilesInFolder(datapath, 'txt'); | ||
filesToAnalyse = filesToAnalyse(1:2); | ||
testCase.data = Data(datapath, 'files', filesToAnalyse); | ||
|
||
%% Run model | ||
makeModelFunction = str2func(model); | ||
model = makeModelFunction(testCase.data,... | ||
'savePath', testCase.savePath,... | ||
'shouldPlot','yes',... | ||
'shouldExportPlots', false,... | ||
'mcmcParams', struct('nsamples', 1000,... | ||
'nchains', 2,... | ||
'nburnin', 1000)); | ||
'nchains', 2,... | ||
'nburnin', 1000)); | ||
%model.plot(); | ||
|
||
% TODO: DO AN ACTUAL TEST HERE !!!!!!!!!!!!!!!!!!!!!! | ||
end | ||
|
||
end | ||
|
||
end |