Skip to content

Commit

Permalink
added documentation and licensing information
Browse files Browse the repository at this point in the history
darcs-hash:20071106223150-4ed31-5081cfd33b91210716a4e89f4731d06ea3cd361f.gz
  • Loading branch information
ronw committed Nov 6, 2007
1 parent f135bc3 commit 07be09e
Show file tree
Hide file tree
Showing 23 changed files with 1,039 additions and 1 deletion.
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions celltools/@lazymap/lazymap.m
Expand Up @@ -28,6 +28,21 @@
% %
% 2007-11-01 ronw@ee.columbia.edu % 2007-11-01 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if ~isa(fun, 'function_handle') if ~isa(fun, 'function_handle')
error('1st argument must be a function handle') error('1st argument must be a function handle')
end end
Expand Down
5 changes: 5 additions & 0 deletions celltools/README
@@ -0,0 +1,5 @@
This package contains a set of standard functional programming tools
that can be used on cell arrays. Contains implementations of map,
reduce, filter (called cfilter so as not to conflict with the filter()
function in the Signal Processing Toolbox), and lazymap which has the
same semantics as map but uses lazy evaluation.
15 changes: 15 additions & 0 deletions celltools/cfilter.m
Expand Up @@ -5,6 +5,21 @@
% %
% 2007-11-06 ronw@ee.columbia.edu % 2007-11-06 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if ~isa(fun, 'function_handle') if ~isa(fun, 'function_handle')
error('1st argument must be a function handle') error('1st argument must be a function handle')
end end
Expand Down
15 changes: 15 additions & 0 deletions celltools/map.m
Expand Up @@ -7,6 +7,21 @@
% %
% 2007-11-06 ronw@ee.columbia.edu % 2007-11-06 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if ~isa(fun, 'function_handle') if ~isa(fun, 'function_handle')
error('1st argument must be a function handle') error('1st argument must be a function handle')
end end
Expand Down
15 changes: 15 additions & 0 deletions celltools/reduce.m
Expand Up @@ -12,6 +12,21 @@
% %
% 2007-11-06 ronw@ee.columbia.edu % 2007-11-06 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if ~isa(fun, 'function_handle') if ~isa(fun, 'function_handle')
error('1st argument must be a function handle') error('1st argument must be a function handle')
end end
Expand Down
59 changes: 59 additions & 0 deletions hmm/README
@@ -0,0 +1,59 @@
This package contains a set of functions for evaluating HMMs and GMMs.

* Functions

- The important ones:
- eval_gmm - compute the posterior probability of a GMM given data
- eval_hmm - compute the posterior probabilities of all possible HMM
state sequences given data
- decode_hmm - find the most likely state sequence through the HMM
given data

- Utility functions:
- logsum - takes the sum of a matrix of log likelihoods
- lmvnpdf - compute the log probability of data under a
multivariate Gaussian distribution

* Data Structures

The functions in this toolbox pass around the following structures:
Note: all probabilities are stored as log probabilities

** GMM
- gmm.nmix - number of components in the mixture
- gmm.priors - array of prior log probabilities over each state
- gmm.means - matrix of means (column x is mean of component x)
- gmm.covars - matrix of covariance (column x is the diagonal of the
covariance matrix of component x)

** HMM with GMM observations
- hmm.name -
- hmm.nstates - number of states in the HMM
- hmm.emission_type - 'GMM'
- hmm.start_prob - array of log probs P(first observation is state x)
- hmm.end_prob - array of log probs P(last observation is state x)
- hmm.transmat - matrix of transition log probs (transmat(x,y)
= log(P(transition from state x to state y)))
- hmm.labels - optional cell array of labels for each state in the HMM
(for use in composing HMMs)
- hmm.gmms - array of GMM structures

** HMM with Gaussian observations
- hmm.nstates - number of states in the HMM
- hmm.emission_type - 'gaussian'
- hmm.start_prob - array of log probs P(first observation is state x)
- hmm.end_prob - array of log probs P(last observation is state x)
- hmm.transmat - matrix of transition log probs (transmat(x,y)
= log(P(transition from state x to state y)))
- hmm.labels - optional cell array of labels for each state in the HMM
(for use in composing HMMs)
- hmm.means - matrix of means (column x is mean of state x)
- hmm.covars - matrix of means (column x is the diagonal of the
covariance matrix of component x)

Note that each row of exp(hmm.transmat) does not necessarily sum to 1
because for each state x there is some probability
(exp(hmm.exit_prob(x))) that the next transition will be to a
non-emitting exit state (i.e. the current observation is the last
observation in the sequence). The correct invariant is:
sum(exp(hmm.transmat, 2)) + exp(hmm.exit_prob) == ones(hmm.nstates, 1)
15 changes: 15 additions & 0 deletions hmm/convert_hmm_to_gaussian_emissions.m
Expand Up @@ -6,6 +6,21 @@
% %
% 2007-01-18 ronw@ee.columbia.edu % 2007-01-18 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

