|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.random.EmpiricalDistributionImpl
Implements EmpiricalDistribution
interface. This implementation
uses what amounts to the
Variable Kernel Method with Gaussian smoothing:
Digesting the input file
binCount
"bins."USAGE NOTES:
binCount
is set by default to 1000. A good rule of thumb
is to set the bin count to approximately the length of the input file divided
by 10. See TODO: add reference
Constructor Summary | |
EmpiricalDistributionImpl()
Creates a new EmpiricalDistribution with the default bin count |
|
EmpiricalDistributionImpl(int binCount)
Creates a new EmpiricalDistribution with the specified bin count |
Method Summary | |
int |
getBinCount()
Returns the number of bins |
ArrayList |
getBinStats()
Returns a list of Univariates containing statistics describing the values in each of the bins. |
double |
getNextValue()
Generates a random value from this distribution |
DescriptiveStatistics |
getSampleStats()
Returns a DescriptiveStatistics describing this distribution. |
double[] |
getUpperBounds()
Returns the array of upper bounds for the bins. |
boolean |
isLoaded()
property indicating whether or not the distribution has been loaded |
void |
load(File file)
Computes the empirical distribution from the input file. |
void |
load(String filePath)
Computes the empirical distribution from the input file. |
void |
load(URL url)
Computes the empirical distribution using data read from a URL. |
void |
loadDistribution(File file)
Loads a saved distribution from a file. |
void |
loadDistribution(String filePath)
Loads a saved distribution from a file. |
void |
saveDistribution(File file)
Saves distribution to a file. |
void |
saveDistribution(String filePath)
Saves distribution to a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EmpiricalDistributionImpl()
public EmpiricalDistributionImpl(int binCount)
binCount
- number of binsMethod Detail |
public void load(String filePath) throws IOException
EmpiricalDistribution
load
in interface EmpiricalDistribution
filePath
- fully qualified name of a file in the local file system
IOException
- if an IO error occurspublic void load(URL url) throws IOException
EmpiricalDistribution
load
in interface EmpiricalDistribution
IOException
- if an IO error occurspublic void load(File file) throws IOException
EmpiricalDistribution
load
in interface EmpiricalDistribution
file
- the input file
IOException
- if an IO error occurspublic double getNextValue() throws IllegalStateException
getNextValue
in interface EmpiricalDistribution
IllegalStateException
- if the distribution has not been loadedpublic void loadDistribution(String filePath) throws IOException
EmpiricalDistribution
loadDistribution
in interface EmpiricalDistribution
filePath
- fully qualified file path for a file
containing a digested distribution
IOException
- if an error occurs reading the filepublic void loadDistribution(File file) throws IOException
EmpiricalDistribution
loadDistribution
in interface EmpiricalDistribution
file
- File reference for a file containing a digested distribution
IOException
- if an error occurs reading the filepublic void saveDistribution(String filePath) throws IOException, IllegalStateException
EmpiricalDistribution
saveDistribution
in interface EmpiricalDistribution
filePath
- fully qualified file path for the file to be written
IOException
- if an error occurs reading the file
IllegalStateException
- if the distribution has not been loadedpublic void saveDistribution(File file) throws IOException, IllegalStateException
EmpiricalDistribution
saveDistribution
in interface EmpiricalDistribution
file
- File reference for the file to be written
IOException
- if an error occurs reading the file
IllegalStateException
- if the distribution has not been loadedpublic DescriptiveStatistics getSampleStats()
EmpiricalDistribution
getSampleStats
in interface EmpiricalDistribution
public int getBinCount()
EmpiricalDistribution
getBinCount
in interface EmpiricalDistribution
public ArrayList getBinStats()
EmpiricalDistribution
getBinStats
in interface EmpiricalDistribution
public double[] getUpperBounds()
EmpiricalDistribution
getUpperBounds
in interface EmpiricalDistribution
public boolean isLoaded()
EmpiricalDistribution
isLoaded
in interface EmpiricalDistribution
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |