|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.myra.datamining.data.Dataset
public final class Dataset
This class represents a dataset.
Field Summary | |
---|---|
static java.lang.String |
CLASS_SEPARATOR
Default class separator for multi-label class value. |
Constructor Summary | |
---|---|
Dataset(Metadata metadata)
Creates a new Dataset instance. |
Method Summary | |
---|---|
void |
add(java.lang.String[] values)
Adds a new instance to the dataset. |
Dataset |
clone()
|
void |
computeDomains()
Computes the continuous attributes' domain values. |
boolean |
contains(Attribute attribute,
java.lang.String value)
Checks if the dataset contains an instance with the (attribute,value) pair. |
int[] |
count()
Returns the class count vector. |
java.util.List<Instance> |
filter(java.lang.String... c)
Returns the list of instances that belongs to any of the specified class labels. |
double[] |
frequency()
Returns the class frequency vector. |
Instance |
get(int index)
Returns the instance specified by the index. |
java.lang.String |
getFilename()
Returns the dataset filename. |
java.util.List<Instance> |
getInstances()
Returns the list of instances. |
java.util.List<Instance> |
getInstances(Attribute attribute,
java.lang.String value)
Returns the list of instances that have the specified (attribute, value) combination. |
java.util.List<Instance> |
getInstances(Label label)
Returns the list of instances that have the specified label. |
java.util.List<Instance> |
getInstances(java.lang.String... c)
Returns the list of instances that belongs to the specified class. |
java.util.List<Instance> |
getInstances(Term term)
Returns the list of instances that satisfy the specified term. |
Metadata |
getMetadata()
Returns the Metadata object associated with this
dataset. |
int |
getSize()
Returns the size (number of instances) of the dataset. |
int |
getSize(java.lang.String c)
Returns the number of instances that belong to the specified class. |
boolean |
hasDuplicates()
Checks if the dataset has duplicated instances (instances with the same values for every attribute). |
boolean |
hasMissing()
Checks of the dataset contains instances with missing values. |
boolean |
isEmpty()
Returns true if the dataset contains no instances. |
boolean |
isMultilabel()
Verifies if this is a multi-label dataset (i.e. |
java.util.Iterator<Instance> |
iterator()
|
Instance |
newInstance()
Returns a new Instance associated with this dataset. |
void |
remove(Attribute attribute)
Removes the specified attribute from the dataset. |
boolean |
remove(java.util.Collection<Instance> instances)
Removes all this dataset's instances that are contained in the specified collection. |
boolean |
remove(Instance instance)
Removes the first occurrence in this dataset of the specified instance. |
boolean |
remove(int index)
Removes the instance with the specified index. |
void |
reset()
Resets the instances' weights. |
void |
setFilename(java.lang.String filename)
Sets the dataset filename. |
void |
setInstances(java.util.List<Instance> instances)
Sets the dataset instances. |
java.lang.String |
toString()
|
Dataset |
withoutDuplicates()
Returns a new dataset instance without duplicated instances. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_SEPARATOR
Constructor Detail |
---|
public Dataset(Metadata metadata)
Dataset
instance.
metadata
- the metadata information.Method Detail |
---|
public java.lang.String getFilename()
public void setFilename(java.lang.String filename)
filename
- the filename to set.public void add(java.lang.String[] values)
values
- the instance values.public java.util.Iterator<Instance> iterator()
iterator
in interface java.lang.Iterable<Instance>
public boolean hasDuplicates()
true
if the dataset contains duplicated instances;
false
otherwise.public boolean hasMissing()
true
if the dataset contains instances with missing
values; false
otherwise.public Instance newInstance()
Instance
associated with this dataset.
Instance
associated with this dataset.public final Metadata getMetadata()
Metadata
object associated with this
dataset.
Metadata
object associated with this
dataset.public int getSize()
public int getSize(java.lang.String c)
c
- the class value.
public java.util.List<Instance> getInstances()
public java.util.List<Instance> getInstances(java.lang.String... c)
c
- the class value.
public java.util.List<Instance> getInstances(Attribute attribute, java.lang.String value)
attribute
- the attribute to check.value
- the value to check.
public java.util.List<Instance> getInstances(Term term)
term
- the term to be used.
public java.util.List<Instance> getInstances(Label label)
getInstances(String...)
method,
since it only returns the instances that have the exact label.
label
- the label of the instances.
public java.util.List<Instance> filter(java.lang.String... c)
c
- the specified class labels.
public boolean isEmpty()
true
if the dataset contains no instances.
true
if the dataset contains no instances;
false
otherwise.public boolean isMultilabel()
true
if this is a multi-label dataset;
false
otherwise.public void setInstances(java.util.List<Instance> instances)
instances
- the new dataset instances.public boolean contains(Attribute attribute, java.lang.String value)
attribute
- the attribute to check.value
- the value to check.
true
if the dataset contains an instance with the
specified (attribute,value) pair; false
otherwise.public boolean remove(Instance instance)
instance
- the instance to be removed, if present.
true
if the dataset contained the specified
instance; false
otherwise.public boolean remove(int index)
index
- the instance index.
true
if the dataset contained the specified
instance; false
otherwise.public void remove(Attribute attribute)
Metadata
instance.
attribute
- the attribute to be removed.public boolean remove(java.util.Collection<Instance> instances)
instances
- instances to be removed from this dataset.
true
if this dataset changed as a result of the
call; false
otherwise.public int[] count()
public double[] frequency()
public Instance get(int index)
index
- the instance's index.
public Dataset withoutDuplicates()
public void computeDomains()
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
public Dataset clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |