javax.visrec.ml.data

## Class BasicDataSet<E>

- java.lang.Object
- - javax.visrec.ml.data.BasicDataSet<E>

All Implemented Interfaces:
  Iterable<E>, DataSet<E>

    public class BasicDataSet<E>
    extends Object
    implements DataSet<E>

Basic implementation of `DataSet` interface

Author:
  Zoran Sevarac

### Nested Class Summary

### Nested classes/interfaces inherited from interface javax.visrec.ml.data.DataSet

`DataSet.Column, DataSet.ColumnType`

### Constructor Summary

Constructors
Constructor and Description
`BasicDataSet(DataSet.Column[] cols)` Creates an instance of `BasicDataSet`
`BasicDataSet(List<E> elements)` Creates an instance of `BasicDataSet`

### Method Summary

All Methods Instance Methods Concrete Methods
`DataSet<E>` `add(E item)` Adds an element to this data set.
`DataSet<E>` `addAll(DataSet<E> items)` Add an existing `DataSet` to the current `DataSet`
`void` `clear()` Clear items of the `DataSet`
`E` `get(int index)` Get an item from the `DataSet`
`List<E>` `getItems()` Get a collection of the items in the `DataSet`
`String[]` `getTargetLabels()`
`boolean` `isEmpty()` Determines whether the `DataSet` is empty or not.
`Iterator<E>` `iterator()`
`int` `size()` Get the number of elements in `DataSet`
`DataSet<E>[]` `split(double... parts)` Split data set into parts of specified sizes
`DataSet<E>[]` `split(int parts)` Split dataset into specified number of equally sized parts.
`DataSet<E>[]` `split(int parts, Random rnd)` Split dataset into specified number of equally sized parts, using specified random generator.
`DataSet[]` `split(Random rnd, double... parts)` Split data set into parts of specified sizes using specified random generator

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface javax.visrec.ml.data.DataSet

`shuffle, shuffle, split`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### BasicDataSet

    public BasicDataSet(DataSet.Column[] cols)

Creates an instance of `BasicDataSet`

Parameters:
  `cols` - columns of the data set.

#### BasicDataSet

    public BasicDataSet(List<E> elements)

Creates an instance of `BasicDataSet`

Parameters:
  `elements` - items of the data set.

### Method Detail

#### add

    public DataSet<E> add(E item)

Description copied from interface: `DataSet`
Adds an element to this data set.

Specified by:
  `add` in interface `DataSet<E>`
Parameters:
  `item` - data set item to add to the data set
Returns:
  current instance of `DataSet`

#### addAll

    public DataSet<E> addAll(DataSet<E> items)

Description copied from interface: `DataSet`
Add an existing `DataSet` to the current `DataSet`

Specified by:
  `addAll` in interface `DataSet<E>`
Parameters:
  `items` - existing `DataSet`
Returns:
  current instance of `DataSet`

#### get

    public E get(int index)

Description copied from interface: `DataSet`
Get an item from the `DataSet`

Specified by:
  `get` in interface `DataSet<E>`
Parameters:
  `index` - index as `int` which corresponds with the index of the `DataSet`
Returns:
  item from the `DataSet`

#### clear

    public void clear()

Description copied from interface: `DataSet`
Clear items of the `DataSet`

Specified by:
  `clear` in interface `DataSet<E>`

#### isEmpty

    public boolean isEmpty()

Description copied from interface: `DataSet`
Determines whether the `DataSet` is empty or not.

Specified by:
  `isEmpty` in interface `DataSet<E>`
Returns:
  `true` if the `DataSet` is empty, otherwise `false`

#### size

    public int size()

Description copied from interface: `DataSet`
Get the number of elements in `DataSet`

Specified by:
  `size` in interface `DataSet<E>`
Returns:
  size in `int`

#### split

    public DataSet<E>[] split(int parts)

Description copied from interface: `DataSet`
Split dataset into specified number of equally sized parts.

Specified by:
  `split` in interface `DataSet<E>`
Parameters:
  `parts` - number of parts to be returned
Returns:
  multiple `DataSet` in an array.

#### split

    public DataSet<E>[] split(int parts,
                              Random rnd)

Description copied from interface: `DataSet`
Split dataset into specified number of equally sized parts, using specified random generator.

Specified by:
  `split` in interface `DataSet<E>`
Parameters:
  `parts` - number of parts/subsets to return
  `rnd` - random number generator
Returns:
  multiple `DataSet` in an array.

#### split

    public DataSet<E>[] split(double... parts)

Description copied from interface: `DataSet`
Split data set into parts of specified sizes

Specified by:
  `split` in interface `DataSet<E>`
Parameters:
  `parts` - specific sizes of `DataSet`
Returns:
  array of `DataSet`

#### split

    public DataSet[] split(Random rnd,
                           double... parts)

Description copied from interface: `DataSet`
Split data set into parts of specified sizes using specified random generator

Specified by:
  `split` in interface `DataSet<E>`
Parameters:
  `rnd` - random generator
  `parts` - specific sizes of `DataSet`
Returns:
  array of `DataSet`

#### getTargetLabels

    public String[] getTargetLabels()

#### iterator

    public Iterator<E> iterator()

Specified by:
  `iterator` in interface `Iterable<E>`

#### getItems

    public List<E> getItems()

Description copied from interface: `DataSet`
Get a collection of the items in the `DataSet`

Specified by:
  `getItems` in interface `DataSet<E>`
Returns:
  `Collection`