Documentation of 'org.neuroph.core.data.DataSet' Java class
DataSet
org.neuroph.core.data

Class DataSet

    • Constructor Summary

      Constructors 
      Constructor and Description
      DataSet(int inputSize)
      Creates an instance of new empty training set
      DataSet(int inputSize, int outputSize)
      Creates an instance of new empty training set
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean add(DataSetRow row) 
      void add(int index, DataSetRow row) 
      boolean addAll(java.util.Collection<? extends DataSetRow> c) 
      boolean addAll(int index, java.util.Collection<? extends DataSetRow> c) 
      boolean addRow(DataSetRow row)
      Adds new row row to this data set
      void addRow(double[] input)
      Adds a new dataset row with specified input
      void addRow(double[] input, double[] output)
      Adds a new dataset row with specified input and output
      void clear()
      Removes all alements from training set
      boolean contains(java.lang.Object o) 
      boolean containsAll(java.util.Collection<?> c) 
      static DataSet createFromFile(java.lang.String filePath, int inputsCount, int outputsCount, java.lang.String delimiter)
      Creates and returns data set from specified csv file
      static DataSet createFromFile(java.lang.String filePath, int inputsCount, int outputsCount, java.lang.String delimiter, boolean loadColumnNames)
      Creates and returns data set from specified csv file
      DataSet[] createTrainingAndTestSubsets(int trainSetPercent, int testSetPercent)
      Returns training and test subsets in the specified percent ratio
      DataSetRow get(int index) 
      java.lang.String getColumnName(int idx) 
      java.lang.String[] getColumnNames() 
      DataSetColumnType getColumnType(int index) 
      DataSetColumnType[] getColumnTypes() 
      java.lang.String getFilePath()
      Returns full file path for this training set
      int getInputSize()
      Returns input vector size of training elements in this training set This method is implementation of EngineIndexableSet interface, and it is added to provide compatibility with Encog data sets and FlatNetwork
      java.lang.String getLabel()
      Returns label for this training set
      int getOutputSize()
      Returns output vector size of training elements in this training set.
      DataSetRow getRowAt(int idx)
      Returns training row at specified index position
      java.util.List<DataSetRow> getRows()
      Returns elements of this training set
      int indexOf(java.lang.Object row) 
      boolean isEmpty()
      Returns true if training set is empty, false otherwise
      boolean isSupervised()
      Returns true if data set is supervised, false otherwise
      java.util.Iterator<DataSetRow> iterator()
      Returns Iterator for iterating training elements collection
      int lastIndexOf(java.lang.Object row) 
      java.util.ListIterator<DataSetRow> listIterator() 
      java.util.ListIterator<DataSetRow> listIterator(int index) 
      static DataSet load(java.lang.String filePath)
      Loads training set from the specified file TODO: throw checked exceptionse here
      DataSetRow remove(int index) 
      boolean remove(java.lang.Object row) 
      boolean removeAll(java.util.Collection<?> c) 
      void removeRowAt(int idx)
      Removes training row at specified index position
      boolean retainAll(java.util.Collection<?> c) 
      java.util.List<DataSet> sample(Sampling sampling) 
      void save()
      Saves this training set to file specified in its filePath field
      void save(java.lang.String filePath)
      Saves this training set to the specified file
      void saveAsTxt(java.lang.String filePath, java.lang.String delimiter) 
      DataSetRow set(int index, DataSetRow row) 
      void setColumnName(int idx, java.lang.String columnName) 
      void setColumnNames(java.lang.String[] columnNames) 
      void setColumnType(int index, DataSetColumnType columnType)
      Sets column type for the given index.
      void setFilePath(java.lang.String filePath)
      Sets full file path for this training set
      void setLabel(java.lang.String label)
      Sets label for this training set
      void shuffle() 
      int size()
      Returns number of training elements in this training set set
      java.util.List<DataSet> split(int... sizePercents) 
      java.util.List<DataSetRow> subList(int fromIndex, int toIndex) 
      java.lang.Object[] toArray() 
      <T> T[] toArray(T[] a) 
      java.lang.String toCSV()
      Returns enire dataset in csv format
      java.lang.String toString()
      Returns string representation of this data set
      • Methods inherited from class java.lang.Object

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

        equals, hashCode, replaceAll, sort, spliterator
      • Methods inherited from interface java.util.Collection

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

        forEach
    • Constructor Detail

      • DataSet

        public DataSet(int inputSize)
        Creates an instance of new empty training set
        Parameters:
        inputSize -
      • DataSet

        public DataSet(int inputSize,
                       int outputSize)
        Creates an instance of new empty training set
        Parameters:
        inputSize - Length of the input vector
        outputSize - Length of the output vector
    • Method Detail

      • addRow

        public void addRow(double[] input)
        Adds a new dataset row with specified input
        Parameters:
        input -
      • addRow

        public void addRow(double[] input,
                           double[] output)
        Adds a new dataset row with specified input and output
        Parameters:
        input -
        output -
      • removeRowAt

        public void removeRowAt(int idx)
        Removes training row at specified index position
        Parameters:
        idx - position of row to remove
      • iterator

        public java.util.Iterator<DataSetRow> iterator()
        Returns Iterator for iterating training elements collection
        Specified by:
        iterator in interface java.lang.Iterable<DataSetRow>
        Specified by:
        iterator in interface java.util.Collection<DataSetRow>
        Specified by:
        iterator in interface java.util.List<DataSetRow>
        Returns:
        Iterator for iterating training elements collection
      • getRows

        public java.util.List<DataSetRow> getRows()
        Returns elements of this training set
        Returns:
        training elements
      • getRowAt

        public DataSetRow getRowAt(int idx)
        Returns training row at specified index position
        Parameters:
        idx - index position of training row to return
        Returns:
        training row at specified index position
      • clear

        public void clear()
        Removes all alements from training set
        Specified by:
        clear in interface java.util.Collection<DataSetRow>
        Specified by:
        clear in interface java.util.List<DataSetRow>
      • isEmpty

        public boolean isEmpty()
        Returns true if training set is empty, false otherwise
        Specified by:
        isEmpty in interface java.util.Collection<DataSetRow>
        Specified by:
        isEmpty in interface java.util.List<DataSetRow>
        Returns:
        true if training set is empty, false otherwise
      • isSupervised

        public boolean isSupervised()
        Returns true if data set is supervised, false otherwise
        Returns:
      • size

        public int size()
        Returns number of training elements in this training set set
        Specified by:
        size in interface java.util.Collection<DataSetRow>
        Specified by:
        size in interface java.util.List<DataSetRow>
        Returns:
        number of training elements in this training set set
      • getLabel

        public java.lang.String getLabel()
        Returns label for this training set
        Returns:
        label for this training set
      • setLabel

        public void setLabel(java.lang.String label)
        Sets label for this training set
        Parameters:
        label - label for this training set
      • getColumnNames

        public java.lang.String[] getColumnNames()
      • setColumnNames

        public void setColumnNames(java.lang.String[] columnNames)
      • getColumnName

        public java.lang.String getColumnName(int idx)
      • setColumnName

        public void setColumnName(int idx,
                                  java.lang.String columnName)
      • setColumnType

        public void setColumnType(int index,
                                  DataSetColumnType columnType)
        Sets column type for the given index.
        Parameters:
        index - Index of the column in the row.
        columnType - Column type to set, nominal or numeric.
      • setFilePath

        public void setFilePath(java.lang.String filePath)
        Sets full file path for this training set
        Parameters:
        filePath -
      • getFilePath

        public java.lang.String getFilePath()
        Returns full file path for this training set
        Returns:
        full file path for this training set
      • toString

        public java.lang.String toString()
        Returns string representation of this data set
        Overrides:
        toString in class java.lang.Object
        Returns:
        string representation of this data set
      • toCSV

        public java.lang.String toCSV()
        Returns enire dataset in csv format
        Returns:
      • save

        public void save(java.lang.String filePath)
        Saves this training set to the specified file
        Parameters:
        filePath -
      • save

        public void save()
        Saves this training set to file specified in its filePath field
      • saveAsTxt

        public void saveAsTxt(java.lang.String filePath,
                              java.lang.String delimiter)
      • load

        public static DataSet load(java.lang.String filePath)
        Loads training set from the specified file TODO: throw checked exceptionse here
        Parameters:
        filePath - training set file
        Returns:
        loded training set
      • createFromFile

        public static DataSet createFromFile(java.lang.String filePath,
                                             int inputsCount,
                                             int outputsCount,
                                             java.lang.String delimiter,
                                             boolean loadColumnNames)
        Creates and returns data set from specified csv file
        Parameters:
        filePath - path to csv dataset file to import
        inputsCount - number of inputs
        outputsCount - number of outputs
        delimiter - delimiter of values
        loadColumnNames - true if csv file contains column names in first line, false otherwise
        Returns:
        instance of dataset with values from specified file TODO: try with resources, provide information on exact line of error if format is not good in NumberFormatException
      • createFromFile

        public static DataSet createFromFile(java.lang.String filePath,
                                             int inputsCount,
                                             int outputsCount,
                                             java.lang.String delimiter)
        Creates and returns data set from specified csv file
        Parameters:
        filePath - path to csv dataset file to import
        inputsCount - number of inputs
        outputsCount - number of outputs
        delimiter - delimiter of values
        Returns:
        instance of dataset with values from specified file
      • createTrainingAndTestSubsets

        public DataSet[] createTrainingAndTestSubsets(int trainSetPercent,
                                                      int testSetPercent)
        Returns training and test subsets in the specified percent ratio
        Parameters:
        trainSetPercent -
        testSetPercent -
        Returns:
      • split

        public java.util.List<DataSet> split(int... sizePercents)
      • getOutputSize

        public int getOutputSize()
        Returns output vector size of training elements in this training set.
      • getInputSize

        public int getInputSize()
        Returns input vector size of training elements in this training set This method is implementation of EngineIndexableSet interface, and it is added to provide compatibility with Encog data sets and FlatNetwork
      • shuffle

        public void shuffle()
      • contains

        public boolean contains(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<DataSetRow>
        Specified by:
        contains in interface java.util.List<DataSetRow>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<DataSetRow>
        Specified by:
        toArray in interface java.util.List<DataSetRow>
      • toArray

        public <T> T[] toArray(T[] a)
        Specified by:
        toArray in interface java.util.Collection<DataSetRow>
        Specified by:
        toArray in interface java.util.List<DataSetRow>
      • add

        public boolean add(DataSetRow row)
        Specified by:
        add in interface java.util.Collection<DataSetRow>
        Specified by:
        add in interface java.util.List<DataSetRow>
      • remove

        public boolean remove(java.lang.Object row)
        Specified by:
        remove in interface java.util.Collection<DataSetRow>
        Specified by:
        remove in interface java.util.List<DataSetRow>
      • containsAll

        public boolean containsAll(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<DataSetRow>
        Specified by:
        containsAll in interface java.util.List<DataSetRow>
      • addAll

        public boolean addAll(java.util.Collection<? extends DataSetRow> c)
        Specified by:
        addAll in interface java.util.Collection<DataSetRow>
        Specified by:
        addAll in interface java.util.List<DataSetRow>
      • addAll

        public boolean addAll(int index,
                              java.util.Collection<? extends DataSetRow> c)
        Specified by:
        addAll in interface java.util.List<DataSetRow>
      • removeAll

        public boolean removeAll(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<DataSetRow>
        Specified by:
        removeAll in interface java.util.List<DataSetRow>
      • retainAll

        public boolean retainAll(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<DataSetRow>
        Specified by:
        retainAll in interface java.util.List<DataSetRow>
      • get

        public DataSetRow get(int index)
        Specified by:
        get in interface java.util.List<DataSetRow>
      • add

        public void add(int index,
                        DataSetRow row)
        Specified by:
        add in interface java.util.List<DataSetRow>
      • remove

        public DataSetRow remove(int index)
        Specified by:
        remove in interface java.util.List<DataSetRow>
      • indexOf

        public int indexOf(java.lang.Object row)
        Specified by:
        indexOf in interface java.util.List<DataSetRow>
      • lastIndexOf

        public int lastIndexOf(java.lang.Object row)
        Specified by:
        lastIndexOf in interface java.util.List<DataSetRow>
      • listIterator

        public java.util.ListIterator<DataSetRow> listIterator()
        Specified by:
        listIterator in interface java.util.List<DataSetRow>
      • listIterator

        public java.util.ListIterator<DataSetRow> listIterator(int index)
        Specified by:
        listIterator in interface java.util.List<DataSetRow>
      • subList

        public java.util.List<DataSetRow> subList(int fromIndex,
                                                  int toIndex)
        Specified by:
        subList in interface java.util.List<DataSetRow>

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.