public class myDataset
extends java.lang.Object
Constructor and Description |
---|
myDataset(myDataset dataset)
Creates a dataset from another existing dataset
|
myDataset(java.lang.String nameFile,
int newkind)
Creates a dataset by reading the .dat file that contains the information of it,
and gives values to every field of the class
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Check if a dataset is the same dataset as another object
|
myAttribute |
getAttributeI(int i)
Gets all the information about ith the attribute that the dataset uses
|
java.util.ArrayList<myAttribute> |
getAttributes()
Gets all the information about the attributes that the dataset uses
|
double |
getDataI(int i,
int j)
Gets the value of the jth attribute for the ith instance in the dataset
|
double[] |
getDataItem(int i)
Gets the value of the ith instance in the dataset
|
int |
getKind()
Gets the kind of the dataset we are considering (training, reference, test)
|
java.lang.String |
getName()
Gets the name of the dataset
|
int |
getNInstancesI(int i)
Gets the number of instances of each class that there are in the dataset
|
int |
getNumAtr()
Gets the number of attributes that the dataset has
|
int |
getNumClasses()
Gets the number of different classes that there are in the dataset
|
int |
getNumIns()
Gets the number of instances that the dataset has
|
myAttribute |
getOutputAttribute()
Gets all the information about the output attribute of the dataset
|
int |
getOutputI(int i)
Gets the class of each instance in the dataset
|
int |
hashCode()
Hash-code function for the class that is used when object is inserted in a structure like a hashtable
|
void |
setAttributeI(int i,
myAttribute att)
Replaces the information about the ith attribute that the dataset uses with new information about that attribute
|
void |
setAttributes(java.util.ArrayList<myAttribute> attributes)
Replaces all the information about the attributes that the dataset uses with new information about the attributes
|
void |
setDataI(int i,
int j,
double data)
Replaces the value of the ith instance at the jth attribute in this dataset with the specified value
|
void |
setKind(int kind)
Changes the kind of dataset to a new kind
|
void |
setName(java.lang.String name)
Replaces the name of the dataset with another new name
|
void |
setNInstancesI(int i,
int instances)
Replaces the number of instances of a class that there are in the dataset with a another number of instances for that class
|
void |
setNumAtr(int numAtr)
Replaces the number of attributes in this dataset with a new number of attributes
|
void |
setNumClasses(int numClasses)
Replaces the number of classes in this dataset with a new number of classes
|
void |
setNumIns(int numIns)
Replaces the number of instances in this dataset with a new number of instances
|
void |
setOutputAttribute(myAttribute outputAttribute)
Replaces the information about the output attribute with new information about that attribute
|
void |
setOutputI(int i,
int output)
Replaces the output attribute value at the specified instance in this dataset with the specified value
|
java.lang.String |
toString()
Overriden function that converts the class to a string
|
public myDataset(java.lang.String nameFile, int newkind) throws CheckException
nameFile
- The name of the file that is going to be readnewkind
- The kind of dataset to determine if the file is for training, reference or testCheckException
- Thrown from the CheckException classpublic myDataset(myDataset dataset)
dataset
- Original dataset from which we are going to create a copypublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object that is checked to see if it is the same datasetObject.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- New name for the datasetpublic int getNumAtr()
public void setNumAtr(int numAtr)
numAtr
- New number of attributes for this datasetpublic int getNumIns()
public void setNumIns(int numIns)
numIns
- New number of instances for this datasetpublic java.util.ArrayList<myAttribute> getAttributes()
public void setAttributes(java.util.ArrayList<myAttribute> attributes)
attributes
- New information about the attributes that the dataset usespublic myAttribute getAttributeI(int i)
i
- index of the attribute askedpublic void setAttributeI(int i, myAttribute att)
i
- Position of the attribute that is going to be replacedatt
- New information about the attribute that the dataset usespublic myAttribute getOutputAttribute()
public void setOutputAttribute(myAttribute outputAttribute)
outputAttribute
- Attribute to be stored like the output attributepublic int getNumClasses()
public void setNumClasses(int numClasses)
numClasses
- New number of classes for this datasetpublic int getNInstancesI(int i)
i
- class index.public void setNInstancesI(int i, int instances)
i
- Class which number of instances is going to be modifiedinstances
- New number of instances for the ith classpublic double getDataI(int i, int j)
i
- index of the instance.j
- index of the attribute.public double[] getDataItem(int i)
i
- instance's index.public void setDataI(int i, int j, double data)
i
- Position of the instance which value is going to be replacedj
- Attribute which value is going to be replaceddata
- Value to be stored at the specified instance and attributepublic int getOutputI(int i)
i
- instance's index.public void setOutputI(int i, int output)
i
- Index of the instance output value to replaceoutput
- Value to be stored at the specified instancepublic int getKind()
public void setKind(int kind)
kind
- New kind for the dataset