From a99e86b3607aa32ccff276a775a0a2503ef87ac9 Mon Sep 17 00:00:00 2001 From: jcmhk <115221821+jcmhk@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:41:25 +0100 Subject: [PATCH 1/2] Update owrandomdata.py I forgot to change ParameterDef("High bound", "scale", 1, any_float) to ParameterDef("Range", "scale", 1, any_float) in my last pull request --- orangecontrib/educational/widgets/owrandomdata.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/orangecontrib/educational/widgets/owrandomdata.py b/orangecontrib/educational/widgets/owrandomdata.py index 2e00aeb..8b7ead8 100644 --- a/orangecontrib/educational/widgets/owrandomdata.py +++ b/orangecontrib/educational/widgets/owrandomdata.py @@ -238,17 +238,19 @@ class ContinuousUniform(ParametersEditorContinuous): name = "Uniform distribution" parameters = ( ParameterDef("Low bound", "loc", 0, any_float), - ParameterDef("High bound", "scale", 1, any_float) + #ParameterDef("High bound", "scale", 1, any_float) + ParameterDef("Range", "scale", 1, any_float) ) rvs = stats.uniform.rvs @staticmethod def check(*, loc, scale): # pylint: disable=arguments-differ - if loc >= scale: - return "Lower bound is must be below the upper." + # if loc >= scale: + # return "Lower bound is must be below the upper." + if scale<=0: + return "Range needs to be >=0." return None - class DiscreteUniform(ParametersEditorDiscrete): name = "Discrete uniform distribution" parameters = (ParameterDef("Number of values", "k", 6, pos_int), ) From 4b50c35ac5752613288d447e48c1a1c346c387d2 Mon Sep 17 00:00:00 2001 From: jcmhk <115221821+jcmhk@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:43:42 +0100 Subject: [PATCH 2/2] Update owrandomdata.py --- orangecontrib/educational/widgets/owrandomdata.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/orangecontrib/educational/widgets/owrandomdata.py b/orangecontrib/educational/widgets/owrandomdata.py index 8b7ead8..a97228c 100644 --- a/orangecontrib/educational/widgets/owrandomdata.py +++ b/orangecontrib/educational/widgets/owrandomdata.py @@ -238,19 +238,19 @@ class ContinuousUniform(ParametersEditorContinuous): name = "Uniform distribution" parameters = ( ParameterDef("Low bound", "loc", 0, any_float), - #ParameterDef("High bound", "scale", 1, any_float) - ParameterDef("Range", "scale", 1, any_float) + ParameterDef("High bound", "scale", 1, any_float) ) - rvs = stats.uniform.rvs + @staticmethod + def rvs(loc, scale, size): + return stats.uniform.rvs(loc, scale - loc, size=size) @staticmethod def check(*, loc, scale): # pylint: disable=arguments-differ - # if loc >= scale: - # return "Lower bound is must be below the upper." - if scale<=0: - return "Range needs to be >=0." + if loc >= scale: + return "Lower bound is must be below the upper." return None + class DiscreteUniform(ParametersEditorDiscrete): name = "Discrete uniform distribution" parameters = (ParameterDef("Number of values", "k", 6, pos_int), )