tc
Class TCkNNResult

java.lang.Object
  extended bytc.TCkNNResult

public class TCkNNResult
extends java.lang.Object

This class holds the result of an kNN classification given a result of an k nearest neighbor classification for the test documents, the class creates a category ranking for every document


Nested Class Summary
(package private)  class TCkNNResult.TCkNNCategoryListElement
          the elements which will be filled in the array list of the parent class with the two compare functions a category label, scores, and occurences
 
Field Summary
(package private)  int compareMethod
          the method of comparison 0: score 1: occurence
(package private)  java.util.ArrayList kNNResults
          holds the ranking (after sort()) for every(!) category no matter if that category had a nearest neighbor or not
 
Constructor Summary
(package private) TCkNNResult(java.util.ArrayList categoryLabels)
          the constructor creates the arraylist with all the results and initializes the compare method to 0 (score)
 
Method Summary
 void addKNNListElement(TCkNNListElement kNNListElement)
          adds an element out of a scoring list ({document, score}) and updates the category scorings, etc.
 java.lang.String getCategoryLabelWithRank(int rank)
          gets the category label with rank "rank" (called after sort()!!)
 int getFirstRankWithScoreSmallerThan(double scr)
          returns the first rank whose score is smaller than the given threshold.
 double getOccurenceForCategoryLabel(java.lang.String label)
          returns the occurence for the category indicated by the label "label" (how often are the k nearest neighor documents labeled as "label")
 int getOccurenceOfCategoryWithRank(int rank)
          returns how often one category was under the k nearest neighbors
 double getScoreForCategoryLabel(java.lang.String label)
          returns the score for the category indicated by the label "label"
 double getScoreOfCategoryWithRank(int rank)
          returns the score of the category with rank "rank" (called after sort())"
 boolean isLabeledAs(java.lang.String label, int rankThreshold)
          checks, if the given label "label" was assigned to the document from the kNN classifier, given the rankThreshold (the first rank whose threshold was lower than the threshold for the classifier)
 void sort(int cm)
          sorts the arraylist with the results for every category according to cm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compareMethod

int compareMethod
the method of comparison 0: score 1: occurence


kNNResults

java.util.ArrayList kNNResults
holds the ranking (after sort()) for every(!) category no matter if that category had a nearest neighbor or not

Constructor Detail

TCkNNResult

TCkNNResult(java.util.ArrayList categoryLabels)
the constructor creates the arraylist with all the results and initializes the compare method to 0 (score)

Parameters:
categoryLabels -
Method Detail

addKNNListElement

public void addKNNListElement(TCkNNListElement kNNListElement)
adds an element out of a scoring list ({document, score}) and updates the category scorings, etc.

Parameters:
kNNListElement -

sort

public void sort(int cm)
sorts the arraylist with the results for every category according to cm

Parameters:
cm -

getCategoryLabelWithRank

public java.lang.String getCategoryLabelWithRank(int rank)
gets the category label with rank "rank" (called after sort()!!)

Parameters:
rank - the rank
Returns:

getOccurenceOfCategoryWithRank

public int getOccurenceOfCategoryWithRank(int rank)
returns how often one category was under the k nearest neighbors

Parameters:
rank - the rank of the category
Returns:
the occurence of the category under the k nearest neighbors

getScoreOfCategoryWithRank

public double getScoreOfCategoryWithRank(int rank)
returns the score of the category with rank "rank" (called after sort())"

Parameters:
rank -
Returns:

getFirstRankWithScoreSmallerThan

public int getFirstRankWithScoreSmallerThan(double scr)
returns the first rank whose score is smaller than the given threshold. Used to calculate a value for RCut

Parameters:
scr - the score
Returns:

getScoreForCategoryLabel

public double getScoreForCategoryLabel(java.lang.String label)
returns the score for the category indicated by the label "label"

Parameters:
label - the label of the category
Returns:
the score of the category "label"

getOccurenceForCategoryLabel

public double getOccurenceForCategoryLabel(java.lang.String label)
returns the occurence for the category indicated by the label "label" (how often are the k nearest neighor documents labeled as "label")

Parameters:
label - the label of the category
Returns:
the score of the category "label"

isLabeledAs

public boolean isLabeledAs(java.lang.String label,
                           int rankThreshold)
checks, if the given label "label" was assigned to the document from the kNN classifier, given the rankThreshold (the first rank whose threshold was lower than the threshold for the classifier)

Parameters:
label - the label of the category
rankThreshold - the rank threshold
Returns:
true, if the document was classified into the category with label "label"