Modules¶
APIs¶
-
pyunidoe.pyunidoe.
design_pairs_plot
(x)[source]¶ This function draws a pairs plot for checking the design.
- Parameters
x (an integer numpy matrix) – representing the design matrix
-
pyunidoe.pyunidoe.
design_eval
(x, crit='CD2')[source]¶ This function takes matrix X0,q and crit to output the criterion value.
- Parameters
x (an integer numpy matrix) – representing the design matrix:
crit (a character object, default="CD2") –
criterion to be evaluated:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
>>> x = np.array([[1, 2], >>> [3, 3], >>> [2, 1]]) >>> crit = "MD2" >>> obj = design_eval(x,crit)
-
pyunidoe.pyunidoe.
design_query
(n, s, q, crit='CD2', show_crit=True)[source]¶ This function takes size of desired design,criterion crit. If the required design exists in database, then return the design, else return NULL.
- Parameters
n (an integer object) – run of experiments
s (an integer object) – number of experimental factors
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion of the query:
”CD2”: Centered L2 Discrepancy;
”MD2”: Mixture L2 Discrepancy.
show_crit (boolean) – choose to print the criteria value
-
pyunidoe.pyunidoe.
gen_ud
(n, s, q, init='rand', initX=array([], shape=(1, 0), dtype=float64), crit='CD2', maxiter=100, hits_ratio=0.1, levelpermt=False, rand_seed=0, vis=False)[source]¶ This function takes n,s,q and other arguments to output a list(described below).
- Parameters
n (an integer object) – run of experiments
s (an integer object) – number of experimental factors
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion to be optimized:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
init (a string vector object, default="rand") –
initialization method for the design:
”rand”: randomly generate initial design;
”input”: user specified.
initX (a user-defined numpy integer matrix object, default=np.array([[]])) – This is the user-defined initial design matrix, and will be used when init=”input”
maxiter (a positive integer object, default=100) – maximum iteration number in outer while loop of SATA algorithm.
levelpermt (a boolean object, default=False) – it controls whether to use level permutation
hits_ratio (a float object, default=0.1) – Default value is 0.1, which is the ratio to accept changes of design in inner for loop
rand_seed (an integer object, default=0) – random seed
vis (a boolean object, default=False) – if true, plot the criterion value sequence
>>> ## 1 >>> n=12 #(must be multiples of q) >>> s=3 >>> q=4 >>> crit = "CD2"#(Centered L2 criteria) >>> stat = gen_ud(n,s,q,crit=crit,maxiter=100)
## 2 >>> n=10 >>> s=3 >>> q=5 >>> init = “rand” >>> crit = “MD2” #(Mixture L2 criteria) >>> vis=TRUE >>> stat = gen_ud(n,s,q,init=init,crit=crit,maxiter=100,vis=vis)
## 3 >>> #If init=”input”, algorithm will search for better a better design with same size as initX (balanced design). >>> n=3 >>> s=2 >>> q=3 >>> initX = np.array([[1, 1], >>> [2, 2], >>> [3, 3]]) >>> stat = gen_ud(n,s,q, init=”input”, initX = initX, maxiter=100)
-
pyunidoe.pyunidoe.
gen_aud
(xp, n, s, q, init='rand', initX=array([], shape=(1, 0), dtype=float64), crit='CD2', maxiter=100, hits_ratio=0.1, levelpermt=False, rand_seed=0, vis=False)[source]¶ This function takes n,s,q; a unchanged initial design and other arguments to output a list (described below).
- Parameters
xp (a numpy integer matrix object) – representing the previous existing design matrix
n (an integer object) – run of experiments, including the previous design in xp
s (an integer object) – number of experimental factors
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion to be optimized:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
init (a string vector object, default="rand") –
initialization method for the run-augmented design:
”rand”: randomly generate initial design;
”input”: user specified.
initX (a user-defined numpy integer matrix object, default=np.array([[]])) – This is the user-defined initial design matrix, and will be used when init=”input”
maxiter (a positive integer object, default=100) – maximum iteration number in outer while loop of SATA algorithm.
levelpermt (a boolean object, default=False) – it controls whether to use level permutation
hits_ratio (a float object, default=0.1) – Default value is 0.1, which is the ratio to accept changes of design in inner for loop
rand_seed (an integer object, default=0) – random seed
vis (a boolean object, default=False) – if true, plot the criterion value sequence
>>> n=6 >>> s=2 >>> q=3 >>> xp = np.array([[1, 1], >>> [2, 2], >>> [3, 3]]) >>> crit = "CD2" >>> res = gen_aud(xp,n,s,q,crit=crit,maxiter=100,vis = True)
-
pyunidoe.pyunidoe.
gen_aud_col
(xp, n, s, q, init='rand', initX=array([], shape=(1, 0), dtype=float64), crit='CD2', maxiter=100, hits_ratio=0.1, levelpermt=False, rand_seed=0, vis=False)[source]¶ This function takes n,s,q; a unchanged initial design and other arguments to output a list (described below).
- Parameters
xp (a numpy integer matrix object) – representing the previous existing design matrix
n (an integer object) – run of experiments
s (an integer object) – number of experimental factors, including the previous design in xp
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion to be optimized:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
init (a string vector object, default="rand") –
initialization method for the factor-augmented design:
”rand”: randomly generate initial design;
”input”: user specified.
initX (a user-defined numpy integer matrix object, default=np.array([[]])) – This is the user-defined initial design matrix, and will be used when init=”input”
maxiter (a positive integer object, default=100) – maximum iteration number in outer while loop of SATA algorithm.
levelpermt (a boolean object, default=False) – it controls whether to use level permutation
hits_ratio (a float object, default=0.1) – Default value is 0.1, which is the ratio to accept changes of design in inner for loop
rand_seed (an integer object, default=0) – random seed
vis (a boolean object, default=False) – if true, plot the criterion value sequence
>>> n=3 >>> s=4 >>> q=3 >>> xp = np.array([[1, 1], >>> [2, 2], >>> [3, 3]]) >>> crit = "CD2" >>> res = gen_aud_col(xp,n,s,q,crit=crit,maxiter=100,vis = True)
-
pyunidoe.pyunidoe.
gen_ud_ms
(n, s, q, crit='CD2', maxiter=100, nshoot=5, rand_seed=0, n_jobs=1, vis=False)[source]¶ This function generates Uniform Design of Experiments using diffrent initializations.
- Parameters
xp (a numpy integer matrix object) – representing the previous existing design matrix
n (an integer object) – run of experiments
s (an integer object) – number of experimental factors
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion to be optimized:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
maxiter (a positive integer object, default=100) – maximum iteration number in outer while loop of SATA algorithm.
nshoot (a positive integer object, default=5) – total counts to try different initial designs
rand_seed (an integer object, default=0) – random seed
hits_ratio (a float object, default=0.1) – Default value is 0.1, which is the ratio to accept changes of design in inner for loop
rand_seed – random seed
n_jobs (an integer object, default=1) – the number of cores to be used for parallelization
vis (a boolean object, default=False) – if true, plot the criterion value sequence
-
pyunidoe.pyunidoe.
gen_aud_ms
(xp, n, s, q, crit='CD2', maxiter=100, nshoot=5, rand_seed=0, n_jobs=1, vis=False)[source]¶ This function generates sequential Uniform Design of Experiments (Augmenting Runs) using diffrent initializations.
- Parameters
xp (a numpy integer matrix object) – representing the previous existing design matrix
n (an integer object) – run of experiments, including the previous design in xp
s (an integer object) – number of experimental factors
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion to be optimized:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
maxiter (a positive integer object, default=100) – maximum iteration number in outer while loop of SATA algorithm.
nshoot (a positive integer object, default=5) – total counts to try different initial designs
rand_seed (an integer object, default=0) – random seed
hits_ratio (a float object, default=0.1) – Default value is 0.1, which is the ratio to accept changes of design in inner for loop
rand_seed – random seed
n_jobs (an integer object, default=1) – the number of cores to be used for parallelization
vis (a boolean object, default=False) – if true, plot the criterion value sequence
-
pyunidoe.pyunidoe.
gen_aud_col_ms
(xp, n, s, q, crit='CD2', maxiter=100, nshoot=5, rand_seed=0, n_jobs=1, vis=False)[source]¶ This function generates sequential Uniform Design of Experiments (Augmenting Factors) using diffrent initializations.
- Parameters
xp (a numpy integer matrix object) – representing the previous existing design matrix
n (an integer object) – run of experiments
s (an integer object) – number of experimental factors, including the number of factors in previous design xp
q (an integer object) – number of experimental levels for each factor
crit (a character object, default="CD2") –
criterion to be optimized:
”CD2” – Centered L2 Discrepancy;
”WD2” – Wrap-around L2 Discrepancy;
”MD2” – Mixture L2 Discrepancy;
”maximin” – Maximin Discrepancy;
”MC” – Minimum Coherence;
”A2” – Mean Squared Correlation.
maxiter (a positive integer object, default=100) – maximum iteration number in outer while loop of SATA algorithm.
nshoot (a positive integer object, default=5) – total counts to try different initial designs
rand_seed (an integer object, default=0) – random seed
hits_ratio (a float object, default=0.1) – Default value is 0.1, which is the ratio to accept changes of design in inner for loop
rand_seed – random seed
n_jobs (an integer object, default=1) – the number of cores to be used for parallelization
vis (a boolean object, default=False) – if true, plot the criterion value sequence