public class DataCache extends Object
Modifier and Type | Field and Description |
---|---|
protected int[] |
attNumVals
Attribute description - holds a 0 for numeric attributes, and the number
of available categories for nominal attributes.
|
protected int |
classIndex
Numeric index of the class attribute.
|
protected boolean[] |
inBag
Is instance in 'bag' created by bootstrap sampling.
|
protected int[] |
instClassValues
The class an instance belongs to.
|
protected double[] |
instWeights
Weights of instances.
|
protected int |
numAttributes
Number of attributes, including the class attribute.
|
protected int |
numClasses
Number of classes.
|
protected int |
numInBag
How many instances are in 'bag' created by bootstrap sampling.
|
protected int |
numInstances
Number of instances.
|
protected Random |
reusableRandomGenerator
Used in training of FastRandomTrees.
|
protected int[][] |
sortedIndices
Ordering of instances, indexed by attribute, then by instance.
|
protected float[][] |
vals
The dataset, first indexed by attribute, then by instance.
|
protected int[] |
whatGoesWhere
Used in training of FastRandomTrees.
|
Constructor and Description |
---|
DataCache(DataCache origData)
Makes a copy of a DataCache.
|
DataCache(Instances origData)
Creates a DataCache by copying data from a weka.core.Instances object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createInBagSortedIndices()
Invoked only when tree is trained.
|
Random |
getRandomNumberGenerator(long seed)
Returns a random number generator.
|
boolean |
isAttrNominal(int attIndex)
Is an attribute with the given index nominal?
|
boolean |
isValueMissing(int attIndex,
int instIndex)
Does the given attribute - instance combination contain a missing value?
|
DataCache |
resample(int bagSize,
Random random)
Uses sampling with replacement to create a new DataCache from an existing
one.
|
float[] |
scrambleOneAttribute(int attIndex,
Random random)
Randomizes one attribute in the vals[][]; returns a copy of the vals[]
before randomization.
|
protected final float[][] vals
protected final int[] attNumVals
protected final int classIndex
protected final int numAttributes
protected final int numClasses
protected final int numInstances
protected final int[] instClassValues
protected int[][] sortedIndices
protected double[] instWeights
protected boolean[] inBag
protected int numInBag
protected int[] whatGoesWhere
protected Random reusableRandomGenerator
public DataCache(Instances origData) throws Exception
Exception
public DataCache(DataCache origData)
origData
- public float[] scrambleOneAttribute(int attIndex, Random random)
public DataCache resample(int bagSize, Random random)
bagSize
- If this is equal to the DataCache.numInstances, makes a
a bootstrap sample (n of of inrandom
- A random number generator.protected void createInBagSortedIndices()
public final boolean isValueMissing(int attIndex, int instIndex)
public final boolean isAttrNominal(int attIndex)
public Random getRandomNumberGenerator(long seed)
seed
- the given seedCopyright © 2015–2021 Fiji. All rights reserved.