Documentation of 'medusa.georgios.enhanced_mcl.DefaultDataset' Java class
DefaultDataset
medusa.georgios.enhanced_mcl

Class 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean add(Instance e)
      Add an instance to this data set.
      void add(int index, Instance e) 
      boolean addAll(java.util.Collection<? extends Instance> c) 
      boolean addAll(int index, java.util.Collection<? extends Instance> c) 
      void addElement(Instance e) 
      java.util.SortedSet<java.lang.Object> classes()
      Returns a set containing all different classes in this data set.
      int classIndex(java.lang.Object clazz)
      Returns the index of the class value in the supplied data set.
      java.lang.Object classValue(int index) 
      void clear() 
      Dataset[] folds(int numFolds, java.util.Random rg)
      Create a number of folds from the data set and return them.
      void insertElementAt(Instance e, int index) 
      Instance instance(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.
      int noAttributes()
      The number of attributes in each instance.
      void setElementAt(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
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.List

        contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
    • 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)
        Specified by:
        addAll in interface java.util.Collection<Instance>
        Specified by:
        addAll in interface java.util.List<Instance>
        Overrides:
        addAll in class java.util.Vector<Instance>
      • addAll

        public boolean addAll(int index,
                              java.util.Collection<? extends Instance> c)
        Specified by:
        addAll in interface java.util.List<Instance>
        Overrides:
        addAll in class java.util.Vector<Instance>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<Instance>
        Specified by:
        clear in interface java.util.List<Instance>
        Overrides:
        clear in class java.util.Vector<Instance>
      • add

        public boolean add(Instance e)
        Description copied from interface: Dataset
        Add 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:
        add in interface java.util.Collection<Instance>
        Specified by:
        add in interface java.util.List<Instance>
        Specified by:
        add in interface Dataset
        Overrides:
        add in class java.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)
        Specified by:
        add in interface java.util.List<Instance>
        Overrides:
        add in class java.util.Vector<Instance>
      • addElement

        public void addElement(Instance e)
        Overrides:
        addElement in class java.util.Vector<Instance>
      • insertElementAt

        public void insertElementAt(Instance e,
                                    int index)
        Overrides:
        insertElementAt in class java.util.Vector<Instance>
      • setElementAt

        public void setElementAt(Instance e,
                                 int index)
        Overrides:
        setElementAt in class java.util.Vector<Instance>
      • instance

        public Instance instance(int index)
        Description copied from interface: Dataset
        Get the instance with a certain index.
        Specified by:
        instance in interface Dataset
        Parameters:
        index - the index of the instance you want to retrieve.
        Returns:
      • classes

        public java.util.SortedSet<java.lang.Object> classes()
        Description copied from interface: Dataset
        Returns a set containing all different classes in this data set. If no classes are available, this will return the empty set.
        Specified by:
        classes in interface Dataset
        Returns:
      • 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.
        Specified by:
        kNearest in interface Dataset
        Parameters:
        dm - the distance measure used to calculate the distance between instances
        inst - the instance for which we need to find the closest
        Returns:
        the instances from the supplied data set that are closest to the supplied instance
      • folds

        public Dataset[] folds(int numFolds,
                               java.util.Random rg)
        Description copied from interface: Dataset
        Create 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.
        Specified by:
        folds in interface Dataset
        Parameters:
        numFolds - the number of folds to create
        rg - the random generator
        Returns:
        an array of data sets that contains numFolds data sets.
      • noAttributes

        public int noAttributes()
        Description copied from interface: Dataset
        The 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:
        noAttributes in interface Dataset
        Returns:
      • classIndex

        public int classIndex(java.lang.Object clazz)
        Description copied from interface: Dataset
        Returns 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:
        classIndex in interface Dataset
        Returns:
        the index of the class value
      • classValue

        public java.lang.Object classValue(int index)
        Specified by:
        classValue in interface Dataset

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.