Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify inclusive or not for the bounds on scaleLHC #21

Open
DomDF opened this issue Jan 10, 2023 · 1 comment
Open

Specify inclusive or not for the bounds on scaleLHC #21

DomDF opened this issue Jan 10, 2023 · 1 comment

Comments

@DomDF
Copy link

DomDF commented Jan 10, 2023

Hi,
I was wondering if there was a way to ask that the bounds when rescaling a LHC sampler could not be included?
Is there an argument in the function that I am not aware of?

At the moment, I am having to use the below code to add 2 extra samples, which I then use to filter our the values at the bounds:

function draw_lhs(dist, n::Int)
    samples = randomLHC(n + 2, 1) |>    # Add 2 dummy samples
        x -> scaleLHC(x, [(0, 1)])[:, 1] |>    # rescale LHC using bounds that I would like not to be included in the sampling
        x -> filter(∉((0, 1)), x) |>    # Remove 2 samples corresponding to the bounds (Pr = 0 and Pr  = 1)
        x -> sort(x) |>
        x -> quantile(dist, x)
    return samples
end

Kind Regards,
Dom

@MrUrq
Copy link
Owner

MrUrq commented May 17, 2023

Hi,
This is not possible currently. Either you can specify the bounds the be narrower and so that they coincide with your centers or create a range which is n+2 and then discard the edges.

LHC = randomLHC(n, 1)
vals=range(start=0,stop=1,length=n+2)
vals[LHC[:,1].+1] |> sort

9-element Vector{Float64}:
 0.1
 0.2
 0.3
 0.4
 0.5
 0.6
 0.7
 0.8
 0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants