"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "R/R/utilities.R" between
prophet-1.0.tar.gz and prophet-1.1.tar.gz

About: Prophet is a tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

utilities.R  (prophet-1.0):utilities.R  (prophet-1.1)
skipping to change at line 41 skipping to change at line 41
#' @export #' @export
regressor_coefficients <- function(m){ regressor_coefficients <- function(m){
if (length(m$extra_regressors) == 0) { if (length(m$extra_regressors) == 0) {
stop("No extra regressors found.") stop("No extra regressors found.")
} }
regr_names <- names(m$extra_regressors) regr_names <- names(m$extra_regressors)
regr_modes <- unlist(lapply(m$extra_regressors, function(x) x$mode)) regr_modes <- unlist(lapply(m$extra_regressors, function(x) x$mode))
regr_mus <- unlist(lapply(m$extra_regressors, function (x) x$mu)) regr_mus <- unlist(lapply(m$extra_regressors, function (x) x$mu))
regr_stds <- unlist(lapply(m$extra_regressors, function(x) x$std)) regr_stds <- unlist(lapply(m$extra_regressors, function(x) x$std))
beta_indices <- which(m$train.component.cols[, regr_names] == 1, arr.ind = TRU E)[, "row"] beta_indices <- which(m$train.component.cols[, regr_names, drop = FALSE] == 1, arr.ind = TRUE)[, "row"]
betas <- m$params$beta[, beta_indices, drop = FALSE] betas <- m$params$beta[, beta_indices, drop = FALSE]
# If regressor is additive, multiply by the scale factor to put coefficients o n the original training data scale. # If regressor is additive, multiply by the scale factor to put coefficients o n the original training data scale.
y_scale_indicator <- matrix( y_scale_indicator <- matrix(
data = ifelse(regr_modes == "additive", m$y.scale, 1), data = ifelse(regr_modes == "additive", m$y.scale, 1),
nrow = nrow(betas), nrow = nrow(betas),
ncol = ncol(betas), ncol = ncol(betas),
byrow = TRUE byrow = TRUE
) )
coefs <- betas * y_scale_indicator / regr_stds coefs <- betas * y_scale_indicator / regr_stds
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)