last day (15 days later) » 

5:46 PM
0
Q: Error in Concatenating N- number of arraylist each of dimension d in java

thetnaI want to concatenate N- number of d-dimensional arraylist into one large arraylist . I have done following: { Arraylist<Double> cFeature = new Arraylist<Double>(); for(int i =0 ; i < n; i++){ ArrayList<Double> arrList = new ArrayList<Double>(); ...

 
No FeatureMatrix is a matrix containing some large number of d-dimensional arraylist.
its hashmap, i will pass index and it will return an arraylist of d elements.
 
It would help if you could add the current (wrong) output of your code. I think there is a problem with the FeatureMatrix.get(i) method…
… and it is not clear to me what your expected result is. I think FeatureMatrix.get(0) returns the list [1, 2, 3, 4], FeatureMatrix.get(1) returns [4, 5, 6, 7], FeatureMatrix.get(2) returns [9, 4, 5, 2] and your desired result is [1, 2, 3, 4, 4, 5, 6, 7, 9, 4, 5, 2], right?
 
Exactly @siegi, that is what i want.
 
@thetna In this case the code you listed is correct, the problem is in some other place. Could you add something like System.out.println(arrList); after arrList = FeatureMatrix.get(i); as "Hovercraft Full Of Eels" already asked? I really think FeatureMatrix.get(i) returns something wrong…
 
@siegi, I added it in my question. each row of matrix is of 50 dimnesion and entries are double.
 
5:46 PM
@thetna Ok, so FeatureMatrix.get(i) returns some values and the code above should work. You say "this is not returning me concatenated feature vector". What does it return? Maybe there is an error where you call the code you posted in your question?
 
i am getting something weried unexpected large size of concatenated featurevector. cFeature.size() returns something very large number , which is not expected at all.
 
@thetna This is a very important information ;-) How many rows has your matrix? Note that cFeature will have numberOfColumns*numberOfRows elements in it. Maybe the n you use in the for loop is wrong?
 
N is small number , its basically a context size of N-gram.
Hi
 
hi :-)
 
this thing really drive me crazy, do you want some more information?
 
5:48 PM
it would be useful if you provided more context, i.e. the class where the code in your question is in
 
i replaced the value of N with some constant value 3 , even it returns like 40576710
even i reduced the dimension of feature vector.
 
ok… so either your matrix returns so many elements for some value of i or something messes with the n value of the for loop
 
Foe each of the element i, i checked its dimension, which i am getting correctly. The problem occurs when i try to concatenate.
 
could you please post/upload the complete class containing the code from your question and maybe also the code where the feature matrix is created?
 
ok i can do it in some code pasting site.
 
5:55 PM
ok :-)
 
6:07 PM
sorry for late reply. i was confused which portion of code to paste. pastebin.com/W1SwiqgN
 
no problem… i'll have a look… :-)
 
Basically i have a problem with the method getContextFeatureVector()
["it's, not, if, we]
"it's
not
10
if
10
Size of context Feature10
["it's, not, if, we]
"it's
not
3123
if
4232
Size of context Feature 12342
this is the difference when i get when i disable and enable cFeature.addAll()
 
hmmm…
where and how do you call getContextFeatureVector?
for me it would be very helpful if i had a running example (including a main function)
 
Now, i got Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
 
there is something strange going on… :-D
i'm sorry, i have to leave in about 10 minutes. i'll come back later or sunday or monday!
 
6:23 PM
thank you very much .... i will try to figure it out
can you suggest me some useful material for debugging java? i don't have very long experience on it.
 
hmm… not really, no, sorry! i learned the most from experience :-P
but remember: never trust anything! even if you are sure that this value has to be 5 (for example), print it out with a system.out.println and verify it!
;-)
sorry, i have to go now! i'll come back to this chat or to your original question page…
 
thanks :)
 

last day (15 days later) »