weka.clusterers
Class InstancePair

java.lang.Object
  extended byweka.clusterers.InstancePair
All Implemented Interfaces:
java.lang.Comparable

public class InstancePair
extends java.lang.Object
implements java.lang.Comparable

Class for handling a pair of instances, in terms of indices of instances in an Instances set


Field Summary
 double activeScore
          ----- DEPRECATED: ACTIVE SCORE NO LONGER USED IN PCKMEANS!!!! -----
static int CANNOT_LINK
          cannot-link
 double cost
          cost of violating constraint
static int DONT_CARE_LINK
          don't care
 int first
          first instance index
 int linkType
          MUST_LINK, CANNOT_LINK or DONT_CARE_LINK
static boolean m_isClassAttributeString
           
static int MUST_LINK
          must-link
 int second
          second instance index, always <= first
 
Method Summary
 int compareTo(InstancePair a)
          Compare function
 int compareTo(java.lang.Object a)
          Compare function
 boolean equals(java.lang.Object a)
          Equals function
static java.util.ArrayList getPairs(Instances instances, int size)
          Returns an arraylist of random (both positive and negative) pair objects created from the input
static java.util.ArrayList getPairs(Instances instances, int size, boolean sameClassOnly)
          Returns an arraylist of pair objects created from the input set of instances
 int hashCode()
          hashCode
static double jaccardSimilarityOfClassStrings(Instance a, Instance b)
           
 java.lang.String toString()
          returns string representation of InstancePair
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

first

public int first
first instance index


second

public int second
second instance index, always <= first


linkType

public int linkType
MUST_LINK, CANNOT_LINK or DONT_CARE_LINK


cost

public double cost
cost of violating constraint


activeScore

public double activeScore
----- DEPRECATED: ACTIVE SCORE NO LONGER USED IN PCKMEANS!!!! -----


MUST_LINK

public static final int MUST_LINK
must-link

See Also:
Constant Field Values

CANNOT_LINK

public static final int CANNOT_LINK
cannot-link

See Also:
Constant Field Values

DONT_CARE_LINK

public static final int DONT_CARE_LINK
don't care

See Also:
Constant Field Values

m_isClassAttributeString

public static boolean m_isClassAttributeString
Method Detail

compareTo

public int compareTo(java.lang.Object a)
Compare function

Specified by:
compareTo in interface java.lang.Comparable
Returns:
0 if equal, -1 if this.activeScore > a.activeScore, +1 else Note: Reverse of conventional compareTo, to force sort in descending order

compareTo

public int compareTo(InstancePair a)
Compare function

Returns:
0 if equal, -1 if this.activeScore > a.activeScore, +1 else Note: Reverse of conventional compareTo, to force sort in descending order

equals

public boolean equals(java.lang.Object a)
Equals function

Returns:
true if same, false else

hashCode

public int hashCode()
hashCode


getPairs

public static java.util.ArrayList getPairs(Instances instances,
                                           int size)
Returns an arraylist of random (both positive and negative) pair objects created from the input

Parameters:
instances - list of instances
size - number of pairs to return
Returns:
arraylist of pairs

getPairs

public static java.util.ArrayList getPairs(Instances instances,
                                           int size,
                                           boolean sameClassOnly)
Returns an arraylist of pair objects created from the input set of instances

Parameters:
instances - list of instances
size - number of pairs to return
sameClassOnly - if true, only pairs from the same class will be returned
Returns:
arraylist of pairs

jaccardSimilarityOfClassStrings

public static double jaccardSimilarityOfClassStrings(Instance a,
                                                     Instance b)

toString

public java.lang.String toString()
returns string representation of InstancePair