weka.classifiers.misc.monotone
Class Coordinates

java.lang.Object
  extended by weka.classifiers.misc.monotone.Coordinates
All Implemented Interfaces:
java.io.Serializable, RevisionHandler

public class Coordinates
extends java.lang.Object
implements java.io.Serializable, RevisionHandler

This is a simple implementation of the data space. The Coordinates holds the internal weka value of an instance, but with the class removed . The class is immutable, and works best when all attibutes are nominal (ordinal), although it will not give an error when working with numeric attributes. In the latter case, performance will degrade because of the way in which the hashcode is calculated.

This implementation is part of the master's thesis: "Studie en implementatie van instantie-gebaseerde algoritmen voor gesuperviseerd rangschikken", Stijn Lievens, Ghent University, 2004.

Version:
$Revision: 1.2 $
Author:
Stijn Lievens (stijn.lievens@ugent.be)
See Also:
Serialized Form

Constructor Summary
Coordinates(Instance instance)
          Create the Coordinates for the given instance.
 
Method Summary
 int dimension()
          Gets the dimension of the data space, this is the number of attributes, exluding the class attribute.
 boolean equals(java.lang.Object o)
          Indicates if the object o equals this.
 java.lang.String getRevision()
          Returns the revision string.
 double getValue(int index)
          Get the value of the attribute with index index, ignoring the class attribute.
 void getValues(double[] values)
          Get the values of the coordinates.
 int hashCode()
          Gets the hash code value for this object.
 boolean smallerOrEqual(Coordinates cc)
          Checks if this is smaller or equal than cc.
 boolean strictlySmaller(Coordinates cc)
          Checks if this is strictly smaller than cc.
 java.lang.String toString()
          Get a string representation of this object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Coordinates

public Coordinates(Instance instance)
Create the Coordinates for the given instance.

Parameters:
instance - the Instance on which the Coordinates will be based
Method Detail

getValue

public double getValue(int index)
Get the value of the attribute with index index, ignoring the class attribute. Indices are counted starting from 0.

Parameters:
index - the index of the requested attribute
Returns:
the value of this attribute, in internal floating point format.

getValues

public void getValues(double[] values)
Get the values of the coordinates.

Parameters:
values - array serving as output, and the first dimension() values are filled in.

equals

public boolean equals(java.lang.Object o)
Indicates if the object o equals this.

Overrides:
equals in class java.lang.Object
Parameters:
o - the reference object with which to compare
Returns:
true if o equals this, false otherwise

strictlySmaller

public boolean strictlySmaller(Coordinates cc)
                        throws java.lang.IllegalArgumentException
Checks if this is strictly smaller than cc. This means that for all indices i it holds that this.getValue(i) <= cc.getValue(i) and that there is at least one index i such that this.getValue(i) ≠ cc.getValue(i)

Parameters:
cc - the Coordinates that this is compared to
Returns:
true if this is strictly smaller than cc, false otherwise
Throws:
java.lang.IllegalArgumentException - if the dimensions of both objects differ

smallerOrEqual

public boolean smallerOrEqual(Coordinates cc)
                       throws java.lang.IllegalArgumentException
Checks if this is smaller or equal than cc. This means that for all indices i it holds that this.getValue(i) <= cc.getValue(i).

Parameters:
cc - the Coordinates that this is compared to
Returns:
true if this is smaller or equal than cc, false otherwise
Throws:
java.lang.IllegalArgumentException - if the dimensions of both objects differ

hashCode

public int hashCode()
Gets the hash code value for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
the requested hash code

dimension

public int dimension()
Gets the dimension of the data space, this is the number of attributes, exluding the class attribute.

Returns:
the dimension of the data space this object resides in

toString

public java.lang.String toString()
Get a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
the requested string representation

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Returns:
the revision