Solved

complicated calculation on the Arraylist of int[] !!

Posted on 2004-08-02
11
217 Views
Last Modified: 2010-03-31
hi experts,

I got a Arraylist of int[] which contains data like belows:

321,371,361,305,112,88,109,89,115,97,101,91,922,468,586,4333,415047,1
317,370,357,294,113,87,110,89,110,93,107,92,924,468,591,4391,419170,1
306,362,348,265,114,88,110,90,110,91,103,81,908,475,581,4248,416936,2
.......
333,375,352,301,109,88,112,92,110,92,110,96,904,465,574,4374,409852,56
......
317,370,357,294,113,87,110,89,110,93,107,92,924,468,591,4391,419170,88
........
317,370,357,294,113,87,110,89,110,93,107,92,924,468,591,4391,419170,100
........................about 1000 rows and 17 columns !

the last column is used as a class identifier, writing a program for this ,
u may read in the dataset first, divide it into 10 subsets and store to ten 2D array. Use a For-loop to repeat the process 10 times, and do the classification experiment inside
this for loop. the classification experiment is using ED----http://www.nist.gov/dads/HTML/euclidndstnc.html

The ED method is used to measure the similarity between
two feature vectors(rows). For each sample in the testing set, compare it with
all the samples in the training set and find the most similar feature
vector(row) (by using ED, the shortest distance..), then
compare their class ID ( user ID), if match, it counts a correct
classified smaple, it counts a non-match classified sample otherwise.
Then, obtain the correct classification RATE for each fold, and
also the total classification rate.
Finally output the classification rate for each fold to a text file !

thanks !
0
Comment
Question by:mmccy
11 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 11694223
0
 

Author Comment

by:mmccy
ID: 11694320
Sorry that is the first part !! After having some experts's help I am tackling with it now and fully understand it (the first part)
However, I really have no idea of what I should do in this 2nd part !!
Can u give me some hints ?

thanks !
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 11695666
And ... this is homework!!!!

;JOOP!
0
 
LVL 12

Accepted Solution

by:
Giant2 earned 500 total points
ID: 11700996
>divide it into 10 subsets and store to ten 2D array

      public ArrayList[] divide(ArrayList original, int numOfSubset){
            ArrayList[] ret=new ArrayList[numOfSubset];
            int subset=0;
            int nrlen=original.size()/numOfSubset;
            int pos=0;
            while (subset<numOfSubset && pos<original.size()){
                  ret[subset].add(original.get(pos));
                  pos++;
                  if (pos==nrlen)subset++;
            }
            if (pos<original.size()){
                  for (int i=pos;i<original.size();i++)
                  ret[numOfSubset-1].add(original.get(i));}
            return ret;
      }
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 24

Expert Comment

by:sciuriware
ID: 11880153
Agreed; how do the moderators deal with this kind of questioners? Just curious.
;JOOP!
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11880189
>We can answer homework questions in Tutor mode but not to give full solutions.

Sorry Venabili,
but I see many (and many) Experts that giving the full solution have points; and I (giving only a Tutor solution) have NO points.
So I decide that if I have ready a solution, I'll post it (this is I have done in this thread).

Maybe I was not luckly than other because "mmccy" doesn't close the post where I gave the full solution, so now this thread is deleted (even if I gave a solution).

No problem, but I hope this control about the Tutor/FullSolution will be done even on the entire EE DB, not only on the thread not closed.

Bye, Giant.

P.S. I think this is one problem in EE, but, like I raised up in another thread I have this like answer: It's not possible to check the answer accepted/assisted.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 11883093
Giant2,
I remark that the tone of some questions tells a story: literally from a book, paper or even examination.
You must not complain that you are not always stopped / rewarded or EE will turn into a police environment.
;JOOP!
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11883207
Infact I told:
"It's not possible to check the answer accepted/assisted"

Bye, Giant.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 11888983
Yes, indeed, now someone has the feeling he/she could get away with the answer without paying.
I agree with "Delete - no points refunded",
but annoying still to those who spent their time.
;JOOP!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now