java.io.Serializable
InstancesHeader
public class Instances
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field | Description |
---|---|---|
protected ArffLoader |
arff |
The arff.
|
static java.lang.String |
ARFF_DATA |
The keyword used to denote the start of the arff data section
|
static java.lang.String |
ARFF_RELATION |
The keyword used to denote the start of an arff header
|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
hsAttributesIndices |
A Hash that stores the indices of features.
|
protected int[] |
indicesIrrelevants |
Indices of irrelevant features.
|
protected int[] |
indicesRelevants |
Indices of relevant features.
|
protected InstanceInformation |
instanceInformation |
The instance information.
|
protected java.util.List<Instance> |
instances |
The instances.
|
Constructor | Description |
---|---|
Instances() |
Instantiates a new instances.
|
Instances(Instances chunk) |
Instantiates a new instances.
|
Instances(Instances chunk,
int capacity) |
Instantiates a new instances.
|
Instances(Instances chunk,
int first,
int toCopy) |
Instantiates a new instances.
|
Instances(java.io.Reader reader,
int size,
int classAttribute) |
Instantiates a new instances.
|
Instances(java.io.Reader reader,
Range range) |
Instantiates a new instances.
|
Instances(java.io.StringReader st,
int capacity) |
Instantiates a new instances.
|
Instances(java.lang.String st,
Attribute[] v,
int capacity) |
Instantiates a new instances.
|
Instances(java.lang.String st,
java.util.List<Attribute> v,
int capacity) |
Instantiates a new instances.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(Instance inst) |
Adds the.
|
Attribute |
attribute(int w) |
Attribute.
|
Attribute |
attribute(java.lang.String name) |
|
Attribute |
classAttribute() |
Class attribute.
|
int |
classIndex() |
Class index.
|
protected void |
copyInstances(int from,
Instances dest,
int num) |
|
void |
delete() |
Delete.
|
void |
delete(int index) |
Delete.
|
void |
deleteAttributeAt(java.lang.Integer integer) |
Delete attribute at.
|
Instance |
get(int k) |
|
int[] |
getIndicesIrrelevants() |
Returns the indices of the irrelevant features indicesIrrelevants.
|
int[] |
getIndicesRelevants() |
Returns the indices of the relevant features indicesRelevants.
|
java.lang.String |
getRelationName() |
Gets the relation name.
|
protected int |
indexOf(Attribute att) |
Returns the index of an Attribute.
|
void |
insertAttributeAt(Attribute attribute,
int position) |
Insert attribute at.
|
Instance |
instance(int num) |
Instance.
|
double |
meanOrMode(int j) |
Mean or mode.
|
int |
numAttributes() |
Num attributes.
|
int |
numClasses() |
Num classes.
|
int |
numInstances() |
Num instances.
|
void |
randomize(java.util.Random random) |
Randomize.
|
boolean |
readInstance(java.io.Reader fileReader) |
Read instance.
|
void |
set(int i,
Instance inst) |
|
void |
setAttributes(Attribute[] v) |
|
void |
setAttributes(Attribute[] v,
int[] indexValues) |
|
void |
setAttributes(java.util.List<Attribute> v,
java.util.List<java.lang.Integer> indexValues) |
|
void |
setClassIndex(int classIndex) |
Sets the class index.
|
void |
setIndicesRelevants(int[] indicesRelevants) |
Sets the indices of relevant features.
|
void |
setRangeOutputIndices(Range range) |
|
void |
setRelationName(java.lang.String string) |
Sets the relation name.
|
int |
size() |
|
void |
stratify(int numFolds) |
Stratify.
|
protected void |
stratStep(int numFolds) |
|
protected java.lang.String |
stringWithoutHeader() |
Returns the instances in the dataset as a string in ARFF format.
|
void |
swap(int i,
int j) |
Swap.
|
Instances |
testCV(int numFolds,
int numFold) |
Test cv.
|
java.lang.String |
toString() |
Returns the dataset as a string in ARFF format.
|
Instances |
trainCV(int numFolds,
int numFold) |
|
Instances |
trainCV(int numFolds,
int numFold,
java.util.Random random) |
Train cv.
|
public static final java.lang.String ARFF_RELATION
public static final java.lang.String ARFF_DATA
protected InstanceInformation instanceInformation
protected java.util.List<Instance> instances
protected ArffLoader arff
protected java.util.HashMap<java.lang.String,java.lang.Integer> hsAttributesIndices
protected int[] indicesRelevants
protected int[] indicesIrrelevants
public Instances(Instances chunk)
chunk
- the chunkpublic Instances()
public Instances(java.io.Reader reader, int size, int classAttribute)
reader
- the readersize
- the sizeclassAttribute
- the class attributepublic Instances(java.io.Reader reader, Range range)
reader
- the readerrange
- public Instances(Instances chunk, int capacity)
chunk
- the chunkcapacity
- the capacitypublic Instances(java.lang.String st, Attribute[] v, int capacity)
st
- the stv
- the vcapacity
- the capacitypublic Instances(java.lang.String st, java.util.List<Attribute> v, int capacity)
st
- the stv
- the vcapacity
- the capacitypublic Instances(Instances chunk, int first, int toCopy)
chunk
- the chunkfirst
- the first instancetoCopy
- the jpublic Instances(java.io.StringReader st, int capacity)
st
- the stcapacity
- the capacitypublic void setRelationName(java.lang.String string)
string
- the new relation namepublic java.lang.String getRelationName()
public int classIndex()
public void setClassIndex(int classIndex)
classIndex
- the new class indexpublic Attribute classAttribute()
public int numAttributes()
public Attribute attribute(int w)
w
- the wpublic int numClasses()
public void deleteAttributeAt(java.lang.Integer integer)
integer
- the integerpublic void insertAttributeAt(Attribute attribute, int position)
attribute
- the attributeposition
- the positionpublic Instance instance(int num)
num
- the numpublic int numInstances()
public void add(Instance inst)
inst
- the instpublic void randomize(java.util.Random random)
random
- the randompublic void stratify(int numFolds)
numFolds
- the num foldsprotected void stratStep(int numFolds)
public Instances trainCV(int numFolds, int numFold, java.util.Random random)
numFolds
- the num foldsnumFold
- random
- the randompublic Instances trainCV(int numFolds, int numFold)
protected void copyInstances(int from, Instances dest, int num)
public Instances testCV(int numFolds, int numFold)
numFolds
- the num foldsnumFold
- the num foldpublic double meanOrMode(int j)
j
- the jpublic boolean readInstance(java.io.Reader fileReader)
fileReader
- the file readerpublic void delete()
public void delete(int index)
public void swap(int i, int j)
i
- the ij
- the jpublic Attribute attribute(java.lang.String name)
public int size()
public void set(int i, Instance inst)
public Instance get(int k)
public void setRangeOutputIndices(Range range)
public void setAttributes(Attribute[] v)
public void setAttributes(Attribute[] v, int[] indexValues)
public void setAttributes(java.util.List<Attribute> v, java.util.List<java.lang.Integer> indexValues)
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String stringWithoutHeader()
protected int indexOf(Attribute att)
att
- , the attribute.public int[] getIndicesRelevants()
public int[] getIndicesIrrelevants()
public void setIndicesRelevants(int[] indicesRelevants)
indicesRelevants
- Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.