Skip to content

Commit

Permalink
fix error: change assertAlmostEquals to assertAlmostEqual in test_gwr…
Browse files Browse the repository at this point in the history
….py and test_parallel.py
  • Loading branch information
xyluo25 committed Feb 13, 2024
1 parent 1bd62cf commit b3180fb
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 98 deletions.
106 changes: 53 additions & 53 deletions mgwr/tests/test_gwr.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def test_BS_F(self):
BIC = get_BIC(rslt)
CV = get_CV(rslt)

self.assertAlmostEquals(np.floor(AICc), 894.0)
self.assertAlmostEquals(np.floor(AIC), 890.0)
self.assertAlmostEquals(np.floor(BIC), 944.0)
self.assertAlmostEquals(np.round(CV, 2), 18.25)
self.assertAlmostEqual(np.floor(AICc), 894.0)
self.assertAlmostEqual(np.floor(AIC), 890.0)
self.assertAlmostEqual(np.floor(BIC), 944.0)
self.assertAlmostEqual(np.round(CV, 2), 18.25)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-04)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-04)
Expand Down Expand Up @@ -135,12 +135,12 @@ def test_BS_NN(self):
np.testing.assert_allclose(
adj_alpha, np.array([0.02034978, 0.01017489, 0.0002035]),
rtol=1e-04)
self.assertAlmostEquals(critical_t, 2.6011011542649394)
self.assertAlmostEquals(np.around(R2, 4), 0.5924)
self.assertAlmostEquals(np.floor(AICc), 896.0)
self.assertAlmostEquals(np.floor(AIC), 892.0)
self.assertAlmostEquals(np.floor(BIC), 941.0)
self.assertAlmostEquals(np.around(CV, 2), 19.19)
self.assertAlmostEqual(critical_t, 2.6011011542649394)
self.assertAlmostEqual(np.around(R2, 4), 0.5924)
self.assertAlmostEqual(np.floor(AICc), 896.0)
self.assertAlmostEqual(np.floor(AIC), 892.0)
self.assertAlmostEqual(np.floor(BIC), 941.0)
self.assertAlmostEqual(np.around(CV, 2), 19.19)
np.testing.assert_allclose(corr1, corr2, rtol=1e-04)
np.testing.assert_allclose(vif1, vif2, rtol=1e-04)
np.testing.assert_allclose(cn1, cn2, rtol=1e-04)
Expand Down Expand Up @@ -202,10 +202,10 @@ def test_GS_F(self):
BIC = get_BIC(rslt)
CV = get_CV(rslt)

self.assertAlmostEquals(np.floor(AICc), 895.0)
self.assertAlmostEquals(np.floor(AIC), 890.0)
self.assertAlmostEquals(np.floor(BIC), 943.0)
self.assertAlmostEquals(np.around(CV, 2), 18.21)
self.assertAlmostEqual(np.floor(AICc), 895.0)
self.assertAlmostEqual(np.floor(AIC), 890.0)
self.assertAlmostEqual(np.floor(BIC), 943.0)
self.assertAlmostEqual(np.around(CV, 2), 18.21)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-04)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-04)
Expand Down Expand Up @@ -254,10 +254,10 @@ def test_GS_NN(self):
BIC = get_BIC(rslt)
CV = get_CV(rslt)

self.assertAlmostEquals(np.floor(AICc), 896.0)
self.assertAlmostEquals(np.floor(AIC), 894.0)
self.assertAlmostEquals(np.floor(BIC), 922.0)
self.assertAlmostEquals(np.around(CV, 2), 17.91)
self.assertAlmostEqual(np.floor(AICc), 896.0)
self.assertAlmostEqual(np.floor(AIC), 894.0)
self.assertAlmostEqual(np.floor(BIC), 922.0)
self.assertAlmostEqual(np.around(CV, 2), 17.91)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-04)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-04)
Expand Down Expand Up @@ -473,11 +473,11 @@ def test_BS_NN_longlat(self):
CV = get_CV(rslt)
R2 = rslt.R2

self.assertAlmostEquals(np.around(R2, 4), 0.5921)
self.assertAlmostEquals(np.floor(AICc), 896.0)
self.assertAlmostEquals(np.floor(AIC), 892.0)
self.assertAlmostEquals(np.floor(BIC), 941.0)
self.assertAlmostEquals(np.around(CV, 2), 19.11)
self.assertAlmostEqual(np.around(R2, 4), 0.5921)
self.assertAlmostEqual(np.floor(AICc), 896.0)
self.assertAlmostEqual(np.floor(AIC), 892.0)
self.assertAlmostEqual(np.floor(BIC), 941.0)
self.assertAlmostEqual(np.around(CV, 2), 19.11)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-04)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-04)
Expand Down Expand Up @@ -557,9 +557,9 @@ def test_BS_F(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 13294.0)
self.assertAlmostEquals(np.floor(AIC), 13247.0)
self.assertAlmostEquals(np.floor(BIC), 13485.0)
self.assertAlmostEqual(np.floor(AICc), 13294.0)
self.assertAlmostEqual(np.floor(AIC), 13247.0)
self.assertAlmostEqual(np.floor(BIC), 13485.0)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-05)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-03)
Expand Down Expand Up @@ -607,10 +607,10 @@ def test_BS_NN(self):
BIC = get_BIC(rslt)
D2 = rslt.D2

self.assertAlmostEquals(np.floor(AICc), 13285)
self.assertAlmostEquals(np.floor(AIC), 13259.0)
self.assertAlmostEquals(np.floor(BIC), 13442.0)
self.assertAlmostEquals(np.round(D2, 3), 0.747)
self.assertAlmostEqual(np.floor(AICc), 13285)
self.assertAlmostEqual(np.floor(AIC), 13259.0)
self.assertAlmostEqual(np.floor(BIC), 13442.0)
self.assertAlmostEqual(np.round(D2, 3), 0.747)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-02)
Expand Down Expand Up @@ -659,10 +659,10 @@ def test_BS_NN_Offset(self):
BIC = get_BIC(rslt)
D2 = rslt.D2

self.assertAlmostEquals(np.floor(AICc), 367.0)
self.assertAlmostEquals(np.floor(AIC), 361.0)
self.assertAlmostEquals(np.floor(BIC), 451.0)
self.assertAlmostEquals(np.round(D2, 3), 0.676)
self.assertAlmostEqual(np.floor(AICc), 367.0)
self.assertAlmostEqual(np.floor(AIC), 361.0)
self.assertAlmostEqual(np.floor(BIC), 451.0)
self.assertAlmostEqual(np.round(D2, 3), 0.676)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-02,
atol=1e-02)
Expand Down Expand Up @@ -724,9 +724,9 @@ def test_GS_F(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 11283.0)
self.assertAlmostEquals(np.floor(AIC), 11211.0)
self.assertAlmostEquals(np.floor(BIC), 11497.0)
self.assertAlmostEqual(np.floor(AICc), 11283.0)
self.assertAlmostEqual(np.floor(AIC), 11211.0)
self.assertAlmostEqual(np.floor(BIC), 11497.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-03)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-02)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-02)
Expand Down Expand Up @@ -772,9 +772,9 @@ def test_GS_NN(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 21070.0)
self.assertAlmostEquals(np.floor(AIC), 21069.0)
self.assertAlmostEquals(np.floor(BIC), 21111.0)
self.assertAlmostEqual(np.floor(AICc), 21070.0)
self.assertAlmostEqual(np.floor(AIC), 21069.0)
self.assertAlmostEqual(np.floor(BIC), 21111.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-02)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-02)
Expand Down Expand Up @@ -859,9 +859,9 @@ def test_BS_F(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 275.0)
self.assertAlmostEquals(np.floor(AIC), 271.0)
self.assertAlmostEquals(np.floor(BIC), 349.0)
self.assertAlmostEqual(np.floor(AICc), 275.0)
self.assertAlmostEqual(np.floor(AIC), 271.0)
self.assertAlmostEqual(np.floor(BIC), 349.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-00)
Expand Down Expand Up @@ -923,10 +923,10 @@ def test_BS_NN(self):
BIC = get_BIC(rslt)
D2 = rslt.D2

self.assertAlmostEquals(np.floor(AICc), 277.0)
self.assertAlmostEquals(np.floor(AIC), 271.0)
self.assertAlmostEquals(np.floor(BIC), 358.0)
self.assertAlmostEquals(np.round(D2, 3), 0.319)
self.assertAlmostEqual(np.floor(AICc), 277.0)
self.assertAlmostEqual(np.floor(AIC), 271.0)
self.assertAlmostEqual(np.floor(BIC), 358.0)
self.assertAlmostEqual(np.round(D2, 3), 0.319)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
Expand Down Expand Up @@ -989,9 +989,9 @@ def test_GS_F(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 276.0)
self.assertAlmostEquals(np.floor(AIC), 272.0)
self.assertAlmostEquals(np.floor(BIC), 341.0)
self.assertAlmostEqual(np.floor(AICc), 276.0)
self.assertAlmostEqual(np.floor(AIC), 272.0)
self.assertAlmostEqual(np.floor(BIC), 341.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-00)
Expand Down Expand Up @@ -1052,9 +1052,9 @@ def test_GS_NN(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 276.0)
self.assertAlmostEquals(np.floor(AIC), 273.0)
self.assertAlmostEquals(np.floor(BIC), 331.0)
self.assertAlmostEqual(np.floor(AICc), 276.0)
self.assertAlmostEqual(np.floor(AIC), 273.0)
self.assertAlmostEqual(np.floor(BIC), 331.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-00)
Expand Down
90 changes: 45 additions & 45 deletions mgwr/tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def test_BS_NN_Parallel(self):
np.testing.assert_allclose(
adj_alpha, np.array([0.02034978, 0.01017489, 0.0002035]),
rtol=1e-04)
self.assertAlmostEquals(critical_t, 2.6011011542649394)
self.assertAlmostEquals(np.around(R2, 4), 0.5924)
self.assertAlmostEquals(np.floor(AICc), 896.0)
self.assertAlmostEquals(np.floor(AIC), 892.0)
self.assertAlmostEquals(np.floor(BIC), 941.0)
self.assertAlmostEquals(np.around(CV, 2), 19.19)
self.assertAlmostEqual(critical_t, 2.6011011542649394)
self.assertAlmostEqual(np.around(R2, 4), 0.5924)
self.assertAlmostEqual(np.floor(AICc), 896.0)
self.assertAlmostEqual(np.floor(AIC), 892.0)
self.assertAlmostEqual(np.floor(BIC), 941.0)
self.assertAlmostEqual(np.around(CV, 2), 19.19)
np.testing.assert_allclose(corr1, corr2, rtol=1e-04)
np.testing.assert_allclose(vif1, vif2, rtol=1e-04)
np.testing.assert_allclose(cn1, cn2, rtol=1e-04)
Expand Down Expand Up @@ -152,10 +152,10 @@ def test_GS_F_Parallel(self):
BIC = get_BIC(rslt)
CV = get_CV(rslt)

self.assertAlmostEquals(np.floor(AICc), 895.0)
self.assertAlmostEquals(np.floor(AIC), 890.0)
self.assertAlmostEquals(np.floor(BIC), 943.0)
self.assertAlmostEquals(np.around(CV, 2), 18.21)
self.assertAlmostEqual(np.floor(AICc), 895.0)
self.assertAlmostEqual(np.floor(AIC), 890.0)
self.assertAlmostEqual(np.floor(BIC), 943.0)
self.assertAlmostEqual(np.around(CV, 2), 18.21)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-04)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-04)
Expand Down Expand Up @@ -364,11 +364,11 @@ def test_BS_NN_longlat_Parallel(self):
CV = get_CV(rslt)
R2 = rslt.R2

self.assertAlmostEquals(np.around(R2, 4), 0.5921)
self.assertAlmostEquals(np.floor(AICc), 896.0)
self.assertAlmostEquals(np.floor(AIC), 892.0)
self.assertAlmostEquals(np.floor(BIC), 941.0)
self.assertAlmostEquals(np.around(CV, 2), 19.11)
self.assertAlmostEqual(np.around(R2, 4), 0.5921)
self.assertAlmostEqual(np.floor(AICc), 896.0)
self.assertAlmostEqual(np.floor(AIC), 892.0)
self.assertAlmostEqual(np.floor(BIC), 941.0)
self.assertAlmostEqual(np.around(CV, 2), 19.11)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-04)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-04)
Expand Down Expand Up @@ -449,9 +449,9 @@ def test_BS_F_Parallel(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 13294.0)
self.assertAlmostEquals(np.floor(AIC), 13247.0)
self.assertAlmostEquals(np.floor(BIC), 13485.0)
self.assertAlmostEqual(np.floor(AICc), 13294.0)
self.assertAlmostEqual(np.floor(AIC), 13247.0)
self.assertAlmostEqual(np.floor(BIC), 13485.0)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-05)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-03)
Expand Down Expand Up @@ -500,10 +500,10 @@ def test_BS_NN(self):
BIC = get_BIC(rslt)
D2 = rslt.D2

