Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaelicke committed Jan 19, 2024
1 parent 9e00672 commit 02d01ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion skgstat/Variogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,7 @@ def rmse(self):

@property
def mse(self):
r"""RMSE
r"""MSE
Calculate the Mean squared error between the experimental
variogram and the theoretical model values at corresponding lags.
Expand Down Expand Up @@ -2383,6 +2383,7 @@ def nrmse(self):
"""
return self.rmse / np.nanmean(self.experimental)

@property
def root_mean_square(self):
"""Root Mean Square (RMS) of the residuals
Expand All @@ -2395,6 +2396,7 @@ def root_mean_square(self):
Root Mean Square of the residuals.
"""
return np.sqrt(np.nanmean(np.square(self.model_residuals)))

Check warning on line 2398 in skgstat/Variogram.py

View check run for this annotation

Codecov / codecov/patch

skgstat/Variogram.py#L2398

Added line #L2398 was not covered by tests

@property
def residual_sum_of_squares(self):
"""Residual Sum of Squares (RSS)
Expand All @@ -2411,6 +2413,10 @@ def residual_sum_of_squares(self):
"""
return np.nansum(np.square(self.model_residuals))

@property
def rss(self):
return self.residual_sum_of_squares

@property
def nrmse_r(self):
r"""NRMSE
Expand Down
5 changes: 5 additions & 0 deletions skgstat/tests/test_variogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,11 @@ def test_mse(self):
V = Variogram(self.c, self.v, n_lags=15)

self.assertAlmostEqual(np.sqrt(V.mse), V.rmse, places=6)

def test_rss(self):
V = Variogram(self.c, self.v, n_lags=15)

self.assertAlmostEqual(V.rss, 357.76, places=2)

def test_update_kwargs(self):
V = Variogram(self.c, self.v, percentile=.3)
Expand Down

0 comments on commit 02d01ae

Please sign in to comment.