Skip to content

Commit

Permalink
format output of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krebs committed Nov 12, 2015
1 parent e11a0b4 commit 3916d5c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/BeatTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function init_model(obj)
function init_train_data(obj)
% set up the training data and load or compute the cluster
% assignments of the bars/beats
fprintf('* Set up training data ...\n');
fprintf('* Set up training data\n');
% check if features are already saved
if isfield(obj.Params, 'stored_train_data_fln') && ...
exist(obj.Params.stored_train_data_fln, 'file') && ...
Expand Down Expand Up @@ -156,7 +156,7 @@ function init_train_data(obj)
obj.train_data = obj.train_data.read_pattern_bars(...
obj.Params.clusterIdFln, obj.Params.pattern_size);
else
fprintf('* Clustering data by %s ...\n', ...
fprintf('* Clustering data by %s: ', ...
obj.Params.cluster_type);
if ismember(obj.Params.cluster_type, {'meter', ...
'rhythm'})
Expand All @@ -180,7 +180,7 @@ function init_train_data(obj)
'plotting_path', obj.Params.results_path);
end
end
fprintf('done\n %i clusters detected.\n', ...
fprintf(' %i clusters detected.\n', ...
obj.train_data.clustering.n_clusters);
end
obj.Params.R = obj.train_data.clustering.n_clusters;
Expand All @@ -198,7 +198,7 @@ function init_test_data(obj)
end

function train_model(obj)
fprintf('* Training model (%s) ...\n',...
fprintf('* Training model (%s)\n',...
obj.Params.inferenceMethod)
if isempty(obj.init_model_fln)
obj.model.train_model(obj.Params.transition_params, ...
Expand Down Expand Up @@ -233,7 +233,7 @@ function train_model(obj)

function results = do_inference(obj, test_file_id)
[~, fname, ~] = fileparts(obj.test_data.file_list{test_file_id});
fprintf('* Started inference on %s', fname);
fprintf('* Inferring meter from %s\n', fname);
% load feature
observations = obj.feature.load_feature(...
obj.test_data.file_list{test_file_id}, ...
Expand Down
2 changes: 1 addition & 1 deletion src/BeatTrackingModelHMM.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function make_initial_distribution(obj, train_data)
do_output, fname, y);
elseif strcmp(inference_method, 'HMM_viterbi')
% decode MAP state sequence using Viterbi
fprintf('* Decoding (viterbi) .');
fprintf('* Decoding (viterbi)');
if exist('belief_func', 'var')
% use viterbi with belief functions
hidden_state_sequence = obj.viterbi_iteration(obs_lik, ...
Expand Down
5 changes: 0 additions & 5 deletions src/ParticleFilter.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
debug = 0;
% initialize particles and preallocate memory
n_frames = size(obs_lik, 3);
perc = round(0.1*n_frames);
% add one frame, which corresponds to the initial distribution
% at time 0 before the first observation comes in
m = zeros(obj.n_particles, n_frames + 1, 'single');
Expand Down Expand Up @@ -66,11 +65,7 @@
logP_data_pf(:, 4, iFrame) = w;
logP_data_pf(:, 5, iFrame) = g;
end
if rem(iFrame, perc) == 0
fprintf('.');
end
end
fprintf('\n');
% remove initial state
m = m(:, 2:end); n = n(:, 2:end); r = r(:, 2:end);
if debug, save('/tmp/data_pf.mat', 'logP_data_pf', 'obs_lik'); end
Expand Down
5 changes: 5 additions & 0 deletions tests/ExamplesTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
methods (Test)
function testEx1(testCase)
addpath(testCase.example_path)
fprintf('\ntestEx1: \n');
% Beat tracking with a pre-trained HMM
Results = ex1_beat_tracking_with_pretrained_hmm(...
testCase.audio_files{1}, testCase.result_folder);
Expand All @@ -22,6 +23,7 @@ function testEx1(testCase)

function testEx2(testCase)
addpath(testCase.example_path)
fprintf('\ntestEx2: \n');
% Beat tracking with a pre-trained PF
% Initialize the random number generator using a seed of 1
% to make the results in this example repeatable
Expand All @@ -36,6 +38,7 @@ function testEx2(testCase)

function testEx3(testCase)
addpath(testCase.example_path)
fprintf('\ntestEx3: \n');
rng('default'); rng(1);
% Train a HMM and test it
Results = ex3_train_and_test_hmm(testCase.audio_files{1}, ...
Expand All @@ -48,6 +51,7 @@ function testEx3(testCase)

function testEx4(testCase)
addpath(testCase.example_path)
fprintf('\ntestEx4: \n');
rng('default'); rng(1);
% Train a HMM and test it
Results = ex4_train_and_test_hmm(testCase.audio_files{1}, ...
Expand All @@ -60,6 +64,7 @@ function testEx4(testCase)

function testEx5(testCase)
addpath(testCase.example_path)
fprintf('\ntestEx5: \n');
rng('default'); rng(1);
% Train a HMM and test it
Results = ex5_train_and_test_pf(testCase.audio_files{1}, ...
Expand Down
2 changes: 1 addition & 1 deletion tests/run_all_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
suiteFolder = TestSuite.fromFolder(pwd);
% Add the bayesbeat class to the search path
[func_path, ~, ~] = fileparts(mfilename('fullpath'));
addpath(fullfile(func_path, '..'))
addpath(fullfile(func_path, '../src'))
% Test it
result = run(suiteFolder);

0 comments on commit 3916d5c

Please sign in to comment.