for n = 1:length(hmms) for n = 1:length(hmms)
if strcmp(hmms(n).emission_type, 'gaussian') if strcmp(hmms(n).emission_type, 'gaussian')
new_hmms(n) = hmms(n); new_hmms(n) = hmms(n);
Expand Down
15 changes: 15 additions & 0 deletions hmm/decode_hmm.m
Expand Up @@ -6,6 +6,21 @@
% %
% 2007-02-26 ronw@ee.columbia.edu % 2007-02-26 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

zeroLogProb = -1e200; zeroLogProb = -1e200;


% no rank pruning by default % no rank pruning by default
Expand Down
15 changes: 15 additions & 0 deletions hmm/eval_gmm.m
Expand Up @@ -9,6 +9,21 @@
% %
% 2005-11-20 ronw@ee.columbia.edu % 2005-11-20 ronw@ee.columbia.edu


% Copyright (C) 2005-2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

[ndim, ndat] = size(data); [ndim, ndat] = size(data);


p = zeros(gmm.nmix, ndat); p = zeros(gmm.nmix, ndat);
Expand Down
15 changes: 15 additions & 0 deletions hmm/eval_hmm.m
Expand Up @@ -6,6 +6,21 @@
% %
% 2007-02-26 ronw@ee.columbia.edu % 2007-02-26 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

zeroLogProb = -1e200; zeroLogProb = -1e200;


% no rank pruning by default % no rank pruning by default
Expand Down
15 changes: 15 additions & 0 deletions hmm/lmvnpdf.m
Expand Up @@ -12,6 +12,21 @@
% %
% 2006-06-19 ronw@ee.columbia.edu % 2006-06-19 ronw@ee.columbia.edu


% Copyright (C) 2006-2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if nargin < 3 if nargin < 3
cv = 1; cv = 1;
end end
Expand Down
15 changes: 15 additions & 0 deletions matlab_htk/apply_mllr_transform.m
Expand Up @@ -6,6 +6,21 @@
% %
% 2007-02-20 ronw@ee.columbia.edu % 2007-02-20 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if isfield(hmms, 'hmms') if isfield(hmms, 'hmms')
% we got a recognizer structure, not a list of hmms % we got a recognizer structure, not a list of hmms
hmms.hmms = apply_mllr_transform(hmms.hmms, W, b); hmms.hmms = apply_mllr_transform(hmms.hmms, W, b);
Expand Down
15 changes: 15 additions & 0 deletions matlab_htk/compose_hmms.m
Expand Up @@ -13,6 +13,21 @@
% %
% 2006-12-01 ronw@ee.columbia.edu % 2006-12-01 ronw@ee.columbia.edu


% Copyright (C) 2006-2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

% shutup with the logOfZero warnings when in this function % shutup with the logOfZero warnings when in this function
w = warning('query', 'MATLAB:log:logOfZero'); w = warning('query', 'MATLAB:log:logOfZero');
if strcmp(w.state, 'on') if strcmp(w.state, 'on')
Expand Down
15 changes: 15 additions & 0 deletions matlab_htk/eval_htk_recognizer.m
Expand Up @@ -10,6 +10,21 @@
% %
% 2007-01-17 ronw@ee.columbia.edu % 2007-01-17 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if isstr(data) if isstr(data)
% data contains the name of an SCP file % data contains the name of an SCP file
data = read_text_file(data); data = read_text_file(data);
Expand Down
15 changes: 15 additions & 0 deletions matlab_htk/kmeans.m
Expand Up @@ -5,6 +5,21 @@
% %
% 2006-12-07 ronw@ee.columbia.edu % 2006-12-07 ronw@ee.columbia.edu


% Copyright (C) 2006 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

if nargin < 2 if nargin < 2
nclust = 10; nclust = 10;
end end
Expand Down
15 changes: 15 additions & 0 deletions matlab_htk/learn_mllr_transform.m
Expand Up @@ -6,6 +6,21 @@
% %
% 2007-02-13 ronw@ee.columbia.edu % 2007-02-13 ronw@ee.columbia.edu


% Copyright (C) 2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

% is adaptation data a list of filenames? % is adaptation data a list of filenames?
adapt_dat_contains_data = 0; adapt_dat_contains_data = 0;
if iscell(adapt_dat) if iscell(adapt_dat)
Expand Down
15 changes: 15 additions & 0 deletions matlab_htk/read_htk_hmm.m
Expand Up @@ -7,6 +7,21 @@
% %
% 2006-06-09 ronw@ee.columbia.edu % 2006-06-09 ronw@ee.columbia.edu


% Copyright (C) 2006-2007 Ron J. Weiss
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.

% Read the M-file into a cell array of strings: % Read the M-file into a cell array of strings:
[fid, message] = fopen(filename, 'rt'); [fid, message] = fopen(filename, 'rt');
warning(message) warning(message)
Expand Down

0 comments on commit 07be09e

Please sign in to comment.