Skip to content

Commit c8ab20d

Browse files
committed
changes for CRAN
1 parent 0d842a0 commit c8ab20d

File tree

6 files changed

+24
-73
lines changed

6 files changed

+24
-73
lines changed

R/deepregression.R

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,7 @@ deepregression <- function(
124124
)
125125
{
126126

127-
if(!is.null(seed)){
128-
if(engine == "tf"){
129-
try(tensorflow::set_random_seed(seed), silent = TRUE)
130-
} else {
131-
try(torch::torch_manual_seed(seed), silent = TRUE)
132-
}
133-
}
134127

135-
136128
if(engine == "tf"){
137129
if(!reticulate::py_available())
138130
{
@@ -146,6 +138,14 @@ deepregression <- function(
146138
invisible(return(NULL))
147139
}}
148140

141+
if(!is.null(seed)){
142+
if(engine == "tf"){
143+
try(tensorflow::set_random_seed(seed), silent = TRUE)
144+
} else {
145+
try(torch::torch_manual_seed(seed), silent = TRUE)
146+
}
147+
}
148+
149149
if(engine == "tf"){
150150
if(is.null(subnetwork_builder)) subnetwork_builder = subnetwork_init
151151
if(is.null(model_builder)) model_builder = keras_dr

R/families_torch.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#' with parameters (and corresponding inverse link function in brackets):
1717
#'
1818
#' \itemize{
19-
#' \item{"normal": }{normal distribution with location (identity), scale (exp)}
20-
#' \item{"bernoulli": }{bernoulli distribution with logits (identity)}
21-
#' \item{"exponential": }{exponential with lambda (exp)}
22-
#' \item{"gamma": }{gamma with concentration (exp) and rate (exp)}
23-
#' \item{"poisson": }{poisson with rate (exp)}
19+
#' \item \code{"normal"} : normal distribution with location (identity), scale (exp)
20+
#' \item \code{"bernoulli"} : bernoulli distribution with logits (identity)
21+
#' \item \code{"exponential"} : exponential with lambda (exp)
22+
#' \item \code{"gamma"} : gamma with concentration (exp) and rate (exp)
23+
#' \item \code{"poisson"} : poisson with rate (exp)
2424
#' }
2525
#' @param add_const small positive constant to stabilize calculations
2626
#' @param trafo_list list of transformations for each distribution parameter.

R/zzz.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ create_package_name <- function(package, version)
1515
{
1616
res <- suppressMessages(reticulate::configure_environment(pkgname))
1717
if(res & requireNamespace("tensorflow", quietly = TRUE) &
18-
requireNamespace("keras", quietly = TRUE)){
18+
requireNamespace("keras", quietly = TRUE) & .Platform$OS.type != "windows"){
1919
suppressMessages(try(tf$compat$v1$logging$set_verbosity(
2020
tf$compat$v1$logging$ERROR)))
2121
suppressMessages(try(tf$get_logger()$setLevel('ERROR')))

man/dr_families.Rd

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tfd_mse.Rd

Lines changed: 2 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library(testthat)
22
library(deepregression)
33

44
if (reticulate::py_module_available("tensorflow") &
5-
reticulate::py_module_available("keras")){
5+
reticulate::py_module_available("keras") &
6+
.Platform$OS.type != "windows"){
67
test_check("deepregression")
7-
}
8+
}

0 commit comments

Comments
 (0)