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:
|
|
None
|
inc(self,
sample,
count=1)
Increment this FreqDist 's count for the given sample. |
source code
|
|
int
|
N(self)
Returns:
The total number of sample outcomes that have been recorded by this
FreqDist . |
source code
|
|
int
|
B(self)
Returns:
The total number of sample values (or bins) that have counts greater than zero. |
source code
|
|
list
|
samples(self)
Returns:
A list of all samples that have been recorded as outcomes by this
frequency distribution. |
source code
|
|
int
|
Nr(self,
r,
bins=None)
Returns:
The number of samples with count r. |
source code
|
|
|
|
int
|
|
float
|
|
any or None
|
max(self)
Return the sample with the greatest number of outcomes in this
frequency distribution. |
source code
|
|
sequence of any
|
|
string
|
|
string
|
|
boolean
|
__contains__(self,
sample)
Returns:
True if the given sample occurs one or more times in this frequency
distribution. |
source code
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|