com.rapidminer.operator.preprocessing.outlier
Class SearchObject

java.lang.Object
  extended by com.rapidminer.operator.preprocessing.outlier.SearchObject

public class SearchObject
extends java.lang.Object

The SearchObject class creates SearchObjects which handle the representation of objects from the test data set in the core of the outlier operators. Such an object is able to store all relevant coordinates, dimensions, etc. for an object (e.g. from an Example from a RapidMiner ExampleSet) as well as perform various operations, such as radius search to other objects.

Author:
Stephan Deutsch, Ingo Mierswa

Constructor Summary
SearchObject()
          Constructor creates a new instance of SearchObject class and initializes the object with integer 2 dimensions and the String label not labeled object.
SearchObject(int dim, java.lang.String l)
          Constructor creates a new instance of SearchObject class and initializes the object with integer dim dimensions and the String label l.
SearchObject(int dim, java.lang.String l, int minptslb, int minptsub)
          Constructor creates a new instance of SearchObject class and initializes the object with integer dim dimensions and the String label l and an (integer) MinPts-Range.
 
Method Summary
 void addKdContainer()
          Adds a new KdContainer to the SearchObject at the end of the container list.
 void addKdContainer(int index)
          Adds a new KdContainer to the SearchObject at index in the container list.
 void addKdContainer(int index, double dist)
          Adds a new KdContainer to the SearchObject at index in the container list and also sets the distance value of the container to dist.
 void addKdContainer(int index, KdistanceContainer kd)
          Adds an existing KdContainer to the container list at position index.
 void addKdContainer(KdistanceContainer kd)
          Adds an existing KdContainer to the container lost at the end of the list.
 int getCardN(int k)
          Returns the cardinality for k-neighbourhood (|N_k(p)|) for a SearchObject for k.
 int getDimensions()
          Provides the (integer) number of dimensions of the Object.
 double getDistance(SearchObject toObject, int kindOfDistance)
          This method returns the distance between two objects according to a specification on which distance shall be computed (at the moment the method supports EUCLIDIAN distance (int kindOfDistance = 1) and COSINE distance (int kindOfDistance = 2) and the following similar distances: SQUARED (0) (the squared value of the metric/euclidian distance, INV_COSINE (3) the inversted cosine (actually the sine) distance which is simply 1-cos, and ANGLE_RADIANT (4) the angle between the objects related to zero coordinates in the actual n-dimensional euclidian coordinate system (ARC COSINE in radiant between [0 ; pi]).
 double getDistanceEuclidian(SearchObject toObject)
          Returns the euclidian (metric) distance between two SearchObjects by looking at the object's vektors and returning the length of the substracted vector between the two object's vectors.
 java.util.ListIterator getKdContainerListIterator()
          returns a ListIterator for the list of containes in the SearchObject.
 double getKDistance(int k)
          Returns the k-distance for the SearchObject for k.
 java.lang.String getLabel()
          Returns the label of the object (e.g. its "name" for other purposes)
 double getLOF(int k)
          Returns the k-LOF for a SearchObject for k.
 double getLRD(int k)
          Returns the local reachability density for k for a SearchObject.
 double getOutlierFactor()
          Returns the Outlier factor of an object.
 boolean getOutlierStatus()
          Provides the BOOLEAN Outlier status of an Object (-> the status has to be set through a test, so the user should see that the status is only set by methods providing a consistent view on the outlier test, else this has only the meaning of the accidentally stored status (default should be ZERO ;-).
 double getVektor(int dim)
          Returns the value of the object's vektor with dimension (integer) dim.
 void setCardN(int k, int card)
          Sets the cardinality for k-neighbourhood (|N_k(p)|) for a SearchObject for k to card.
 void setDimensions(int dim)
          Changes the number of dimensions for an object and copies the values of the old vector for the object into the new vektor (which is initialized with the new dimension number).
 void setKDistance(int k, double dist)
          Sets the k-distance for the SearchObject for k to dist.
 void setLabel(java.lang.String l)
          Sets the label of the object to (String) l.
 void setLOF(int k, double lof)
          Sets the k-LOF for a SearchObject to lof for k.
 void setLRD(int k, double lrdvalue)
          Sets the local reachability density for k for a SearchObject for k to lrdvalue.
 void setOutlierFactor(double factor)
          Sets a (double) Outlier factor to store smooth Outlier status information, such as local outlier factors and others.
 void setOutlierStatus(boolean status)
          Sets a BOOLEAN Outlier Status for the object to store the results of Outlier tests according to a yes/no Outlier state (e.g.
 void setVektor(int dim, double value)
          Sets the vector for the object to (double) value for the dimension (integer) dim, with this method subsequently all dimensions of an objects vector can be set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchObject

public SearchObject(int dim,
                    java.lang.String l)
Constructor creates a new instance of SearchObject class and initializes the object with integer dim dimensions and the String label l. Each dimension vektor is set to (double) ZERO and Outlier status is set to false and Outlier Factor is set to ZERO as well.


SearchObject

public SearchObject()
Constructor creates a new instance of SearchObject class and initializes the object with integer 2 dimensions and the String label not labeled object. Each dimension vektor is set to (double) ZERO and Outlier status is set to false and Outlier Factor is set to ZERO as well. this is only a default constructor and should not be used for 2-dimensional objects. The class does not provide sufficient consistency checks to entirely rely on default construction.


SearchObject

public SearchObject(int dim,
                    java.lang.String l,
                    int minptslb,
                    int minptsub)
Constructor creates a new instance of SearchObject class and initializes the object with integer dim dimensions and the String label l and an (integer) MinPts-Range. Each dimension vektor is set to (double) ZERO and Outlier status is set to false and Outlier Factor is set to ZERO as well.

Parameters:
dim -
l -
minptslb -
minptsub -
Method Detail

setDimensions

public void setDimensions(int dim)

Changes the number of dimensions for an object and copies the values of the old vector for the object into the new vektor (which is initialized with the new dimension number).

Attention: If the new dimension number is less than the old number, only the values of the relevant new domain range are copied. If the new vector has more dimensions, all the old are copied and the new ones are initialized with ZERO. Those should afterwards be initialized with the setVektor(int, double) method in a proper manner.

The safest way to change the dimensions of an object is to create a new one with the new dimensions and to copy the vektor values and all other relevant data and to initialize the additional dimensions with the proper values.


getDimensions

public int getDimensions()
Provides the (integer) number of dimensions of the Object. Remark: some methods actually use the this.dimensions reference which is used by this, but this method would be able to provide the dimensions externally.


setLabel

public void setLabel(java.lang.String l)
Sets the label of the object to (String) l.


getLabel

public java.lang.String getLabel()
Returns the label of the object (e.g. its "name" for other purposes)


setVektor

public void setVektor(int dim,
                      double value)
Sets the vector for the object to (double) value for the dimension (integer) dim, with this method subsequently all dimensions of an objects vector can be set.

Parameters:
dim -
value -

getVektor

public double getVektor(int dim)
Returns the value of the object's vektor with dimension (integer) dim.

Parameters:
dim -

setOutlierStatus

public void setOutlierStatus(boolean status)
Sets a BOOLEAN Outlier Status for the object to store the results of Outlier tests according to a yes/no Outlier state (e.g. DB(p,D) Outliers and others.

Parameters:
status -

getOutlierStatus

public boolean getOutlierStatus()
Provides the BOOLEAN Outlier status of an Object (-> the status has to be set through a test, so the user should see that the status is only set by methods providing a consistent view on the outlier test, else this has only the meaning of the accidentally stored status (default should be ZERO ;-).


setOutlierFactor

public void setOutlierFactor(double factor)
Sets a (double) Outlier factor to store smooth Outlier status information, such as local outlier factors and others.

Parameters:
factor -

getOutlierFactor

public double getOutlierFactor()
Returns the Outlier factor of an object.


getDistanceEuclidian

public double getDistanceEuclidian(SearchObject toObject)

Returns the euclidian (metric) distance between two SearchObjects by looking at the object's vektors and returning the length of the substracted vector between the two object's vectors.

The method checks if both objects have the same dimensions and for ensuring smooth program execution takes the mimimum number of dimensions of the two objects. So it looks at a higher dimensional object as if it has only as many dimensions as the object with fewer dimensionality. ATTENTION: This - of course - creates different distance as if the object with maximum dimensions would be taken as the reference and the missing dimensions of the object with fewer dimensions would be set to zero.

It would be expected that an integrity check would be performed before using the distance functions from any functions utilizing this distance. E.g. SearchSpace.dimensionsIntegrityCheck() provides such an integrity check for a search room's dimensions (although that function does not check object to object integrity separately).


getDistance

public double getDistance(SearchObject toObject,
                          int kindOfDistance)
This method returns the distance between two objects according to a specification on which distance shall be computed (at the moment the method supports EUCLIDIAN distance (int kindOfDistance = 1) and COSINE distance (int kindOfDistance = 2) and the following similar distances: SQUARED (0) (the squared value of the metric/euclidian distance, INV_COSINE (3) the inversted cosine (actually the sine) distance which is simply 1-cos, and ANGLE_RADIANT (4) the angle between the objects related to zero coordinates in the actual n-dimensional euclidian coordinate system (ARC COSINE in radiant between [0 ; pi]).

The method substitutes the distance method

Parameters:
toObject -
kindOfDistance -

addKdContainer

public void addKdContainer(int index)
Adds a new KdContainer to the SearchObject at index in the container list.


addKdContainer

public void addKdContainer(int index,
                           double dist)
Adds a new KdContainer to the SearchObject at index in the container list and also sets the distance value of the container to dist.


addKdContainer

public void addKdContainer(int index,
                           KdistanceContainer kd)
Adds an existing KdContainer to the container list at position index.

Parameters:
index -
kd -

addKdContainer

public void addKdContainer(KdistanceContainer kd)
Adds an existing KdContainer to the container lost at the end of the list.

Parameters:
kd -

addKdContainer

public void addKdContainer()
Adds a new KdContainer to the SearchObject at the end of the container list.


getKdContainerListIterator

public java.util.ListIterator getKdContainerListIterator()
returns a ListIterator for the list of containes in the SearchObject.


setKDistance

public void setKDistance(int k,
                         double dist)
Sets the k-distance for the SearchObject for k to dist.

Parameters:
k -
dist -

getKDistance

public double getKDistance(int k)
Returns the k-distance for the SearchObject for k.

Parameters:
k -

setLRD

public void setLRD(int k,
                   double lrdvalue)
Sets the local reachability density for k for a SearchObject for k to lrdvalue.

Parameters:
k -
lrdvalue -

getLRD

public double getLRD(int k)
Returns the local reachability density for k for a SearchObject.

Parameters:
k -

setCardN

public void setCardN(int k,
                     int card)
Sets the cardinality for k-neighbourhood (|N_k(p)|) for a SearchObject for k to card.

Parameters:
k -
card -

getCardN

public int getCardN(int k)
Returns the cardinality for k-neighbourhood (|N_k(p)|) for a SearchObject for k.

Parameters:
k -

setLOF

public void setLOF(int k,
                   double lof)
Sets the k-LOF for a SearchObject to lof for k.

Parameters:
k -
lof -

getLOF

public double getLOF(int k)
Returns the k-LOF for a SearchObject for k.

Parameters:
k -


Copyright © 2001-2009 by Rapid-I