From d0394626944649d464493e1c5cb01dcf0db7ccee Mon Sep 17 00:00:00 2001 From: bbayukari <17bbayukari@gmail.com> Date: Sun, 3 Sep 2023 12:37:03 +0800 Subject: [PATCH] fix: define only one shape-para in Gamma model --- R-package/R/generate.data.R | 2 +- python/abess/datasets.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R-package/R/generate.data.R b/R-package/R/generate.data.R index 1d3eb83d..fcbde084 100644 --- a/R-package/R/generate.data.R +++ b/R-package/R/generate.data.R @@ -393,7 +393,7 @@ generate.data <- function(n, # set coef_0 as + abs(min(eta)) + 1 eta <- eta + abs(min(eta)) + 10 # set the shape parameter of gamma uniformly in [0.1, 100.1] - shape_para <- 100 * runif(n) + 0.1 + shape_para <- rep(100 * runif(1) + 0.1, n) y <- stats::rgamma(n, shape = shape_para, rate = shape_para * eta) } diff --git a/python/abess/datasets.py b/python/abess/datasets.py index f8ddb65d..4c08efa5 100644 --- a/python/abess/datasets.py +++ b/python/abess/datasets.py @@ -286,7 +286,7 @@ def __init__(self, n, p, k, family, rho=0, corr_type="const", sigma=1, eta = eta - np.abs(np.max(eta)) - 10 eta = -1 / eta # set the shape para of gamma uniformly in [0.1,100.1] - shape_para = 100 * np.random.uniform(0, 1, n) + 0.1 + shape_para = 100 * np.random.uniform(0, 1) + 0.1 y = np.random.gamma( shape=shape_para, scale=eta / shape_para,