Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.evaluation.paircounting
Class PairCountingFMeasure

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.evaluation.paircounting.PairCountingFMeasure

public class PairCountingFMeasure
extends Object

Compare two clustering results using a pair-counting F-Measure. A pair are any two objects that belong to the same cluster. Two clusterings are compared by comparing their pairs; if two clusterings completely agree, they also agree on every pair; even when the clusters and points are ordered differently. An empty clustering will of course have no pairs, the trivial all-in-one clustering of course has n^2 pairs. Therefore neither recall nor precision itself are useful, however their combination -- the F-Measure -- is useful.

Author:
Erich Schubert

Constructor Summary
PairCountingFMeasure()
           
 
Method Summary
static
<R extends Clustering<M>,M extends Model,S extends Clustering<N>,N extends Model>
double
compareClusterings(R result1, S result2)
          Compare two clustering results.
static
<R extends Clustering<M>,M extends Model,S extends Clustering<N>,N extends Model>
double
compareClusterings(R result1, S result2, double beta)
          Compare two clustering results.
private static double countPairs(PairSortedGeneratorInterface first, PairSortedGeneratorInterface second, double beta)
          Compare two sets of generated pairs.
static
<R extends Clustering<M>,M extends Model>
PairSortedGeneratorInterface
getPairGenerator(R clusters)
          Get a pair generator for the given Clustering
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PairCountingFMeasure

public PairCountingFMeasure()
Method Detail

getPairGenerator

public static <R extends Clustering<M>,M extends Model> PairSortedGeneratorInterface getPairGenerator(R clusters)
Get a pair generator for the given Clustering

Type Parameters:
R - Clustering result class
M - Model type
Parameters:
clusters - Clustering result
Returns:
Sorted pair generator

compareClusterings

public static <R extends Clustering<M>,M extends Model,S extends Clustering<N>,N extends Model> double compareClusterings(R result1,
                                                                                                                          S result2,
                                                                                                                          double beta)
Compare two clustering results.

Type Parameters:
R - Result type
M - Model type
S - Result type
N - Model type
Parameters:
result1 - first result
result2 - second result
beta - Beta value for the F-Measure
Returns:
Pair counting F-Measure result.

compareClusterings

public static <R extends Clustering<M>,M extends Model,S extends Clustering<N>,N extends Model> double compareClusterings(R result1,
                                                                                                                          S result2)
Compare two clustering results.

Type Parameters:
R - Result type
M - Model type
S - Result type
N - Model type
Parameters:
result1 - first result
result2 - second result
Returns:
Pair counting F-1-Measure result.

countPairs

private static double countPairs(PairSortedGeneratorInterface first,
                                 PairSortedGeneratorInterface second,
                                 double beta)
Compare two sets of generated pairs.

Parameters:
first - first set
second - second set
beta - beta value for F-Measure
Returns:
F-beta-Measure for pairs.

Release 0.2 (2009-07-06_1820)