melmasri / traveltimeHMM

Travel time prediction from GPS observations using an HMM
9 stars 2 forks source link

timeTravelHMM: content of seed is not used #7

Closed ericgermaining closed 5 years ago

ericgermaining commented 5 years ago

In timeTravelHMM, if a seed is provided, then the values of init.0 and tmat.0 are calculated in place of the default values. However, the seed value is not used in the calculation itself. I suppose that if a user provides a seed, it is for the purpose of having the seed used in the calculation.

if(!is.null(seed) && is.numeric(seed)){
    init.0 <- runif(nQ) # gives a vector of random values between 0 and 1
    init.0 <- init.0/sum(init.0) # normalizes the vector
    tmat.0 <- matrix(runif(nQ^2), nQ, nQ) # gives a matrix of random values between 0 and 1
    tmat.0 <- c(t(tmat.0/rowSums(tmat.0))) # normalizes each row
melmasri commented 5 years ago

Do you have a general plan for this part of the code. I can just simply add the seed in the master branch?, let me know @ericgermaining

ericgermaining commented 5 years ago

@melmasri Yes please go ahead in the master branch. Thanks.

ericgermaining commented 5 years ago

@melmasri I integrated your code in the review-stuff branch.