Comments (5)
This should work now, with the latest github version I get no errors and reasonable results. I'll update the CRAN version soon.
from seqhmm.
This sounds like a bug, but I think I would need a fully reproducible example to track it down, as I don't immediately see how this kind of error could occur.
from seqhmm.
I am getting the same error with this example, too:
df = data.frame('event_1' = c(2,2,2,2,2),
'event_2' = c(4,9,5,8,4),
'event_3' = c(9,4,9,4,8),
'event_4' = c(8,8,8,9,6),
'event_5' = c(6,6,4,6,9),
'event_6' = c(5,1,6,5,1),
'event_7' = c(1,7,1,1,5),
'event_8' = c(7,5,7,7,7),
'event_9' = c(3,3,3,3,3))
pheno_seq <- seqdef(df, start = 1)
sc_initmod <- build_mm(observations = pheno_seq)
sc_fit <- fit_model(sc_initmod, em_step = TRUE, global_step = TRUE, local_step = TRUE,
control_em = list(print_level = 2, restart = list(times = 10, reltol = 1e-20)))
sc_fit$logLik
which produces
iter: 1 logLik: -38.901 relative change: 1
Error in if (em.con$reltol < resEM$change) { : argument is of length zero
In addition: There were 11 warnings (use warnings() to see them)
from seqhmm.
edit: If I remove the last sequence from your data everything seems to work fine.
There seems to be a bug in build_mm
, which leads to incorrect transition matrix (notice the row 3 is full of zeroes):
sc_initmod$transition_probs
to
from 1 2 3 4 5 6 7 8 9
1 0.0 0 0.0 0.0 0.2 0.0 0.8 0.0 0.0
2 0.0 0 0.0 0.4 0.2 0.0 0.0 0.2 0.2
3 0.0 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
4 0.0 0 0.0 0.0 0.0 0.2 0.0 0.4 0.4
5 0.4 0 0.2 0.0 0.0 0.0 0.2 0.0 0.2
6 0.4 0 0.0 0.0 0.4 0.0 0.0 0.0 0.2
7 0.0 0 0.8 0.0 0.2 0.0 0.0 0.0 0.0
8 0.0 0 0.0 0.4 0.0 0.6 0.0 0.0 0.0
9 0.2 0 0.0 0.2 0.0 0.2 0.0 0.4 0.0
from seqhmm.
Actually it is not really a bug, because there is zero transitions from 3, so even though by definition the transition probabilities from each state should sum to one, we don't have any clue for those for state 3. I'll change the function so that it will define such a state absorbing i.e. that the corresponding diagonal element is 1.
Running the above example with sc_initmod$transition_probs[3,3]<-1
seems to work for local and global steps, but the EM still does not work properly, likely because within EM algorithm we are dividing by the number of transition from state 3 which is zero.
from seqhmm.
Related Issues (20)
- [Help request] How to test the model? HOT 1
- can this package support Multivariate Discrete HMM?? HOT 3
- will it work for multivariate time series prediction : different continues or/and discrete/category observation HOT 4
- HMM cluster assignments HOT 2
- seqdata should be a state sequence object HOT 1
- Apply to financial time series? HOT 1
- Parsing HMMER3 files HOT 2
- 'System seems singular' and 'EM algorithm failed' for Mixture Markov Model HOT 2
- Building a model with different sequence lengths HOT 1
- hidden_paths does not respect sequence length HOT 4
- Parallel computation HOT 2
- Forward probability of MHMM vs HMM HOT 1
- standard errors for HMM parameters HOT 3
- Maximum number of colours in cpal/colorpalette HOT 4
- Extracting combinations of emitted states HOT 4
- Absorbing state broken in `build_mm()` (seqhmm 1.2.1-1) HOT 1
- Runtime Estimation HOT 1
- EM algorithm failed HOT 1
- Error: number of labels must equal number of states in the alphabet HOT 4
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 seqhmm.