medusa.georgios.enhanced_mcl
Class DefaultDataset
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<Instance>
-
- medusa.georgios.enhanced_mcl.DefaultDataset
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Instance>, java.util.Collection<Instance>, java.util.List<Instance>, java.util.RandomAccess, Dataset
public class DefaultDataset extends java.util.Vector<Instance> implements Dataset
Provides a standard data set implementation.- See Also:
Dataset, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DefaultDataset()DefaultDataset(java.util.Collection<Instance> coll)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanadd(Instance e)Add an instance to this data set.voidadd(int index, Instance e)booleanaddAll(java.util.Collection<? extends Instance> c)booleanaddAll(int index, java.util.Collection<? extends Instance> c)voidaddElement(Instance e)java.util.SortedSet<java.lang.Object>classes()Returns a set containing all different classes in this data set.intclassIndex(java.lang.Object clazz)Returns the index of the class value in the supplied data set.java.lang.ObjectclassValue(int index)voidclear()Dataset[]folds(int numFolds, java.util.Random rg)Create a number of folds from the data set and return them.voidinsertElementAt(Instance e, int index)Instanceinstance(int index)Get the instance with a certain index.java.util.Set<Instance>kNearest(int k, Instance inst)Returns the k instances of the given data set that are the closest to the instance that is given as a parameter.intnoAttributes()The number of attributes in each instance.voidsetElementAt(Instance e, int index)-
Methods inherited from class java.util.Vector
capacity, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, replaceAll, retainAll, set, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
-
-
-
-
Constructor Detail
-
DefaultDataset
public DefaultDataset(java.util.Collection<Instance> coll)
-
DefaultDataset
public DefaultDataset()
-
-
Method Detail
-
addAll
public boolean addAll(java.util.Collection<? extends Instance> c)
-
addAll
public boolean addAll(int index, java.util.Collection<? extends Instance> c)
-
clear
public void clear()
-
add
public boolean add(Instance e)
Description copied from interface:DatasetAdd an instance to this data set. The compatibility of the new item with the items in the data set should be checked by the implementation. Incompatible items should not be added to the data set.- Specified by:
addin interfacejava.util.Collection<Instance>- Specified by:
addin interfacejava.util.List<Instance>- Specified by:
addin interfaceDataset- Overrides:
addin classjava.util.Vector<Instance>- Parameters:
e- the instance to be added- Returns:
- true if the instance was added, otherwise false
-
add
public void add(int index, Instance e)
-
addElement
public void addElement(Instance e)
- Overrides:
addElementin classjava.util.Vector<Instance>
-
insertElementAt
public void insertElementAt(Instance e, int index)
- Overrides:
insertElementAtin classjava.util.Vector<Instance>
-
setElementAt
public void setElementAt(Instance e, int index)
- Overrides:
setElementAtin classjava.util.Vector<Instance>
-
instance
public Instance instance(int index)
Description copied from interface:DatasetGet the instance with a certain index.
-
classes
public java.util.SortedSet<java.lang.Object> classes()
Description copied from interface:DatasetReturns a set containing all different classes in this data set. If no classes are available, this will return the empty set.
-
kNearest
public java.util.Set<Instance> kNearest(int k, Instance inst)
Returns the k instances of the given data set that are the closest to the instance that is given as a parameter.
-
folds
public Dataset[] folds(int numFolds, java.util.Random rg)
Description copied from interface:DatasetCreate a number of folds from the data set and return them. The supplied random generator is used to determine which instances are assigned to each of the folds.
-
noAttributes
public int noAttributes()
Description copied from interface:DatasetThe number of attributes in each instance. This value can be off when instances have different number of attributes. When the data set contains no instances, this method should return 0.- Specified by:
noAttributesin interfaceDataset- Returns:
-
classIndex
public int classIndex(java.lang.Object clazz)
Description copied from interface:DatasetReturns the index of the class value in the supplied data set. This method will return -1 if the class value of this instance is not set.- Specified by:
classIndexin interfaceDataset- Returns:
- the index of the class value
-
classValue
public java.lang.Object classValue(int index)
- Specified by:
classValuein interfaceDataset
-
-
DMelt 3.0 © DataMelt by jWork.ORG