Skip to content

Commit

Permalink
Fix typos in docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
wmayner committed Jul 19, 2017
1 parent 4490be4 commit d43104e
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions pyemd/emd.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,20 @@ def emd(np.ndarray[np.float64_t, ndim=1, mode="c"] first_histogram,
np.ndarray[np.float64_t, ndim=1, mode="c"] second_histogram,
np.ndarray[np.float64_t, ndim=2, mode="c"] distance_matrix,
extra_mass_penalty=DEFAULT_EXTRA_MASS_PENALTY):
u"""
Return the EMD between two histograms using the given distance matrix.
u"""Return the EMD between two histograms using the given distance matrix.
The Earth Mover's Distance is the minimal cost of turning one histogram
into another by moving around the “dirt” in the bins, where the cost of
moving one dirt from one bin to another is given by the amount of dirt
times the “ground distance” between the bins.
moving dirt from one bin to another is given by the amount of dirt times
the “ground distance” between the bins.
Arguments:
first_histogram (np.ndarray): A 1-dimensional array of type np.float64,
of length N.
second_histogram (np.ndarray): A 1-dimensional array of np.float64,
also of length N.
distance_matrix (np.ndarray): A 2-dimensional array of np.float64, of
size at least N × N. This defines the underlyin metric, or ground
size at least N × N. This defines the underlying metric, or ground
distance, by giving the pairwise distances between the histogram
bins. It must represent a metric; there is no warning if it
doesn't.
Expand Down Expand Up @@ -97,24 +96,23 @@ def emd_with_flow(np.ndarray[np.float64_t, ndim=1, mode="c"] first_histogram,
np.ndarray[np.float64_t, ndim=1, mode="c"] second_histogram,
np.ndarray[np.float64_t, ndim=2, mode="c"] distance_matrix,
extra_mass_penalty=DEFAULT_EXTRA_MASS_PENALTY):
u"""
Compute the EMD between histograms with the given distance matrix.
u"""Return the EMD between two histograms using the given distance matrix.
The Earth Mover's Distance is the minimal cost of turning one histogram
into another by moving around the “dirt” in the bins, where the cost of
moving one dirt from one bin to another is given by the amount of dirt
times the “ground distance” between the bins.
moving dirt from one bin to another is given by the amount of dirt times
the “ground distance” between the bins.
Arguments:
first_histogram (np.ndarray): A 1-dimensional array of type np.float64,
of length N.
second_histogram (np.ndarray): A 1-dimensional array of np.float64,
also of length N.
distance_matrix (np.ndarray): A 2-dimensional array of type np.float64,
of size at least N × N. This defines the underlying metric, or
ground distance, by giving the pairwise distances between the
histogram bins. It must represent a metric; there is no warning if
it doesn't.
distance_matrix (np.ndarray): A 2-dimensional array of np.float64, of
size at least N × N. This defines the underlying metric, or ground
distance, by giving the pairwise distances between the histogram
bins. It must represent a metric; there is no warning if it
doesn't.
Keyword Arguments:
extra_mass_penalty: The penalty for extra mass. If you want the
Expand All @@ -131,8 +129,8 @@ def emd_with_flow(np.ndarray[np.float64_t, ndim=1, mode="c"] first_histogram,
Raises:
ValueError: If the length of either histogram is greater than the
number of rows or the number of columns of the distance matrix, or if
the histograms aren't the same length.
number of rows or columns of the distance matrix, or if the histograms
aren't the same length.
"""
validate(first_histogram, second_histogram, distance_matrix)
return emd_hat_gd_metric_double_with_flow_wrapper(first_histogram,
Expand Down

0 comments on commit d43104e

Please sign in to comment.