Code

Project: Box2D_friction_mod

test_TopDownCar.py      WheelConstraint.h      test_TopDownFrictionJoint.py      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

migrateMailbox.scpt.txt     

Project: Infinite HMM Tutorial

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

Project: Arduino_Code

arduino-serial.c      Arduino_Code.zip      convert_range2D.py      plot_ardunio_data.sh      oscilloscope.pde      oscilloscope.sh      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      plot_output.py     

Project: ArduCom

arducom.py      setup.py     

Project: Dirichlet Process Mixture Tutorial

EM_GM.m      DP_Demo.m      DP_Tutorial.zip      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/HMMProblem.m"

resources/code/Infinite HMM Tutorial/HMMProblem.m

classdef HMMProblem < handle
    % A wrapper for the HMM classes to set up runs on the example problem
    % from the original iHMM paper (Beal et al 2003).
    %
    % Jonathan Scholz
    % jkscholz@gatech.edu
    % 11/2/2011
   
    properties(Access=public)
        hmm; % A public hmm type that will be accessible to outside users after run is complete
    end
   
    methods(Access=public)
        function runFixed(obj, nStates, nSamplingIterations, showProgress, collectSamples)
            obj.setUpFixedHMM(nStates);
            obj.hmm.runSampler(nSamplingIterations, collectSamples, showProgress);
            obj.hmm.sortCPT();
            obj.hmm.plot();
        end
       
        function setUpFixedHMM(obj, nStates)
            obj.hmm = HMM();
            incrStepSize = 1; % experimental parameter to make gibbs sampling step size adjustable
            softMaxBeta = 1; % experimental parameter to softmax the likelihood distribution (makes it greedier)
           
            % Set up data for this problem
            [stateSequence, emissionSequence] = HMMProblem.initalizeSequences(nStates);
           
            % get data structures
            stateCPT = ConditionalProbabilityTable();
            emissionCPT = ConditionalProbabilityTable();
           
            % initialize data structures
            HMM.setCPTFromSequence(stateCPT, emissionCPT, stateSequence, emissionSequence, incrStepSize);
           
            % initialize the actual HMM
            obj.hmm.initialize(stateSequence, emissionSequence, stateCPT, emissionCPT, incrStepSize, softMaxBeta);
        end
       
       
        function runHDP(obj, nStates, nSamplingIterations, showProgress, collectSamples)
            obj.setUpHDPHMM(nStates);
            obj.hmm.runSampler(nSamplingIterations, collectSamples, showProgress);
            %obj.hmm.reorderStates();
            obj.hmm.plot();
        end
       
        function setUpHDPHMM(obj, nStates)
            obj.hmm = HDP_HMM();
            incrStepSize = 1; % experimental parameter to make gibbs sampling step size adjustable
            softMaxBeta = 1; % experimental parameter to softmax the likelihood distribution (makes it greedier)
           
            % Set up data for this problem
            [stateSequence, emissionSequence] = HMMProblem.initalizeSequences(nStates);
           
            % get data structures
            stateHDP = HDP();
            emissionHDP = HDP();
           
            % initialize data structures
            HDP_HMM.setHDPFromSequence(stateHDP, emissionHDP, stateSequence, emissionSequence, incrStepSize);
           
            % initialize the actual HMM
            obj.hmm.initialize(stateSequence, emissionSequence, stateHDP, emissionHDP, incrStepSize, softMaxBeta);
        end
    end
   
    methods(Access=public, Static)
        function [stateSequence, emissionSequence] = initalizeSequences(nStates)
            % Sets up the ascending-decending sequence example from Beal et
            % al 2003
           
            % Set a random state sequence
            seqLength = 300;
            stateSequence = setRandomSequence(nStates,seqLength);
           
            % Or pass the perfect sequence
            %stateSequence = repmat([1,2,3,4,5,6,7,8,9,10],1,30);
           
            % Set the Emission sequence
            emissionSequence = repmat([1,2,3,4,5,6,5,4,3,2],1,30);
           
            % Helper: Builds uniformly random trajectory with nPossibleStates
            function seq = setRandomSequence(nPossibleStates, len)
                seq = floor(nPossibleStates*rand(1,len)+1);
            end
        end
    end
end

About me

Pic of me