Comments (2)
Sorry about this. Definitely a bug. I just pushed a fix. Keep in mind that the timeseries and HMM stuff is in beta. No guarantees. To validate the bug fix try this test script.
Thanks and good luck,
Kenny
prtPath( 'alpha', 'beta' ); % make sure prtDataSetTimeSeries is on path
% Generate two HMMs for drawing data
% The second one has a flipped transition matrix.
A = [.9 .1 0; 0 .9 .1; .1 0 .9];
gaussians = repmat(prtRvMvn('sigma',eye(2)),3,1);
gaussians(1).mu = [-2 -2];
gaussians(2).mu = [2 -2];
gaussians(3).mu = [2 2];
sourceHmm1 = prtRvHmm('pi',[1 1 1]/3,...
'transitionMatrix',A,...
'components',gaussians);
sourceHmm2 = prtRvHmm('pi',[1 1 1]/3,...
'transitionMatrix',flipud(A),...
'components',gaussians);
% Draw data from these HMMs
nTimeSeriesPerClass = 50;
nSamplesPerTimeSeries = 100;
x = cat(1,sourceHmm1.draw(ones(1,nTimeSeriesPerClass)*nSamplesPerTimeSeries),sourceHmm2.draw(ones(1,nTimeSeriesPerClass)*nSamplesPerTimeSeries));
y = prtUtilY(nTimeSeriesPerClass,nTimeSeriesPerClass);
% Place into to a dataSetTimeSeries
ds = prtDataSetTimeSeries(x,y);
ds.classNames = {'Class A','Class flipud(A)'};
% Train a MAP classifier that uses HMMs to model each class
class = train(prtClassMap('rvs',prtRvHmm('components',repmat(prtRvMvn,3,1))),ds);
% Evaluate the classifier (Note: No cross-validation is performed here!!!
out = run(class,ds); % Note: out is a prtDataSetClass
prtScoreRoc(out)
% Plot the learned HMM parameters
figure
subplot(2,4,1)
class.rvs(1).components(1).plotPdf([-5 5 -5 5])
title('Class 1 Component 1 pdf')
subplot(2,4,2)
class.rvs(1).components(2).plotPdf([-5 5 -5 5])
title('Class 1 Component 2 pdf')
subplot(2,4,3)
class.rvs(1).components(3).plotPdf([-5 5 -5 5])
title('Class 1 Component 3 pdf')
subplot(2,4,4)
prtUtilPlotMatrixTable(class.rvs(1).transitionMatrix);
title('Class 1 Transition Matrix')
subplot(2,4,5)
class.rvs(2).components(1).plotPdf([-5 5 -5 5])
title('Class 2 Component 1 pdf')
subplot(2,4,6)
class.rvs(2).components(2).plotPdf([-5 5 -5 5])
title('Class 2 Component 2 pdf')
subplot(2,4,7)
class.rvs(2).components(3).plotPdf([-5 5 -5 5])
title('Class 2 Component 3 pdf')
subplot(2,4,8)
prtUtilPlotMatrixTable(class.rvs(2).transitionMatrix);
title('Class 2 Transition Matrix')
from prt.
Test script reports no problem. Thank you for the quick response.
from prt.
Related Issues (20)
- improvement: hyperparameters optimization (quasi-newton) in Gaussian Process regression HOT 1
- proposal: remove prtDataSetCellArray HOT 3
- Problem building regression with LibSVM
- Is it possible to set one data set as a training set and another data set as a testing set in classification? HOT 1
- Pass userData to output data set in cross-validation or binaryToMaryOneVsAll HOT 6
- Bootstrap without replacement HOT 1
- Problem with targetNames with retainTargets() HOT 1
- prtUtilSumExp with no inputs causes seg fault HOT 1
- prtUtilSumExp needs help entry HOT 1
- prtDecisionBinaryMinPe chooses a threshold right at the hairy edge
- PRT Document Update HOT 6
- Add hierarchical labeling to data
- Fix to Issue #57 has unintended consequences HOT 6
- Make scatter alpha user settable HOT 1
- Proposal - All clustering objects sort their cluster indices by increasing first dim HOT 2
- prtClusterKmodes references non-existing variable inputStructure
- prtClusterMeanShift uses graphconncomp which is in bio-informatics
- prtFeatSelSfs should optionally optimize for any #features < #features you selected
- prtFeatSel Exhaustive should be able to search over different #features
- Change prtRvUniform to accept upper bound == lower bound HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prt.