S - The type of the observations.T - The type of the categories.public class TrainingSet<S extends Observation,T extends Category> extends HashSet<net.sf.tweety.commons.util.Pair<S,T>>
| 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.
|
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(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, spliteratorequals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArrayparallelStream, removeIf, streampublic boolean add(S obs, T cat)
obs - some observationcat - the category of the observation.public Collection<T> getCategories()
public TrainingSet<S,T> getObservations(T cat)
cat - a categorypublic libsvm.svm_problem toLibsvmProblem()
public static TrainingSet<DefaultObservation,DoubleCategory> loadLibsvmTrainingFile(File file) throws NumberFormatException, IOException
file - some fileIOException - if some IO exception occurs.NumberFormatException - if the format of the file is not valid.Copyright © 2018. All rights reserved.