mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-21 09:15:36 +00:00
improvements in docstrings and testing for disabling uncertainty
This commit is contained in:
parent
8d0f23f8be
commit
be25372090
4 changed files with 10 additions and 6 deletions
|
|
@ -242,8 +242,8 @@ performance_metrics <- function(df, metrics = NULL, rolling_window = 0.1) {
|
|||
if (is.null(metrics)) {
|
||||
metrics <- valid_metrics
|
||||
}
|
||||
if (!('yhat_lower' %in% colnames(df)) | (!('yhat_upper' %in% colnames(df))) & ('coverage' %in% metrics)){
|
||||
metrics <- valid_metrics[valid_metrics != 'coverage']
|
||||
if ((!('yhat_lower' %in% colnames(df)) | !('yhat_upper' %in% colnames(df))) & ('coverage' %in% metrics)){
|
||||
metrics <- metrics[metrics != 'coverage']
|
||||
}
|
||||
|
||||
if (length(metrics) != length(unique(metrics))) {
|
||||
|
|
|
|||
|
|
@ -99,6 +99,8 @@ test_that("cross_validation_uncertainty_disabled", {
|
|||
m, horizon = 4, units = "days", period = 4, initial = 115)
|
||||
expected.cols <- c('y', 'ds', 'yhat', 'cutoff')
|
||||
expect_equal(expected.cols, colnames(df.cv))
|
||||
df.p <- performance_metrics(df.cv)
|
||||
expect_false('coverage' %in% colnames(df.p))
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ class TestDiagnostics(TestCase):
|
|||
m, horizon='4 days', period='4 days', initial='115 days')
|
||||
expected_cols = ['ds', 'yhat', 'y', 'cutoff']
|
||||
self.assertTrue(all(col in expected_cols for col in df_cv.columns.tolist()))
|
||||
df_p = diagnostics.performance_metrics(df_cv)
|
||||
self.assertTrue('coverage' not in df_p.columns)
|
||||
|
||||
def test_performance_metrics(self):
|
||||
m = Prophet()
|
||||
|
|
|
|||
Loading…
Reference in a new issue