Skip to content

Commit

Permalink
#129 making more tests pass for nonparametric model
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Vincent committed Dec 15, 2016
1 parent d1ed142 commit ef51ff0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
27 changes: 14 additions & 13 deletions ddToolbox/models/nonparametric_models/DF_NonParametric.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
properties
delays % vector of delays
AUC % A Stochastic object
timeUnits = 'days' %<------------------- TODO: inject this
end

methods (Access = public)
Expand Down Expand Up @@ -36,21 +37,24 @@


function plot(obj)
% visualise the discount function
SAMPLES_TO_PLOT = 100;
timeUnitFunction = str2func(obj.timeUnits);

%% visualise the posterior predictive indifference points
intervals = [50 95];

% RIBBON PLOT
%% RIBBON PLOT
%intervals = [50 95]; %<----------- TODO: inject this
%ribbon_plot(obj.delays, obj.theta, intervals); % TODO: replace, or inject the plot style we want

% PLOT N EXAMPLES
N = 200;
plot(obj.delays, obj.theta([1:N],:), 'Color',[0 0 0 0.05])

%% PLOT N EXAMPLES
% dont ask for more samples than we actually have
samples_to_plot = [1:min(SAMPLES_TO_PLOT, size(obj.theta,1))];
plot(timeUnitFunction(obj.delays),...
obj.theta(samples_to_plot,:),...
'Color',[0 0 0 0.05])
hold on

% ~~~~~~~~~~~~~
obj.data.plot()
dataPlotType = '2D' %<----------- TODO: inject this
obj.data.plot(dataPlotType, obj.timeUnits)
% ~~~~~~~~~~~~~

%% formatting
Expand All @@ -65,9 +69,6 @@ function plot(obj)
%% add AUC measure text to graph
%auc_str = sprintf('mean AUC: %1.2f', mean(personInfo.AUCsamples));
%addTextToFigure('TR',auc_str, 15, 'latex')



end


Expand Down
3 changes: 2 additions & 1 deletion tests/test_AllNonParametricModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function defaultSampler(testCase, model)
'mcmcParams', struct('nsamples', 100,...
'nchains', 2,...
'nburnin', 10),...
'shouldPlot','no');
'shouldPlot','no',...
'shouldExport',false);
% TODO: DO AN ACTUAL TEST HERE !!!!!!!!!!!!!!!!!!!!!!

model.plot()
Expand Down

0 comments on commit ef51ff0

Please sign in to comment.