spacefilling
spacefilling
¶
Bases: designs
Source code in spotpython/design/spacefilling.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
__init__(k=2, seed=123)
¶
Spacefilling design class
Parameters:
Name | Type | Description | Default |
---|---|---|---|
k |
int
|
number of design variables (dimensions). Defaults to 2. |
2
|
seed |
int
|
random seed. Defaults to 123. |
123
|
Source code in spotpython/design/spacefilling.py
10 11 12 13 14 15 16 17 18 19 20 21 |
|
scipy_lhd(n, repeats=1, lower=None, upper=None)
¶
Latin hypercube sampling based on scipy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n |
int
|
number of samples |
required |
repeats |
int
|
number of repeats (replicates) |
1
|
lower |
int or float
|
lower bound. Defaults to 0. |
None
|
upper |
int or float
|
upper bound. Defaults to 1. |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
Latin hypercube design. |
Examples:
>>> from spotpython.design.spacefilling import spacefilling
import numpy as np
lhd = spacefilling(k=2, seed=123)
lhd.scipy_lhd(n=5, repeats=2, lower=np.array([0,0]), upper=np.array([1,1]))
array([[0.66352963, 0.5892358 ],
[0.66352963, 0.5892358 ],
[0.55592803, 0.96312564],
[0.55592803, 0.96312564],
[0.16481882, 0.0375811 ],
[0.16481882, 0.0375811 ],
[0.215331 , 0.34468512],
[0.215331 , 0.34468512],
[0.83604909, 0.62202146],
[0.83604909, 0.62202146]])
Source code in spotpython/design/spacefilling.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|