Re: Using sparse vector leads to array out of bounds exception

2016-08-03 Thread Sean Owen
Yeah, that's libsvm format, which is 1-indexed. On Wed, Aug 3, 2016 at 12:45 PM, Tony Lane wrote: > I guess the setup of the model and usage of the vector got to me. > Setup takes position 1 , 2 , 3 - like this in the build example - "1:0.0 > 2:0.0 3:0.0" > I thought I

Re: Using sparse vector leads to array out of bounds exception

2016-08-03 Thread Tony Lane
I guess the setup of the model and usage of the vector got to me. Setup takes position 1 , 2 , 3 - like this in the build example - "1:0.0 2:0.0 3:0.0" I thought I need to follow the same numbering while creating vector too. thanks a bunch On Thu, Aug 4, 2016 at 12:39 AM, Sean Owen

Re: Using sparse vector leads to array out of bounds exception

2016-08-03 Thread Sean Owen
You mean "new int[] {0,1,2}" because vectors are 0-indexed. On Wed, Aug 3, 2016 at 11:52 AM, Tony Lane wrote: > Hi Sean, > > I did not understand, > I created a KMeansModel with 3 dimensions and then I am calling predict > method on this model with a 3 dimension vector ?

Re: Using sparse vector leads to array out of bounds exception

2016-08-03 Thread Tony Lane
Hi Sean, I did not understand, I created a KMeansModel with 3 dimensions and then I am calling predict method on this model with a 3 dimension vector ? I am not sre what is wrong in this approach. i am missing a point ? Tony On Wed, Aug 3, 2016 at 11:22 PM, Sean Owen wrote:

Using sparse vector leads to array out of bounds exception

2016-08-03 Thread Tony Lane
I am using the following vector definition in java Vectors.sparse(3, new int[] { 1, 2, 3 }, new double[] { 1.1, 1.1, 1.1 })) However when I run the predict method on this vector it leads to Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at