Skip to content

Commit

Permalink
doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
weikang9009 committed Jun 29, 2024
1 parent 1199355 commit 2eadad4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions giddy/markov.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ def chi2(T1, T2):
[ 1., 92., 815., 51.],
[ 1., 0., 60., 903.]])
>>> chi2(T1,T2)
(np.float64(23.39728441473295), np.float64(0.005363116704861337), np.int64(9))
(23.39728441473295, 0.005363116704861337, 9)
Notes
-----
Expand Down Expand Up @@ -1468,7 +1468,7 @@ def spillover(self, quadrant=1, neighbors_on=False):
>>> lm_random = LISA_Markov(pci, w, permutations=99)
>>> r = lm_random.spillover()
>>> (r['components'][:, 12] > 0).sum()
np.int64(17)
17
>>> (r['components'][:, 13]>0).sum()
23
>>> (r['spill_over'][:,12]>0).sum()
Expand Down Expand Up @@ -2081,7 +2081,7 @@ def sojourn_time(p, summary=True):
>>> p = np.array([[.5, .25, .25], [.5, 0, .5],[ 0, 0, 0]])
>>> sojourn_time(p)
Sojourn times are infinite for absorbing states! In this Markov Chain, states [np.int64(2)] are absorbing states.
Sojourn times are infinite for absorbing states! In this Markov Chain, states [2] are absorbing states.
array([ 2., 1., inf])
""" # noqa E501

Expand Down
4 changes: 2 additions & 2 deletions giddy/rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ class Tau_Local:
0.48387097, 0.93548387, 0.61290323, 0.74193548, 0.41935484,
0.61290323, 0.61290323])
>>> tau_local.tau
np.float64(0.6612903225806451)
0.6612903225806451
>>> tau_classic = Tau(r[:,0],r[:,1])
>>> tau_classic.tau
0.6612903225806451
Expand Down Expand Up @@ -586,7 +586,7 @@ class Tau_Local_Neighbor:
array([-1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1])
>>> (res.tau_ln * res.tau_ln_weights).sum() #global spatial tau
np.float64(0.39682539682539675)
0.39682539682539675
>>> res1 = SpatialTau(r[:,0],r[:,1],w,permutations=999)
>>> res1.tau_spatial
0.3968253968253968
Expand Down

0 comments on commit 2eadad4

Please sign in to comment.