de.lmu.ifi.dbs.elki.algorithm.statistics
Class DistanceStatisticsWithClasses<O,D extends NumberDistance<D,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm<R>
      extended by de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm<O,D,CollectionResult<DoubleVector>>
          extended by de.lmu.ifi.dbs.elki.algorithm.statistics.DistanceStatisticsWithClasses<O,D>
Type Parameters:
O - Object type
D - Distance type
All Implemented Interfaces:
Algorithm, InspectionUtilFrequentlyScanned, Parameterizable

@Title(value="Distance Histogram")
@Description(value="Computes a histogram over the distances occurring in the data set.")
public class DistanceStatisticsWithClasses<O,D extends NumberDistance<D,?>>
extends AbstractDistanceBasedAlgorithm<O,D,CollectionResult<DoubleVector>>

Algorithm to gather statistics over the distance distribution in the data set.


Nested Class Summary
static class DistanceStatisticsWithClasses.Parameterizer<O,D extends NumberDistance<D,?>>
          Parameterization class.
 
Field Summary
private  boolean exact
          Sampling
static OptionID EXACT_ID
          Flag to compute exact value range for binning.
static OptionID HISTOGRAM_BINS_ID
          Option to configure the number of bins to use.
private static Logging logger
          The logger for this class.
private  int numbin
          Number of bins to use in sampling.
private  boolean sampling
          Sampling
static OptionID SAMPLING_ID
          Flag to enable sampling
 
Fields inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm
DISTANCE_FUNCTION_ID
 
Constructor Summary
DistanceStatisticsWithClasses(DistanceFunction<? super O,D> distanceFunction, int numbins, boolean exact, boolean sampling)
          Constructor.
 
Method Summary
private  DoubleMinMax exactMinMax(Relation<O> database, DistanceQuery<O,D> distFunc)
           
 TypeInformation[] getInputTypeRestriction()
          Get the input type restriction used for negotiating the data query.
protected  Logging getLogger()
          Get the (STATIC) logger for this class.
 HistogramResult<DoubleVector> run(Database database)
          Iterates over all points in the database.
private  DoubleMinMax sampleMinMax(Relation<O> database, DistanceQuery<O,D> distFunc)
           
private  void shrinkHeap(TreeSet<FCPair<Double,DBID>> hotset, int k)
           
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm
getDistanceFunction
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm
makeParameterDistanceFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logging logger
The logger for this class.


EXACT_ID

public static final OptionID EXACT_ID
Flag to compute exact value range for binning.


SAMPLING_ID

public static final OptionID SAMPLING_ID
Flag to enable sampling


HISTOGRAM_BINS_ID

public static final OptionID HISTOGRAM_BINS_ID
Option to configure the number of bins to use.


numbin

private int numbin
Number of bins to use in sampling.


sampling

private boolean sampling
Sampling


exact

private boolean exact
Sampling

Constructor Detail

DistanceStatisticsWithClasses

public DistanceStatisticsWithClasses(DistanceFunction<? super O,D> distanceFunction,
                                     int numbins,
                                     boolean exact,
                                     boolean sampling)
Constructor.

Parameters:
distanceFunction - Distance function to use
numbins - Number of bins
exact - Exactness flag
sampling - Sampling flag
Method Detail

run

public HistogramResult<DoubleVector> run(Database database)
                                  throws IllegalStateException
Iterates over all points in the database.

Specified by:
run in interface Algorithm
Overrides:
run in class AbstractAlgorithm<CollectionResult<DoubleVector>>
Parameters:
database - the database to run the algorithm on
Returns:
the Result computed by this algorithm
Throws:
IllegalStateException - if the algorithm has not been initialized properly (e.g. the setParameters(String[]) method has been failed to be called).

sampleMinMax

private DoubleMinMax sampleMinMax(Relation<O> database,
                                  DistanceQuery<O,D> distFunc)

exactMinMax

private DoubleMinMax exactMinMax(Relation<O> database,
                                 DistanceQuery<O,D> distFunc)

shrinkHeap

private void shrinkHeap(TreeSet<FCPair<Double,DBID>> hotset,
                        int k)

getInputTypeRestriction

public TypeInformation[] getInputTypeRestriction()
Description copied from class: AbstractAlgorithm
Get the input type restriction used for negotiating the data query.

Specified by:
getInputTypeRestriction in interface Algorithm
Specified by:
getInputTypeRestriction in class AbstractAlgorithm<CollectionResult<DoubleVector>>
Returns:
Type restriction

getLogger

protected Logging getLogger()
Description copied from class: AbstractAlgorithm
Get the (STATIC) logger for this class.

Specified by:
getLogger in class AbstractAlgorithm<CollectionResult<DoubleVector>>
Returns:
the static logger

Release 0.4.0 (2011-09-20_1324)