|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object weka.gui.boundaryvisualizer.KDDataGenerator
KDDataGenerator. Class that uses kernels to generate new random instances based on a supplied set of instances.
DataGenerator
,
Serializable
,
Serialized FormField Summary | |
private double[] |
m_globalMeansOrModes
|
private Instances |
m_instances
|
private int |
m_kernelBandwidth
|
private double[][] |
m_kernelParams
|
private double |
m_laplaceConst
|
protected double[] |
m_Max
The maximum values for numeric attributes. |
protected double[] |
m_Min
The minimum values for numeric attributes. |
private double |
m_minStdDev
|
private static double |
m_normConst
|
private java.util.Random |
m_random
|
private int |
m_seed
|
private double[] |
m_standardDeviations
|
private boolean[] |
m_weightingDimensions
|
private double[] |
m_weightingValues
|
Constructor Summary | |
KDDataGenerator()
|
Method Summary | |
void |
buildGenerator(Instances inputInstances)
Initialize the generator using the supplied instances |
private double[] |
computeCumulativeDistribution(double[] dist)
Return a cumulative distribution from a discrete distribution |
private void |
computeParams()
|
private double |
distance(Instance first,
Instance second)
Calculates the distance between two instances |
double[][] |
generateInstances(int[] indices)
Generates a new instance using one kernel estimator. |
int |
getKernelBandwidth()
Get the kernel bandwidth |
int |
getNumGeneratingModels()
Return the number of kernels (there is one per training instance) |
double[] |
getWeights()
Get weights |
private double |
norm(double x,
int i)
Normalizes a given value of a numeric attribute. |
private double |
normalDens(double x,
double mean,
double stdDev)
Density function of normal distribution. |
void |
setKernelBandwidth(int kb)
Set the kernel bandwidth (number of nearest neighbours to cover) |
void |
setSeed(int seed)
Initializes a new random number generator using the supplied seed. |
void |
setWeightingDimensions(boolean[] dims)
Set which dimensions to use when computing a weight for the next instance to generate |
void |
setWeightingValues(double[] vals)
Set the values for the weighting dimensions to be used when computing the weight for the next instance to be generated |
private void |
updateMinMax(Instance instance)
Updates the minimum and maximum values for all the attributes based on a new instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private Instances m_instances
private double[] m_standardDeviations
private double[] m_globalMeansOrModes
private double m_minStdDev
private double m_laplaceConst
private int m_seed
private java.util.Random m_random
private boolean[] m_weightingDimensions
private double[] m_weightingValues
private static double m_normConst
private int m_kernelBandwidth
private double[][] m_kernelParams
protected double[] m_Min
protected double[] m_Max
Constructor Detail |
public KDDataGenerator()
Method Detail |
public void buildGenerator(Instances inputInstances) throws java.lang.Exception
buildGenerator
in interface DataGenerator
inputInstances
- the instances to use as the basis of the kernels
java.lang.Exception
- if an error occurspublic double[] getWeights()
DataGenerator
getWeights
in interface DataGenerator
private double[] computeCumulativeDistribution(double[] dist)
dist
- the distribution to use
public double[][] generateInstances(int[] indices) throws java.lang.Exception
generateInstances
in interface DataGenerator
java.lang.Exception
- if an error occursprivate double normalDens(double x, double mean, double stdDev)
x
- input valuemean
- mean of distributionstdDev
- standard deviation of distributionpublic void setWeightingDimensions(boolean[] dims)
setWeightingDimensions
in interface DataGenerator
dims
- an array of booleans indicating which dimensions to usepublic void setWeightingValues(double[] vals)
setWeightingValues
in interface DataGenerator
vals
- an array of doubles containing the values of the
weighting dimensions (corresponding to the entries that are set to
true throw setWeightingDimensions)public int getNumGeneratingModels()
getNumGeneratingModels
in interface DataGenerator
public void setKernelBandwidth(int kb)
kb
- an int
valuepublic int getKernelBandwidth()
int
valuepublic void setSeed(int seed)
setSeed
in interface DataGenerator
seed
- an int
valueprivate double distance(Instance first, Instance second)
private double norm(double x, int i)
x
- the value to be normalizedi
- the attribute's indexprivate void updateMinMax(Instance instance)
instance
- the new instanceprivate void computeParams() throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |