Project: Box2D_friction_mod      WheelConstraint.h      box2d_friction_joint.patch      b2FrictionJoint.h      TopDownCar.h      b2FrictionJoint.cpp      TestEntries.cpp      python_friction_joint.patch     

Project: jvfeatures

jvtypes.h      jvtypes.cpp      jvfeatures.h      chessSeg.cpp      jvtest.cpp      jvfeatures.cpp     

Project: Other


Project: Infinite HMM Tutorial

HMMProblem.m      HMM.m      README.txt      HDP.m      HDP_HMM.m      run.m      ConditionalProbabilityTable.m     

Project: Arduino_Code

arduino-serial.c      oscilloscope.pde      ranger_test.pde      accelerometer_test.pde      pwm_manual.pde      servo_test.pde      motordriver.pde      ranger_plane_sweep.pde      helicopter_controller.pde      clodbuster_controller.pde     

Project: RRT

BidirectionalRRT.cpp      RRT.tgz      AbstractRRT.cpp      RRT.h      RRT.cpp      rrt_test.cpp     

Project: ArduCom     

Project: Dirichlet Process Mixture Tutorial

EM_GM.m      DP_Demo.m      DirichletProcess.m      DPMM.m      gaussian_EM.m     

Project: support

Protector.php      geshi.php     

Project: Cogent

CodePane.php      Cogent.php      NotesPane.php      PubsTable.php      PicsPane.php     
Click here to download "resources/code/Infinite HMM Tutorial/ConditionalProbabilityTable.m"

resources/code/Infinite HMM Tutorial/ConditionalProbabilityTable.m

classdef ConditionalProbabilityTable < handle
    % An interface and basic implementation for defining conditional
    % probability tables.
    % The intended application is for use in an HMM, which learns this
    % distrubution using Gibbs sampling.  For these reason, the public
    % interface consists of functions for moving probability mass around
    % (incrementing and decrement), and getting the CPT (presumably to
    % evaluate various likelihoods).
    % Note that the internal representation is just an un-normalized matrix
    % of counters, which is more convenient to work with in our sampler.
    % Jonathan Scholz
    % 11/2/2011
    properties(Access=public) % protected
        % The primary data data structure for the CPT - an nXm matrix of
        % counters
        countMtr = [];
        function reset(obj)
            obj.countMtr = [];

        % Add qty probability mass to the jth component of the ith row
        function success = incrementCountMatrix(obj, i, j, qty)
            obj.countMtr(i, j) = obj.countMtr(i, j) + qty;
            success = true;
        % Remove qty probability mass from the jth component of the ith row
        function success = decrementCountMatrix(obj, i, j, qty)
            success = false;
            assert(i <= size(obj.countMtr,1) && j <= size(obj.countMtr,2));
            if obj.countMtr(i, j) >= qty
                obj.countMtr(i, j) = obj.countMtr(i, j) - qty;
                success = true;
        % Retreive the full count matrix
        function countMtr = getCountMatrix(obj)
            countMtr = obj.countMtr;
        % Compute the CPT
        function CPT = getCPT(obj)
            CM = obj.countMtr + 0.03; % pad count matrix to smooth out likelihoods a bit
            rowsums = sum(CM,2);
            CPT = bsxfun(@rdivide, CM, rowsums);
        % Set the internal Count Matrix
        function setCountMatrix(obj, countMtr)
            obj.countMtr = countMtr;

About me

Pic of me