Dear all,
I'm working on an hmm issue. I'll run hmmtrain command which looks like:
>> [EMSTTR, ESTEMIS]=hmmtrain(seq,trans,emis);
and i get the error:
??? Attempted to access e(1,0); index must be a positive integer or logical.
Error in ==> hmmdecode at 146
fs(state,count) = e(state,seq(count)) .* (sum(fs(:,count-1) .*tr(:,state)));
Error in ==> hmmtrain at 239
[p,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
The problem is with my data in seq. A row of my data in seq is looks like:
0,1,1,70,181,5450,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,8,8,0.00,0.00,0.00,0.00,1.00,0.00,0.00,9,9,1.00,0.00,0.11,0.00,0.00,0.00,0.00,0.00,138
As it's also including some non integer values, i've tried to round the matrix also and obtain an only integer matrix, but the problem remains.
Is there any idea about this problem?
Thanks
Burcu
|
|
0
|
|
|
|
Reply
|
burcu
|
12/30/2009 6:10:20 PM |
|
"burcu " <burcu102@hotmail.com> wrote in message <hhg52b$jss$1@fred.mathworks.com>...
> Dear all,
>
> I'm working on an hmm issue. I'll run hmmtrain command which looks like:
> >> [EMSTTR, ESTEMIS]=hmmtrain(seq,trans,emis);
> and i get the error:
> ??? Attempted to access e(1,0); index must be a positive integer or logical.
>
> Error in ==> hmmdecode at 146
> fs(state,count) = e(state,seq(count)) .* (sum(fs(:,count-1) .*tr(:,state)));
>
> Error in ==> hmmtrain at 239
> [p,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
>
>
> The problem is with my data in seq. A row of my data in seq is looks like:
>
> 0,1,1,70,181,5450,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,8,8,0.00,0.00,0.00,0.00,1.00,0.00,0.00,9,9,1.00,0.00,0.11,0.00,0.00,0.00,0.00,0.00,138
>
> As it's also including some non integer values, i've tried to round the matrix also and obtain an only integer matrix, but the problem remains.
> Is there any idea about this problem?
=====
Why are you trying to use non-integer indices when you know these locations in your array don't exist????
My guess is you want to use interp1()
|
|
0
|
|
|
|
Reply
|
Matt
|
12/30/2009 6:22:04 PM
|
|
"burcu " <burcu102@hotmail.com> wrote in message <hhg52b$jss$1@fred.mathworks.com>...
> Dear all,
>
> I'm working on an hmm issue. I'll run hmmtrain command which looks like:
> >> [EMSTTR, ESTEMIS]=hmmtrain(seq,trans,emis);
> and i get the error:
> ??? Attempted to access e(1,0); index must be a positive integer or logical.
>
> Error in ==> hmmdecode at 146
> fs(state,count) = e(state,seq(count)) .* (sum(fs(:,count-1) .*tr(:,state)));
>
> Error in ==> hmmtrain at 239
> [p,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
>
>
> The problem is with my data in seq. A row of my data in seq is looks like:
>
> 0,1,1,70,181,5450,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,8,8,0.00,0.00,0.00,0.00,1.00,0.00,0.00,9,9,1.00,0.00,0.11,0.00,0.00,0.00,0.00,0.00,138
>
> As it's also including some non integer values, i've tried to round the matrix also and obtain an only integer matrix, but the problem remains.
> Is there any idea about this problem?
>
> Thanks
> Burcu
I can't tell how you think the code should treat this scenario. You could solve the problem by adding 1 to all elements of seq, but that's unlikely to be the desired result. A more reasonable guess would be to replace seq by seq(seq>0) to ignore the 0. But again, I can't tell if this is the desired result. Should seq not have any noninteger or 0 values to begin with? You need to answer these sorts of questions so we know how to change the code appropriately.
|
|
0
|
|
|
|
Reply
|
Andy
|
12/30/2009 6:22:04 PM
|
|
Hi Andy,
This code is supposed to be a recognition code. Every column of my input data is a feature vector and last column indicates the class of the sequence.
So adding 1 to all the elements might cause some mistakes in my results.
All of my elements are no integers, there are some values like 0.1, 0.9 etc. and also 0s are the meaningful data for me. seq(seq>0) wouldn't work also.
If i round all the values, i checked the results and there were no noninteger values but i'm taking the same error.
I tried to create a random seq data just for trial and i create an integer matrix manually, it worked. So i couldnt understand what is wrong with this data.
Could my delimiters, commas causing this?
Burcu
>
> I can't tell how you think the code should treat this scenario. You could solve the problem by adding 1 to all elements of seq, but that's unlikely to be the desired result. A more reasonable guess would be to replace seq by seq(seq>0) to ignore the 0. But again, I can't tell if this is the desired result. Should seq not have any noninteger or 0 values to begin with? You need to answer these sorts of questions so we know how to change the code appropriately.
|
|
0
|
|
|
|
Reply
|
burcu
|
12/30/2009 6:36:04 PM
|
|
> So i couldnt understand what is wrong with this data.
The problem is that seq contains zeroes. In the line:
e(state,seq(count))
if seq(count)=0, then e(state,0) doesn't make any sense, and returns an error. What do you want the behavior to be in this situation? Your code not appear syntactically incorrect. You're just not doing anything to make sure that the data contained in seq is a valid reference index for the array e.
|
|
0
|
|
|
|
Reply
|
Andy
|
12/30/2009 6:47:03 PM
|
|
"burcu " <burcu102@hotmail.com> wrote in message <hhg6ik$o4m$1@fred.mathworks.com>...
> Hi Andy,
>
> This code is supposed to be a recognition code. Every column of my input data is a feature vector and last column indicates the class of the sequence.
> So adding 1 to all the elements might cause some mistakes in my results.
> All of my elements are no integers, there are some values like 0.1, 0.9 etc. and also 0s are the meaningful data for me. seq(seq>0) wouldn't work also.
>
> If i round all the values, i checked the results and there were no noninteger values but i'm taking the same error.
>
> I tried to create a random seq data just for trial and i create an integer matrix manually, it worked. So i couldnt understand what is wrong with this data.
Perhaps the following example will help. Can you see why certain indexing produces errors? It's because MATLAB indices must be integers between 1 and length(v).
>> v=[7.4 3.8 2.1]
v =
7.4000 3.8000 2.1000
>> v(0)
??? Subscript indices must either be real positive integers or logicals.
>> v(1)
ans =
7.4000
>> v(2)
ans =
3.8000
>> v(3)
ans =
2.1000
>> v(4)
??? Index exceeds matrix dimensions.
So as you see, 0 is not a valid index in MATLAB. You have to figure out which indices >=1 and less than the size of the array that your seq=0 values should correspond to. That rule, however, is something only you can know.
|
|
0
|
|
|
|
Reply
|
Matt
|
12/30/2009 6:55:05 PM
|
|
So to get rid of zeros, i've added 1s to every element and than round them all. so i have a totally positive integer elements but error still exists. Sorry if i understand wrong what you meant.
"Andy " <theorigamist@gmail.com> wrote in message <hhg777$4t0$1@fred.mathworks.com>...
> > So i couldnt understand what is wrong with this data.
>
> The problem is that seq contains zeroes. In the line:
>
> e(state,seq(count))
>
> if seq(count)=0, then e(state,0) doesn't make any sense, and returns an error. What do you want the behavior to be in this situation? Your code not appear syntactically incorrect. You're just not doing anything to make sure that the data contained in seq is a valid reference index for the array e.
|
|
0
|
|
|
|
Reply
|
burcu
|
12/30/2009 7:37:04 PM
|
|
Could you post your changes to the code and the resulting error?
|
|
0
|
|
|
|
Reply
|
Andy
|
12/30/2009 7:43:04 PM
|
|
I've created a matrix of ones with ones comment and sum it with my seq matrix and name it as B. Then round it,
>> B=round(B);
>> [EMSTTR, ESTEMIS]=hmmtrain(B,trans,emis);
??? Attempted to access e(1,5451); index out of bounds because size(e)=[2,848].
Error in ==> hmmdecode at 146
fs(state,count) = e(state,seq(count)) .* (sum(fs(:,count-1) .*tr(:,state)));
Error in ==> hmmtrain at 239
[p,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
This is a different error than the other, sorry i didn't attend it.
"Andy " <theorigamist@gmail.com> wrote in message <hhgag8$1ur$1@fred.mathworks.com>...
> Could you post your changes to the code and the resulting error?
|
|
0
|
|
|
|
Reply
|
burcu
|
12/30/2009 7:54:04 PM
|
|
"burcu " <burcu102@hotmail.com> wrote in message <hhgb4s$cc0$1@fred.mathworks.com>...
> I've created a matrix of ones with ones comment and sum it with my seq matrix and name it as B. Then round it,
> >> B=round(B);
> >> [EMSTTR, ESTEMIS]=hmmtrain(B,trans,emis);
> ??? Attempted to access e(1,5451); index out of bounds because size(e)=[2,848].
>
> Error in ==> hmmdecode at 146
> fs(state,count) = e(state,seq(count)) .* (sum(fs(:,count-1) .*tr(:,state)));
>
> Error in ==> hmmtrain at 239
> [p,logPseq,fs,bs,scale] = hmmdecode(seq,guessTR,guessE);
>
> This is a different error than the other, sorry i didn't attend it.
>
>
>
>
> "Andy " <theorigamist@gmail.com> wrote in message <hhgag8$1ur$1@fred.mathworks.com>...
> > Could you post your changes to the code and the resulting error?
I think you should invest some time in reading your error messages. It would save a lot of time waiting for a response from the newsgroup community. This error is pretty clear:
??? Attempted to access e(1,5451); index out of bounds because size(e)=[2,848]
At some point during execution, state evaluated to 1, and seq(count) evaluated to 5451. But since size(e)=[2,848], there is no element in row 1, column 5451. So when you tried to access this element, there was an error. This is exactly the same problem you had with the zeros before. You are doing nothing to make sure that the data stored in seq is a valid index for the array e. As a result, you are attempting to access parts of the array e that are not there, which is precisely what the error says.
|
|
0
|
|
|
|
Reply
|
Andy
|
12/30/2009 8:16:21 PM
|
|
|
9 Replies
1993 Views
(page loaded in 0.042 seconds)
Similiar Articles: ??? Attempted to access e(1,0); index must be a positive integer ...How to generate non-repeating random integers - comp.soft-sys ... index must be a positive integer or logical. - comp.soft-sys ... How to generate non-repeating ... Attempted to access A(0); index must be a positive integer or ...Attempted to access e(1,0); index must be a positive integer ... Attempted to access e(1,0); index must be a positive integer or logical. Attempted to access A(0); index ... error:Attempted to access F2(6); index must be a positive integer ...Subscript indices must either be real positive integers or ..... be a positive integer or logical. - comp.soft-sys ... Attempted to access e(1,0); index must be a ... what.....i don't know what it happened!(index must be a positive ...DSx FUNCTION (DSy and DSs don't ... index must be a positive integer or logical. - comp.soft-sys ... Attempted to access e(1,0); index must be a positive integer ... Subscript indices must either be real positive integers or ...index must be a positive integer or logical. - comp.soft-sys ... Attempted to access e(1,0); index must be a positive integer ... Subscript indices must either be real ... Integer class error - comp.lang.rubyInteger class error - comp.lang.ruby index must be a positive integer or logical. - comp.soft-sys ... Integer class error - comp.lang.ruby Attempted to access e(1,0 ... ??? Attempted to access x(3); index out of bounds because numel(x ...Attempted to access x(3); index out of bounds because numel(x ... Attempted to access e(1,0); index must be a positive integer ... Attempted to access e(1,5451); index out ... How to generate non-repeated random integers - comp.soft-sys.sas ...index must be a positive integer or logical. - comp.soft-sys ... How to generate non-repeating random integers - comp.soft-sys ... Attempted to access e(1,0); index must ... Attempted to access c(2); index out of bounds because numel(c)=1 ...Attempted to access e(1,0); index must be a positive integer ... Attempted to access c(2); index out of bounds because numel(c)=1 ... Attempted to access A(0); index must ... How to generate non-repeating random integers - comp.soft-sys ...Attempted to access e(1,0); index must be a positive integer ... Why are you trying to use non ... ... index must be a positive integer or logical. - comp.soft-sys ... How to ... ??? Attempted to access e(1,0); index must be a positive integer ...How to generate non-repeating random integers - comp.soft-sys ... index must be a positive integer or logical. - comp.soft-sys ... How to generate non-repeating ... ??? Attempted to access e(1,0); index must be a positive integer ...The old Google Groups will be going away soon ... Re: ??? Attempted to access e(1,0); index must be a positive integer or logical. 7/22/2012 9:45:17 PM
|