Package uk.ac.starlink.topcat
Class Classifier<T>
- java.lang.Object
-
- uk.ac.starlink.topcat.Classifier<T>
-
public class Classifier<T> extends java.lang.Object
Categorises submitted data values by equality into a set of mutually exclusive groups.- Since:
- 3 Feb 2015
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Classifier.CountedValue<T>
Aggregates a value and the number of times it has been submitted.
-
Constructor Summary
Constructors Constructor Description Classifier()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getItemCount()
Returns the number of values submitted so far.java.util.Collection<Classifier.CountedValue<T>>
getThresholdValues(int minCount)
Returns a sorted list of the values with a certain minimum count.java.util.SortedSet<Classifier.CountedValue<T>>
getTopValues(int nValue)
Returns a sorted list of the N most popular values.long
getValueCount()
Returns the number of distinct values seen so far.void
submit(T value)
Submits a value for categorisation.
-
-
-
Method Detail
-
submit
public void submit(T value)
Submits a value for categorisation.- Parameters:
value
- value
-
getItemCount
public long getItemCount()
Returns the number of values submitted so far.- Returns:
- total item count
-
getValueCount
public long getValueCount()
Returns the number of distinct values seen so far.- Returns:
- number of distinct values
-
getTopValues
public java.util.SortedSet<Classifier.CountedValue<T>> getTopValues(int nValue)
Returns a sorted list of the N most popular values.- Parameters:
nValue
- maximum number of values to return- Returns:
- collection of submitted values, in descending order of popularity
-
getThresholdValues
public java.util.Collection<Classifier.CountedValue<T>> getThresholdValues(int minCount)
Returns a sorted list of the values with a certain minimum count.- Parameters:
minCount
- minimum number of submissions for each returned value- Returns:
- collection of submitted values, in descending order of popularity
-
-