maximin.leave_one_out

maximin.leave_one_out(arr, b, method='LP')

Apply the Leave-one-out Procedure to Generate a Maxmin LHD

Parameters

Name Type Description Default
arr numpy.numpy.ArrayLike A numpy ndarry, with initial shape \((n \times d)\) required
b int Integer to apply either linear level permutation or William’s transformation required
method Literal['LP', 'WT'] Linear level permutation (LP) or William’s transformation (WT). Defaults to ‘LP’. 'LP'

Raises

Type Description
TypeError b must be an integer
ValueError Given an LHD with column permutations (0,1,…,n-1), b must be within (0,1,…,n-1)
ValueError If method is not ‘LP’ or ‘WT’

Returns

Type Description
numpy.numpy.ndarray After removing the last constant row of initial LHD, an \((n-1) \times d\) maximin LHD is returned

Example:

import pyLHD
n = 11
x = pyLHD.GoodLatticePoint(size = (n,n-1))
x
array([[ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10],
       [ 2,  4,  6,  8, 10,  1,  3,  5,  7,  9],
       [ 3,  6,  9,  1,  4,  7, 10,  2,  5,  8],
       [ 4,  8,  1,  5,  9,  2,  6, 10,  3,  7],
       [ 5, 10,  4,  9,  3,  8,  2,  7,  1,  6],
       [ 6,  1,  7,  2,  8,  3,  9,  4, 10,  5],
       [ 7,  3, 10,  6,  2,  9,  5,  1,  8,  4],
       [ 8,  5,  2, 10,  7,  4,  1,  9,  6,  3],
       [ 9,  7,  5,  3,  1, 10,  8,  6,  4,  2],
       [10,  9,  8,  7,  6,  5,  4,  3,  2,  1],
       [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0]])

The initial \(L_1\)-distance of x is

pyLHD.LqDistance(x, q=1).design()
30.0

After applying the Leave-one-out method with a simple linear level permutation, we should obtain an \((n-1) \times d\) LHD with higher \(L_1\)-distance

x_lp = pyLHD.leave_one_out(x, b = 1, method = 'LP')
x_lp
array([[1, 2, 3, 4, 5, 6, 7, 8, 9, 0],
       [2, 4, 6, 8, 0, 1, 3, 5, 7, 9],
       [3, 6, 9, 1, 4, 7, 0, 2, 5, 8],
       [4, 8, 1, 5, 9, 2, 6, 0, 3, 7],
       [5, 0, 4, 9, 3, 8, 2, 7, 1, 6],
       [6, 1, 7, 2, 8, 3, 9, 4, 0, 5],
       [7, 3, 0, 6, 2, 9, 5, 1, 8, 4],
       [8, 5, 2, 0, 7, 4, 1, 9, 6, 3],
       [9, 7, 5, 3, 1, 0, 8, 6, 4, 2],
       [0, 9, 8, 7, 6, 5, 4, 3, 2, 1]])
pyLHD.LqDistance(x_lp,q=1).design()
32.0

Leave-one-out method using William’s transformation

x_wt = pyLHD.leave_one_out(x, b = 1, method = 'WT')
x_wt
array([[3, 5, 7, 9, 8, 6, 4, 2, 1, 0],
       [5, 9, 6, 2, 0, 3, 7, 8, 4, 1],
       [7, 6, 1, 3, 9, 4, 0, 5, 8, 2],
       [9, 2, 3, 8, 1, 5, 6, 0, 7, 4],
       [8, 0, 9, 1, 7, 2, 5, 4, 3, 6],
       [6, 3, 4, 5, 2, 7, 1, 9, 0, 8],
       [4, 7, 0, 6, 5, 1, 8, 3, 2, 9],
       [2, 8, 5, 0, 4, 9, 3, 1, 6, 7],
       [1, 4, 8, 7, 3, 0, 2, 6, 9, 5],
       [0, 1, 2, 4, 6, 8, 9, 7, 5, 3]])
pyLHD.LqDistance(x_wt,q=1).design()
36.0