You could try setting the covariance matrix type to 'tied'. This will force a 
single covariance matrix across all states.   

--  
Helge Reikeras


On Monday 26 August 2013 at 4:03 AM, Shuo Wang wrote:

> Hi Helge,
> thanks for the reply.
>  
> I have tried using first derivative to fit hmm. This is the results
>  
> 0th hidden state  
> ('mean = ', array([ 0.08534182,  0.07491009]))
> ('var = ', array([ 1.45029737,  1.23234594]))
> 1th hidden state
> ('mean = ', array([-0.25764837, -0.24770928]))
> ('var = ', array([ 0.06077981,  0.06085699]))
> 2th hidden state
> ('mean = ', array([ 0.10585516,  0.10645033]))
> ('var = ', array([ 0.04375404,  0.04436854]))
>  
> The problem is that hmm seems to separate the states by variance, because in 
> 0th state, I have big rise and down portions. This is similar to the stock 
> example here 
> http://scikit-learn.org/stable/auto_examples/applications/plot_hmm_stock_analysis.html#example-applications-plot-hmm-stock-analysis-py
>      
>  
> The 4th state identified is based on variance also. So how can I force the 
> state detection based on mean instead?
>  
>  
>  
> On Mon, Aug 26, 2013 at 1:31 AM, Helge Reikeras <[email protected] 
> (mailto:[email protected])> wrote:
> > Hi  
> >  
> > 1. From the source code it looks like predict is just a wrapper around 
> > decode. I see predict only returns the state sequence with largest 
> > likelihood while decode also returns the actual value of the log 
> > likelihood.   
> >  
> > 2. I'm no expert on modelling financial data but it sounds like you are 
> > mostly interested in the price change so using the first derivative (and 
> > maybe 2nd and higher derivatives) seems reasonable. As I guess the data is 
> > noisy you should probably compute these using something like SavitzkyGolay 
> > filter:  
> >  
> > http://wiki.scipy.org/Cookbook/SavitzkyGolay
> >  
> > Then the sign of the value of the first derivate feature in the state 
> > distribution mean will tell you if the state represent "up" or "down" 
> > (apply a distance from 0 threshold for "neutral") and the absolute value 
> > will give you the magnitude.  
> >  
> > Regards,  
> >  
> > --  
> > Helge Reikeras
> >  
> >  
> > On Sunday 25 August 2013 at 4:41 PM, Shuo Wang wrote:
> >  
> >  
> >  
> > > Hi,
> > >  
> > > I have two questions regarding the hmm model from a user's perspective,
> > >  
> > > 1. what is the difference between method decode and predict, they seems 
> > > to be having the same description  
> > >  
> > > 2. If i fit a financial time series into hmm, hmm seems to automatically 
> > > detect states based on mean and variance, so if I want it to detect 
> > > states related to regimes(up, down and neutral trends), I have to 
> > > transform price into binary time series, such as 1 indicates current 
> > > minute is a rise compare to previous minutes, -1 indicates current minute 
> > > is a drop compare to previous minutes, 0 is unchanged. But if I transform 
> > > my price info into binary information, I loss magnitude information. How 
> > > can I keep the magnitude information, yet still let the hmm detect up, 
> > > down and neutral trend, instead of mean and variance regimes.
> > >  
> > > --  
> > > 王硕
> > > 邮箱:[email protected] (mailto:[email protected])
> > > Whatever your journey, keep walking.  
> > > ------------------------------------------------------------------------------
> > > Introducing Performance Central, a new site from SourceForge and  
> > > AppDynamics. Performance Central is your source for news, insights,  
> > > analysis and resources for efficient Application Performance Management.  
> > > Visit us today!
> > > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> > >  
> > > _______________________________________________
> > > Scikit-learn-general mailing list
> > > [email protected] 
> > > (mailto:[email protected])
> > > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
> > >  
> > >  
> > >  
> >  
> >  
> >  
> > ------------------------------------------------------------------------------
> > Introducing Performance Central, a new site from SourceForge and
> > AppDynamics. Performance Central is your source for news, insights,
> > analysis and resources for efficient Application Performance Management.
> > Visit us today!
> > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Scikit-learn-general mailing list
> > [email protected] 
> > (mailto:[email protected])
> > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
> >  
>  
>  
>  
> --  
> 王硕
> 邮箱:[email protected] (mailto:[email protected])
> Whatever your journey, keep walking.  
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and  
> AppDynamics. Performance Central is your source for news, insights,  
> analysis and resources for efficient Application Performance Management.  
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
>  
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected] 
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>  
>  


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to