public class DataSet extends Object implements List<DataSetRow>, Serializable
http://openforecast.sourceforge.net/docs/net/sourceforge/openforecast/DataSet.html
,
Serialized FormConstructor 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
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(DataSetRow row) |
void |
add(int index,
DataSetRow row) |
boolean |
addAll(Collection<? extends DataSetRow> c) |
boolean |
addAll(int index,
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(Object o) |
boolean |
containsAll(Collection<?> c) |
static DataSet |
createFromFile(String filePath,
int inputsCount,
int outputsCount,
String delimiter)
Creates and returns data set from specified csv file
|
static DataSet |
createFromFile(String filePath,
int inputsCount,
int outputsCount,
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) |
String |
getColumnName(int idx) |
String[] |
getColumnNames() |
DataSetColumnType |
getColumnType(int index) |
DataSetColumnType[] |
getColumnTypes() |
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
|
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
|
List<DataSetRow> |
getRows()
Returns elements of this training set
|
int |
indexOf(Object row) |
boolean |
isEmpty()
Returns true if training set is empty, false otherwise
|
boolean |
isSupervised()
Returns true if data set is supervised, false otherwise
|
Iterator<DataSetRow> |
iterator()
Returns Iterator for iterating training elements collection
|
int |
lastIndexOf(Object row) |
ListIterator<DataSetRow> |
listIterator() |
ListIterator<DataSetRow> |
listIterator(int index) |
static DataSet |
load(String filePath)
Loads training set from the specified file
TODO: throw checked exceptionse here
|
DataSetRow |
remove(int index) |
boolean |
remove(Object row) |
boolean |
removeAll(Collection<?> c) |
void |
removeRowAt(int idx)
Removes training row at specified index position
|
boolean |
retainAll(Collection<?> c) |
List<DataSet> |
sample(Sampling sampling) |
void |
save()
Saves this training set to file specified in its filePath field
|
void |
save(String filePath)
Saves this training set to the specified file
|
void |
saveAsTxt(String filePath,
String delimiter) |
DataSetRow |
set(int index,
DataSetRow row) |
void |
setColumnName(int idx,
String columnName) |
void |
setColumnNames(String[] columnNames) |
void |
setColumnType(int index,
DataSetColumnType columnType)
Sets column type for the given index.
|
void |
setFilePath(String filePath)
Sets full file path for this training set
|
void |
setLabel(String label)
Sets label for this training set
|
void |
shuffle() |
int |
size()
Returns number of training elements in this training set set
|
List<DataSet> |
split(int... sizePercents) |
List<DataSetRow> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toCSV()
Returns enire dataset in csv format
|
String |
toString()
Returns string representation of this data set
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, replaceAll, sort, spliterator
parallelStream, removeIf, stream
public DataSet(int inputSize)
inputSize
- public DataSet(int inputSize, int outputSize)
inputSize
- Length of the input vectoroutputSize
- Length of the output vectorpublic boolean addRow(DataSetRow row) throws VectorSizeMismatchException
row
- data set row to addVectorSizeMismatchException
public void addRow(double[] input)
input
- public void addRow(double[] input, double[] output)
input
- output
- public void removeRowAt(int idx)
idx
- position of row to removepublic Iterator<DataSetRow> iterator()
iterator
in interface Iterable<DataSetRow>
iterator
in interface Collection<DataSetRow>
iterator
in interface List<DataSetRow>
public List<DataSetRow> getRows()
public DataSetRow getRowAt(int idx)
idx
- index position of training row to returnpublic void clear()
clear
in interface Collection<DataSetRow>
clear
in interface List<DataSetRow>
public boolean isEmpty()
isEmpty
in interface Collection<DataSetRow>
isEmpty
in interface List<DataSetRow>
public boolean isSupervised()
public int size()
size
in interface Collection<DataSetRow>
size
in interface List<DataSetRow>
public String getLabel()
public void setLabel(String label)
label
- label for this training setpublic String[] getColumnNames()
public void setColumnNames(String[] columnNames)
public String getColumnName(int idx)
public void setColumnName(int idx, String columnName)
public DataSetColumnType[] getColumnTypes()
public DataSetColumnType getColumnType(int index)
public void setColumnType(int index, DataSetColumnType columnType)
index
- Index of the column in the row.columnType
- Column type to set, nominal or numeric.public void setFilePath(String filePath)
filePath
- public String getFilePath()
public String toString()
public String toCSV()
public void save(String filePath)
filePath
- public void save()
public static DataSet load(String filePath)
filePath
- training set filepublic static DataSet createFromFile(String filePath, int inputsCount, int outputsCount, String delimiter, boolean loadColumnNames)
filePath
- path to csv dataset file to importinputsCount
- number of inputsoutputsCount
- number of outputsdelimiter
- delimiter of valuesloadColumnNames
- true if csv file contains column names in first line, false otherwisepublic static DataSet createFromFile(String filePath, int inputsCount, int outputsCount, String delimiter)
filePath
- path to csv dataset file to importinputsCount
- number of inputsoutputsCount
- number of outputsdelimiter
- delimiter of valuespublic DataSet[] createTrainingAndTestSubsets(int trainSetPercent, int testSetPercent)
trainSetPercent
- testSetPercent
- public int getOutputSize()
public int getInputSize()
public void shuffle()
public boolean contains(Object o)
contains
in interface Collection<DataSetRow>
contains
in interface List<DataSetRow>
public Object[] toArray()
toArray
in interface Collection<DataSetRow>
toArray
in interface List<DataSetRow>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<DataSetRow>
toArray
in interface List<DataSetRow>
public boolean add(DataSetRow row)
add
in interface Collection<DataSetRow>
add
in interface List<DataSetRow>
public boolean remove(Object row)
remove
in interface Collection<DataSetRow>
remove
in interface List<DataSetRow>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<DataSetRow>
containsAll
in interface List<DataSetRow>
public boolean addAll(Collection<? extends DataSetRow> c)
addAll
in interface Collection<DataSetRow>
addAll
in interface List<DataSetRow>
public boolean addAll(int index, Collection<? extends DataSetRow> c)
addAll
in interface List<DataSetRow>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<DataSetRow>
removeAll
in interface List<DataSetRow>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<DataSetRow>
retainAll
in interface List<DataSetRow>
public DataSetRow get(int index)
get
in interface List<DataSetRow>
public DataSetRow set(int index, DataSetRow row)
set
in interface List<DataSetRow>
public void add(int index, DataSetRow row)
add
in interface List<DataSetRow>
public DataSetRow remove(int index)
remove
in interface List<DataSetRow>
public int indexOf(Object row)
indexOf
in interface List<DataSetRow>
public int lastIndexOf(Object row)
lastIndexOf
in interface List<DataSetRow>
public ListIterator<DataSetRow> listIterator()
listIterator
in interface List<DataSetRow>
public ListIterator<DataSetRow> listIterator(int index)
listIterator
in interface List<DataSetRow>
public List<DataSetRow> subList(int fromIndex, int toIndex)
subList
in interface List<DataSetRow>
Copyright © 2017 Neuroph Project. All rights reserved.