self.assertAlmostEquals(np.floor(AICc), 13285)
self.assertAlmostEquals(np.floor(AIC), 13259.0)
self.assertAlmostEquals(np.floor(BIC), 13442.0)
self.assertAlmostEquals(np.round(D2, 3), 0.747)
self.assertAlmostEqual(np.floor(AICc), 13285)
self.assertAlmostEqual(np.floor(AIC), 13259.0)
self.assertAlmostEqual(np.floor(BIC), 13442.0)
self.assertAlmostEqual(np.round(D2, 3), 0.747)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-02)
Expand Down Expand Up @@ -553,10 +553,10 @@ def test_BS_NN_Offset_Parallel(self):
BIC = get_BIC(rslt)
D2 = rslt.D2

self.assertAlmostEquals(np.floor(AICc), 367.0)
self.assertAlmostEquals(np.floor(AIC), 361.0)
self.assertAlmostEquals(np.floor(BIC), 451.0)
self.assertAlmostEquals(np.round(D2, 3), 0.676)
self.assertAlmostEqual(np.floor(AICc), 367.0)
self.assertAlmostEqual(np.floor(AIC), 361.0)
self.assertAlmostEqual(np.floor(BIC), 451.0)
self.assertAlmostEqual(np.round(D2, 3), 0.676)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-02,
atol=1e-02)
Expand Down Expand Up @@ -619,9 +619,9 @@ def test_GS_F_Parallel(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 11283.0)
self.assertAlmostEquals(np.floor(AIC), 11211.0)
self.assertAlmostEquals(np.floor(BIC), 11497.0)
self.assertAlmostEqual(np.floor(AICc), 11283.0)
self.assertAlmostEqual(np.floor(AIC), 11211.0)
self.assertAlmostEqual(np.floor(BIC), 11497.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-03)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-02)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-02)
Expand Down Expand Up @@ -668,9 +668,9 @@ def test_GS_NN_Parallel(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 21070.0)
self.assertAlmostEquals(np.floor(AIC), 21069.0)
self.assertAlmostEquals(np.floor(BIC), 21111.0)
self.assertAlmostEqual(np.floor(AICc), 21070.0)
self.assertAlmostEqual(np.floor(AIC), 21069.0)
self.assertAlmostEqual(np.floor(BIC), 21111.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-04)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-02)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-02)
Expand Down Expand Up @@ -756,9 +756,9 @@ def test_BS_F_Parallel(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 275.0)
self.assertAlmostEquals(np.floor(AIC), 271.0)
self.assertAlmostEquals(np.floor(BIC), 349.0)
self.assertAlmostEqual(np.floor(AICc), 275.0)
self.assertAlmostEqual(np.floor(AIC), 271.0)
self.assertAlmostEqual(np.floor(BIC), 349.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-00)
Expand Down Expand Up @@ -821,10 +821,10 @@ def test_BS_NN_Parallel(self):
BIC = get_BIC(rslt)
D2 = rslt.D2

self.assertAlmostEquals(np.floor(AICc), 277.0)
self.assertAlmostEquals(np.floor(AIC), 271.0)
self.assertAlmostEquals(np.floor(BIC), 358.0)
self.assertAlmostEquals(np.round(D2, 3), 0.319)
self.assertAlmostEqual(np.floor(AICc), 277.0)
self.assertAlmostEqual(np.floor(AIC), 271.0)
self.assertAlmostEqual(np.floor(BIC), 358.0)
self.assertAlmostEqual(np.round(D2, 3), 0.319)

np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
Expand Down Expand Up @@ -888,9 +888,9 @@ def test_GS_F_Parallel(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 276.0)
self.assertAlmostEquals(np.floor(AIC), 272.0)
self.assertAlmostEquals(np.floor(BIC), 341.0)
self.assertAlmostEqual(np.floor(AICc), 276.0)
self.assertAlmostEqual(np.floor(AIC), 272.0)
self.assertAlmostEqual(np.floor(BIC), 341.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-00)
Expand Down Expand Up @@ -952,9 +952,9 @@ def test_GS_NN_Parallel(self):
AIC = get_AIC(rslt)
BIC = get_BIC(rslt)

self.assertAlmostEquals(np.floor(AICc), 276.0)
self.assertAlmostEquals(np.floor(AIC), 273.0)
self.assertAlmostEquals(np.floor(BIC), 331.0)
self.assertAlmostEqual(np.floor(AICc), 276.0)
self.assertAlmostEqual(np.floor(AIC), 273.0)
self.assertAlmostEqual(np.floor(BIC), 331.0)
np.testing.assert_allclose(est_Int, rslt.params[:, 0], rtol=1e-00)
np.testing.assert_allclose(se_Int, rslt.bse[:, 0], rtol=1e-00)
np.testing.assert_allclose(t_Int, rslt.tvalues[:, 0], rtol=1e-00)
Expand Down

0 comments on commit b3180fb

Please sign in to comment.