Skip to content

Commit

Permalink
📝 docstring update
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRossetti committed May 14, 2024
1 parent 1d9a52a commit 98480e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
20 changes: 10 additions & 10 deletions cdlib/evaluation/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def partition_closeness_simple(
"""Community size density closeness.
Simple implementation that does not leverage kernel density estimator.
$$ S_G(A,B) = \frac{1}{2} \Sum_{i=1}^{r}\Sum_{j=1}^{s} min(\frac{n^a(x^a_i)}{N^a}, \frac{n^b_j(x^b_j)}{N^b}) \delta(x_i^a,x_j^b) $$
$$ S_G(A,B) = \\frac{1}{2} \Sum_{i=1}^{r}\Sum_{j=1}^{s} min(\\frac{n^a(x^a_i)}{N^a}, \\frac{n^b_j(x^b_j)}{N^b}) \delta(x_i^a,x_j^b) $$
where:
Expand Down Expand Up @@ -613,7 +613,7 @@ def jaccard_index(
"""
This function calculates the Jaccard index between two clusterings.
.. math:: J = \frac{N11}{(N11+N10+N01)}
.. math:: J = \\frac{N11}{(N11+N10+N01)}
:param first_partition: NodeClustering object
:param second_partition: NodeClustering object
Expand Down Expand Up @@ -653,7 +653,7 @@ def rand_index(
"""
This function calculates the Rand index between two clusterings.
.. math:: RI = \frac{(N11 + N00)}{(N11 + N10 + N01 + N00)}
.. math:: RI = \\frac{(N11 + N00)}{(N11 + N10 + N01 + N00)}
:param first_partition: NodeClustering object
Expand Down Expand Up @@ -694,7 +694,7 @@ def fowlkes_mallows_index(
"""
This function calculates the Fowlkes and Mallows index between two clusterings
.. math:: FM = \frac{N11}{ \sqrt{ (N11 + N10) * (N11 + N01) }}
.. math:: FM = \\frac{N11}{ \sqrt{ (N11 + N10) * (N11 + N01) }}
:param first_partition: NodeClustering object
:param second_partition: NodeClustering object
Expand Down Expand Up @@ -774,7 +774,7 @@ def czekanowski_index(
Dice Symmetric index
Sorensen index
.. math:: F = \frac{2*N11}{(2*N11 + N10 + N01)}
.. math:: F = \\frac{2*N11}{(2*N11 + N10 + N01)}
:param first_partition: NodeClustering object
:param second_partition: NodeClustering object
Expand Down Expand Up @@ -813,7 +813,7 @@ def dice_index(
Czekanowski index
Sorensen index
.. math:: F = \frac{2*N11}{(2*N11 + N10 + N01)}
.. math:: F = \\frac{2*N11}{(2*N11 + N10 + N01)}
:param first_partition: NodeClustering object
Expand Down Expand Up @@ -846,7 +846,7 @@ def sorensen_index(
Czekanowski index
Dice index
.. math:: F = \frac{2*N11}{(2*N11 + N10 + N01)}
.. math:: F = \\frac{2*N11}{(2*N11 + N10 + N01)}
:param first_partition: NodeClustering object
:param second_partition: NodeClustering object
Expand Down Expand Up @@ -875,7 +875,7 @@ def rogers_tanimoto_index(
"""
This function calculates the Rogers and Tanimoto index between two clusterings.
.. math:: RT = \frac{(N11 + N00)}{(N11 + 2*(N10+N01) + N00)}
.. math:: RT = \\frac{(N11 + N00)}{(N11 + 2*(N10+N01) + N00)}
:param first_partition: NodeClustering object
Expand Down Expand Up @@ -911,7 +911,7 @@ def southwood_index(
"""
This function calculates the Southwood index between two clusterings.
.. math:: \frac{N11}{(N10 + N01)}
.. math:: \\frac{N11}{(N10 + N01)}
:param first_partition: NodeClustering object
:param second_partition: NodeClustering object
Expand Down Expand Up @@ -990,7 +990,7 @@ def rmi(
"""
This function calculates the Reduced Mutual Information (RMI) between two clusterings.
.. math:: RMI = MI(c1, c2) - \log \frac{Omega(a, b)}{n}
.. math:: RMI = MI(c1, c2) - \\log \\frac{Omega(a, b)}{n}
where MI(c1, c2) is mutual information of the clusterings c1 and c2, and Omega(a, b) is the number of contingency tables with row and column sums equal to a and b.
Expand Down
10 changes: 2 additions & 8 deletions cdlib/evaluation/fitness.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,17 +368,11 @@ def average_internal_degree(
) -> object:
"""The average internal degree of the community set.
.. math:: f(S) = \\frac{2m_S}{n_S}
.. math:: f(S) = \\frac{2m_S}{n_S}
where
:math:`m_S`
is the number of community internal edges and
:math:`n_S`
is the number of community nodes.
where :math:`m_S` is the number of community internal edges and :math:`n_S` is the number of community nodes.
:param graph: a networkx/igraph object
:param community: NodeClustering object
Expand Down

0 comments on commit 98480e2

Please sign in to comment.