Java weka.core Instances fields, constructors, methods, implement or subclass

Example usage for Java weka.core Instances fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for weka.core Instances.

The text is from its open source code.

Subclass

weka.core.Instances has subclasses.
Click this link to see all its subclasses.

Field

StringSERIALIZED_OBJ_FILE_EXTENSION
The filename extension that should be used for bin.
StringARFF_RELATION
The keyword used to denote the start of an arff header
StringARFF_DATA
The keyword used to denote the start of the arff data section

Constructor

Instances(Instances source, int first, int toCopy)
Creates a new set of instances by copying a subset of another set.
Instances(String name, ArrayList attInfo, int capacity)
Creates an empty set of instances.
Instances(Reader reader)
Reads an ARFF file from a reader, and assigns a weight of one to each instance.
Instances(Instances dataset)
Constructor copying all instances and references to the header information from the given set of instances.
Instances(Reader reader, int capacity)
Reads the header of an ARFF file from a reader and reserves space for the given number of instances.
Instances(Instances dataset, int capacity)
Constructor creating an empty set of instances.

Method

booleanadd(Instance instance)
Adds one instance to the end of the set.
voidadd(int index, Instance instance)
Adds one instance at the given position in the list.
Attributeattribute(int index)
Returns an attribute.
Attributeattribute(String name)
Returns an attribute given its name.
AttributeStatsattributeStats(int index)
Calculates summary statistics on the values that appear in this set of instances for a specified attribute.
double[]attributeToDoubleArray(int index)
Gets the value of all instances in this dataset for a particular attribute.
booleancheckForAttributeType(int attType)
Checks for attributes of the given type in the dataset
booleancheckForStringAttributes()
Checks for string attributes in the dataset
booleancheckInstance(Instance instance)
Checks if the given instance is compatible with this dataset.
AttributeclassAttribute()
Returns the class attribute.
intclassIndex()
Returns the class attribute's index.
voidcompactify()
Compactifies the set of instances.
voiddelete(int index)
Removes an instance at the given position from the set.
voiddelete()
Removes all instances from the set.
voiddeleteAttributeAt(int position)
Deletes an attribute at the given position (0 to numAttributes() - 1).
voiddeleteAttributeType(int attType)
Deletes all attributes of the given type in the dataset.
voiddeleteStringAttributes()
Deletes all string attributes in the dataset.
voiddeleteWithMissing(int attIndex)
Removes all instances with missing values for a particular attribute from the dataset.
voiddeleteWithMissing(Attribute att)
Removes all instances with missing values for a particular attribute from the dataset.
voiddeleteWithMissingClass()
Removes all instances with a missing class value from the dataset.
EnumerationenumerateAttributes()
Returns an enumeration of all the attributes.
EnumerationenumerateInstances()
Returns an enumeration of all instances in the dataset.
booleanequalHeaders(Instances dataset)
Checks if two headers are equivalent.
StringequalHeadersMsg(Instances dataset)
Checks if two headers are equivalent.
InstancefirstInstance()
Returns the first instance in the set.
Instanceget(int index)
Returns the instance at the given position.
RandomgetRandomNumberGenerator(long seed)
Returns a random number generator.
voidinsertAttributeAt(Attribute att, int position)
Inserts an attribute at the given position (0 to numAttributes()) and sets all values to be missing.
Instanceinstance(int index)
Returns the instance at the given position.
doublekthSmallestValue(Attribute att, int k)
Returns the kth-smallest attribute value of a numeric attribute.
doublekthSmallestValue(int attIndex, int k)
Returns the kth-smallest attribute value of a numeric attribute.
InstancelastInstance()
Returns the last instance in the set.
doublemeanOrMode(int attIndex)
Returns the mean (mode) for a numeric (nominal) attribute as a floating-point value.
doublemeanOrMode(Attribute att)
Returns the mean (mode) for a numeric (nominal) attribute as a floating-point value.
InstancesmergeInstances(Instances first, Instances second)
Merges two sets of Instances together.
intnumAttributes()
Returns the number of attributes.
intnumClasses()
Returns the number of class labels.
intnumDistinctValues(int attIndex)
Returns the number of distinct values of a given attribute.
intnumDistinctValues(Attribute att)
Returns the number of distinct values of a given attribute.
intnumInstances()
Returns the number of instances in the dataset.
voidrandomize(Random random)
Shuffles the instances in the set so that they are ordered randomly.
booleanreadInstance(Reader reader)
Reads a single instance from the reader and appends it to the dataset.
StringrelationName()
Returns the relation's name.
Instanceremove(int index)
Removes the instance at the given position.
voidrenameAttribute(int att, String name)
Renames an attribute.
voidrenameAttribute(Attribute att, String name)
Renames an attribute.
voidrenameAttributeValue(int att, int val, String name)
Renames the value of a nominal (or string) attribute value.
voidrenameAttributeValue(Attribute att, String val, String name)
Renames the value of a nominal (or string) attribute value.
Instancesresample(Random random)
Creates a new dataset of the same size as this dataset using random sampling with replacement.
InstancesresampleWithWeights(Random random, boolean[] sampled, boolean representUsingWeights)
Creates a new dataset of the same size as this dataset using random sampling with replacement according to the current instance weights.
InstancesresampleWithWeights(Random random, double[] weights, boolean[] sampled)
Creates a new dataset of the same size as this dataset using random sampling with replacement according to the given weight vector.
InstancesresampleWithWeights(Random random, boolean[] sampled)
Creates a new dataset of the same size as this dataset using random sampling with replacement according to the current instance weights.
InstancesresampleWithWeights(Random random, boolean representUsingWeights)
Creates a new dataset of the same size as this dataset using random sampling with replacement according to the current instance weights.
InstancesresampleWithWeights(Random random, double[] weights)
Creates a new dataset of the same size as this dataset using random sampling with replacement according to the given weight vector.
InstancesresampleWithWeights(Random random)
Creates a new dataset of the same size as this dataset using random sampling with replacement according to the current instance weights.
Instanceset(int index, Instance instance)
Replaces the instance at the given position.
voidsetClass(Attribute att)
Sets the class attribute.
voidsetClassIndex(int classIndex)
Sets the class index of the set.
voidsetRelationName(String newName)
Sets the relation's name.
intsize()
Returns the number of instances in the dataset.
voidsort(int attIndex)
Sorts the instances based on an attribute.
voidsort(Attribute att)
Sorts the instances based on an attribute.
voidstratify(int numFolds)
Stratifies a set of instances according to its class values if the class attribute is nominal (so that afterwards a stratified cross-validation can be performed).
InstancesstringFreeStructure()
Create a copy of the structure.
doublesumOfWeights()
Computes the sum of all the instances' weights.
voidswap(int i, int j)
Swaps two instances in the set.
InstancestestCV(int numFolds, int numFold)
Creates the test set for one fold of a cross-validation on the dataset.
StringtoString()
Returns the dataset as a string in ARFF format.
StringtoSummaryString()
Generates a string summarizing the set of instances.
InstancestrainCV(int numFolds, int numFold)
Creates the training set for one fold of a cross-validation on the dataset.
InstancestrainCV(int numFolds, int numFold, Random random)
Creates the training set for one fold of a cross-validation on the dataset.
doublevariance(int attIndex)
Computes the variance for a numeric attribute.
doublevariance(Attribute att)
Computes the variance for a numeric attribute.
double[]variances()
Computes the variance for all numeric attributes simultaneously.