E - the type of data objects.public class Dataset<E> extends Object implements Iterable<Datum<E>>
| Constructor and Description |
|---|
Dataset()
Constructor.
|
Dataset(Attribute response)
Constructor.
|
Dataset(String name)
Constructor.
|
Dataset(String name,
Attribute response)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Datum<E> x)
Add a datum item into the dataset.
|
void |
add(E x)
Add a datum item into the dataset.
|
void |
add(E x,
double y)
Add a datum item into the dataset.
|
void |
add(E x,
double y,
double weight)
Add a datum item into the dataset.
|
void |
add(E x,
int y)
Add a datum item into the dataset.
|
void |
add(E x,
int y,
double weight)
Add a datum item into the dataset.
|
Datum<E> |
get(int i)
Returns the element at the specified position in this dataset.
|
String |
getDescription()
Returns the detailed dataset description.
|
String |
getName()
Returns the dataset name.
|
Iterator<Datum<E>> |
iterator()
Returns an iterator over the elements in this dataset in proper sequence.
|
Datum<E> |
remove(int i)
Removes the element at the specified position in this dataset.
|
Attribute |
response()
Returns the attribute of the response variable.
|
void |
setDescription(String description)
Sets the detailed dataset description.
|
void |
setName(String name)
Sets the dataset name.
|
int |
size()
Returns the size of dataset.
|
double[] |
toArray(double[] a)
Returns an array containing the response variable of the elements in this
dataset in proper sequence (from first to last element).
|
E[] |
toArray(E[] a)
Returns an array containing all of the elements in this dataset in
proper sequence (from first to last element); the runtime type of the
returned array is that of the specified array.
|
int[] |
toArray(int[] a)
Returns an array containing the class labels of the elements in this
dataset in proper sequence (from first to last element).
|
String[] |
toArray(String[] a)
Returns an array containing the string names of the elements in this
dataset in proper sequence (from first to last element).
|
Timestamp[] |
toArray(Timestamp[] a)
Returns an array containing the timestamps of the elements in this
dataset in proper sequence (from first to last element).
|
public Dataset()
public Dataset(String name)
name - the name of dataset.public Dataset(Attribute response)
response - the attribute type of response variable.public String getName()
public void setName(String name)
public void setDescription(String description)
public String getDescription()
public Attribute response()
public int size()
public void add(E x)
x - a datum item.public void add(E x, int y)
x - a datum item.y - the class label of the datum.public void add(E x, int y, double weight)
x - a datum item.y - the class label of the datum.weight - the weight of datum. The particular meaning of weight
depends on applications and machine learning algorithms. Although there
are on explicit requirements on the weights, in general, they should be
positive.public void add(E x, double y)
x - a datum item.y - the real-valued response for regression.public void add(E x, double y, double weight)
x - a datum item.weight - the weight of datum. The particular meaning of weight
depends on applications and machine learning algorithms. Although there
are on explicit requirements on the weights, in general, they should be
positive.public Datum<E> remove(int i)
i - the index of the element to be removed.public Datum<E> get(int i)
i - the index of the element to be returned.public Iterator<Datum<E>> iterator()
public E[] toArray(E[] a)
If the dataset fits in the specified array with room to spare (i.e., the array has more elements than the dataset), the element in the array immediately following the end of the dataset is set to null.
a - the array into which the elements of this dataset are to be
stored, if it is big enough; otherwise, a new array of the same runtime
type is allocated for this purpose.public int[] toArray(int[] a)
If the dataset fits in the specified array with room to spare (i.e., the array has more elements than the dataset), the element in the array immediately following the end of the dataset is set to Integer.MIN_VALUE.
a - the array into which the class labels of this dataset are to be
stored, if it is big enough; otherwise, a new array is allocated for
this purpose.public double[] toArray(double[] a)
If the dataset fits in the specified array with room to spare (i.e., the array has more elements than the dataset), the element in the array immediately following the end of the dataset is set to Double.NaN.
a - the array into which the response variable of this dataset are
to be stored, if it is big enough; otherwise, a new array is allocated
for this purpose.public String[] toArray(String[] a)
If the dataset fits in the specified array with room to spare (i.e., the array has more elements than the dataset), the element in the array immediately following the end of the dataset is set to null.
a - the array into which the string names of the elements in this
dataset are to be stored, if it is big enough; otherwise, a new array
is allocated for this purpose.public Timestamp[] toArray(Timestamp[] a)
If the dataset fits in the specified array with room to spare (i.e., the array has more elements than the dataset), the element in the array immediately following the end of the dataset is set to null.
a - the array into which the timestamps of the elements in this
dataset are to be stored, if it is big enough; otherwise, a new array
is allocated for this purpose.Copyright © 2015. All rights reserved.