S
- The type of the observations.T
- The type of the categories.public class TrainingSet<S extends Observation,T extends Category> extends java.util.HashSet<Pair<S,T>>
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
For serialization.
|
Constructor and Description |
---|
TrainingSet() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(S obs,
T cat)
Adds the specified elements as a pair to this set
if it is not already present.
|
java.util.Collection<T> |
getCategories()
Returns the collection of categories present in this
training set.
|
TrainingSet<S,T> |
getObservations(T cat)
Returns all observations of the given category.
|
static TrainingSet<DefaultObservation,DoubleCategory> |
loadLibsvmTrainingFile(java.io.File file)
Loads a training file in LIBSVM syntax
|
libsvm.svm_problem |
toLibsvmProblem()
Returns a svm_problem (the data data model of libsvm) of this training set.
|
add, clear, clone, contains, isEmpty, iterator, remove, size, spliterator
addAll, containsAll, retainAll, toArray, toArray, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
private static final long serialVersionUID
public boolean add(S obs, T cat)
obs
- some observationcat
- the category of the observation.public java.util.Collection<T> getCategories()
public TrainingSet<S,T> getObservations(T cat)
cat
- a categorypublic libsvm.svm_problem toLibsvmProblem()
public static TrainingSet<DefaultObservation,DoubleCategory> loadLibsvmTrainingFile(java.io.File file) throws java.lang.NumberFormatException, java.io.IOException
file
- some filejava.io.IOException
- if some IO exception occurs.java.lang.NumberFormatException
- if the format of the file is not valid.