A frequency distribution for the outcomes of an experiment. A
frequency distribution records the number of times each outcome of an
experiment has occured. For example, a frequency distribution could be
used to record the frequency of each word type in a document. Formally, a
frequency distribution can be defined as a function mapping from each
sample to the number of times that sample occured as an outcome.
Frequency distributions are generally constructed by running a number
of experiments, and incrementing the count for a sample every time it is
an outcome of an experiment. For example, the following code will produce
a frequency distribution that encodes how often each word occurs in a
text:
| Method Summary |
| |
__init__(self)
Construct a new empty, FreqDist. |
boolean
|
__contains__(self,
sample)
Return true if the given sample occurs one or more times in this frequency
distribution. |
| string
|
__repr__(self)
Return a string representation of this FreqDist. |
| string
|
__str__(self)
Return a string representation of this FreqDist. |
int
|
B(self)
Return the total number of sample values (or bins) that have counts greater than zero. |
int
|
count(self,
sample)
Return the count of a given sample. |
| float
|
freq(self,
sample)
Return the frequency of a given sample. |
| None
|
inc(self,
sample,
count)
Increment this FreqDist's count for the given sample. |
any or None
|
max(self)
Return the sample with the greatest number of outcomes in this
frequency distribution. |
int
|
N(self)
Return the total number of sample outcomes that have been recorded by this
FreqDist. |
int
|
Nr(self,
r,
bins)
Return the number of samples with count r. |
list
|
samples(self)
Return a list of all samples that have been recorded as outcomes by this
frequency distribution. |
| sequence of any
|
sorted_samples(self)
Return the samples sorted in decreasing order of frequency. |
Inherited from object:
__delattr__,
__getattribute__,
__hash__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__
|