0
# Taguchi & Robust Design
1
2
Taguchi methodology for robust parameter design with orthogonal arrays and signal-to-noise ratio analysis. These methods focus on minimizing variability and improving product/process robustness by identifying factor settings that are insensitive to noise and environmental conditions.
3
4
## Capabilities
5
6
### Taguchi Design Generation
7
8
Create experimental designs using Taguchi orthogonal arrays with actual factor levels.
9
10
```python { .api }
11
def taguchi_design(oa_name: ORTHOGONAL_ARRAY_NAMES, levels_per_factor: List[List]) -> np.ndarray:
12
"""
13
Generate a Taguchi design matrix using an orthogonal array and factor levels
14
15
Parameters:
16
- oa_name: str, name of Taguchi orthogonal array (e.g., 'L4(2^3)', 'L8(2^7)')
17
- levels_per_factor: list of lists, actual factor settings for each factor
18
Length must match number of columns in orthogonal array
19
20
Returns:
21
- design_matrix: 2d-array, design matrix with actual factor settings
22
"""
23
```
24
25
**Usage Example:**
26
```python
27
import pyDOE3
28
29
# Define factor levels for L9(3^4) array (4 factors, 3 levels each)
30
factor_levels = [
31
[100, 150, 200], # Temperature (°C)
32
[10, 20, 30], # Pressure (bar)
33
[0.5, 1.0, 1.5], # Flow rate (L/min)
34
['A', 'B', 'C'] # Catalyst type
35
]
36
37
# Generate Taguchi design
38
design = pyDOE3.taguchi_design("L9(3^4)", factor_levels)
39
print(f"Design shape: {design.shape}") # (9, 4)
40
print("Factor combinations:")
41
print(design)
42
```
43
44
### Orthogonal Array Management
45
46
Access and explore available Taguchi orthogonal arrays.
47
48
```python { .api }
49
def list_orthogonal_arrays() -> List[str]:
50
"""
51
List descriptive names of available Taguchi orthogonal arrays
52
53
Returns:
54
- array_names: list of str, available array names like ['L4(2^3)', 'L8(2^7)', ...]
55
"""
56
```
57
58
```python { .api }
59
def get_orthogonal_array(oa_name: ORTHOGONAL_ARRAY_NAMES) -> np.ndarray:
60
"""
61
Return a Taguchi orthogonal array by its descriptive name
62
63
Parameters:
64
- oa_name: str, name of the array (e.g., 'L4(2^3)', 'L8(2^7)', 'L9(3^4)')
65
66
Returns:
67
- array: 2d-array, orthogonal array with zero-indexed factor levels
68
"""
69
```
70
71
**Usage Examples:**
72
```python
73
import pyDOE3
74
75
# List all available orthogonal arrays
76
arrays = pyDOE3.list_orthogonal_arrays()
77
print("Available arrays:", arrays)
78
79
# Get specific orthogonal array
80
l4_array = pyDOE3.get_orthogonal_array("L4(2^3)")
81
print(f"L4 array shape: {l4_array.shape}") # (4, 3)
82
print("L4 array:")
83
print(l4_array)
84
85
# Get larger array for more factors
86
l16_array = pyDOE3.get_orthogonal_array("L16(2^15)")
87
print(f"L16 array shape: {l16_array.shape}") # (16, 15)
88
```
89
90
### Signal-to-Noise Ratio Analysis
91
92
Calculate signal-to-noise ratios for Taguchi robust design analysis.
93
94
```python { .api }
95
class TaguchiObjective(Enum):
96
"""
97
Enumeration for Taguchi optimization objectives
98
"""
99
LARGER_IS_BETTER = "larger is better"
100
SMALLER_IS_BETTER = "smaller is better"
101
NOMINAL_IS_BEST = "nominal is best"
102
```
103
104
```python { .api }
105
def compute_snr(responses: np.ndarray, objective: TaguchiObjective = TaguchiObjective.LARGER_IS_BETTER) -> float:
106
"""
107
Calculate the Signal-to-Noise Ratio (SNR) for Taguchi designs
108
109
Parameters:
110
- responses: array-like, response measurements for SNR calculation
111
- objective: TaguchiObjective, optimization objective type
112
113
Returns:
114
- snr: float, signal-to-noise ratio in decibels (dB)
115
"""
116
```
117
118
**SNR Formulas:**
119
- **Larger is Better**: SNR = -10 × log₁₀(mean(1/y²))
120
- **Smaller is Better**: SNR = -10 × log₁₀(mean(y²))
121
- **Nominal is Best**: SNR = 10 × log₁₀(mean²/variance)
122
123
**Usage Examples:**
124
```python
125
import pyDOE3
126
import numpy as np
127
128
# Strength measurements (larger is better)
129
strength_data = np.array([45.2, 47.8, 44.1, 46.9, 48.3])
130
snr_strength = pyDOE3.compute_snr(strength_data, pyDOE3.TaguchiObjective.LARGER_IS_BETTER)
131
print(f"Strength SNR: {snr_strength:.2f} dB")
132
133
# Defect rate (smaller is better)
134
defect_data = np.array([0.02, 0.015, 0.018, 0.022, 0.016])
135
snr_defects = pyDOE3.compute_snr(defect_data, pyDOE3.TaguchiObjective.SMALLER_IS_BETTER)
136
print(f"Defect SNR: {snr_defects:.2f} dB")
137
138
# Dimension accuracy (nominal is best, target = 50.0)
139
dimension_data = np.array([49.8, 50.2, 49.9, 50.1, 50.0])
140
snr_dimension = pyDOE3.compute_snr(dimension_data, pyDOE3.TaguchiObjective.NOMINAL_IS_BEST)
141
print(f"Dimension SNR: {snr_dimension:.2f} dB")
142
```
143
144
## Available Orthogonal Arrays
145
146
pyDOE3 provides 17 standard Taguchi orthogonal arrays:
147
148
### Two-Level Arrays (2^n)
149
- **L4(2^3)**: 4 runs, up to 3 factors, 2 levels each
150
- **L8(2^7)**: 8 runs, up to 7 factors, 2 levels each
151
- **L12(2^11)**: 12 runs, up to 11 factors, 2 levels each
152
- **L16(2^15)**: 16 runs, up to 15 factors, 2 levels each
153
- **L32(2^31)**: 32 runs, up to 31 factors, 2 levels each
154
- **L64(2^31)**: 64 runs, up to 31 factors, 2 levels each
155
156
### Three-Level Arrays (3^n)
157
- **L9(3^4)**: 9 runs, up to 4 factors, 3 levels each
158
- **L27(3^13)**: 27 runs, up to 13 factors, 3 levels each
159
- **L81(3^40)**: 81 runs, up to 40 factors, 3 levels each
160
161
### Four-Level Arrays (4^n)
162
- **L16(4^5)**: 16 runs, up to 5 factors, 4 levels each
163
- **L64(4^21)**: 64 runs, up to 21 factors, 4 levels each
164
165
### Five-Level Arrays (5^n)
166
- **L25(5^6)**: 25 runs, up to 6 factors, 5 levels each
167
168
### Mixed-Level Arrays
169
- **L18(6^1 3^6)**: 18 runs, 1 factor with 6 levels + 6 factors with 3 levels
170
- **L36(3^23)**: 36 runs, up to 23 factors, 3 levels each
171
- **L50(2^1 5^11)**: 50 runs, 1 factor with 2 levels + 11 factors with 5 levels
172
- **L54(2^1 3^25)**: 54 runs, 1 factor with 2 levels + 25 factors with 3 levels
173
- **L32(2^1 4^9)**: 32 runs, 1 factor with 2 levels + 9 factors with 4 levels
174
175
## Taguchi Methodology Workflow
176
177
### 1. Parameter Design Process
178
```python
179
# Step 1: Select orthogonal array based on factors and levels
180
available_arrays = pyDOE3.list_orthogonal_arrays()
181
182
# Step 2: Define factor levels
183
control_factors = [
184
[20, 25, 30], # Temperature
185
[1, 2, 3], # Speed
186
[0.1, 0.2, 0.3], # Feed rate
187
['A', 'B', 'C'] # Tool type
188
]
189
190
# Step 3: Generate experimental design
191
design = pyDOE3.taguchi_design("L9(3^4)", control_factors)
192
193
# Step 4: Run experiments and collect responses
194
# responses = run_experiments(design)
195
196
# Step 5: Calculate SNR for each run
197
# snr_values = [pyDOE3.compute_snr(response, objective) for response in responses]
198
```
199
200
### 2. Factor Effect Analysis
201
After collecting experimental data:
202
1. Calculate SNR for each experimental run
203
2. Compute average SNR for each factor level
204
3. Identify optimal factor settings (highest SNR)
205
4. Perform confirmation experiments
206
207
### 3. Design Selection Guidelines
208
209
**Array Selection Rules:**
210
- Choose array with sufficient factors and levels
211
- Minimize number of experiments while maintaining orthogonality
212
- Consider mixed-level arrays for different factor types
213
214
**Factor Assignment:**
215
- Assign most important factors to columns with highest priority
216
- Use interaction columns if interactions are expected
217
- Reserve some columns for potential interactions
218
219
## Types
220
221
```python { .api }
222
from typing import List, Literal
223
from enum import Enum
224
import numpy as np
225
226
# Orthogonal array names type
227
ORTHOGONAL_ARRAY_NAMES = Literal[
228
"L4(2^3)", "L8(2^7)", "L9(3^4)", "L12(2^11)", "L16(2^15)", "L16(4^5)",
229
"L18(6^1 3^6)", "L25(5^6)", "L27(2^1 3^12)", "L32(2^31)", "L32(2^1 4^9)",
230
"L36(3^23)", "L50(2^1 5^11)", "L54(2^1 3^25)", "L64(2^31)", "L64(4^21)", "L81(3^40)"
231
]
232
233
# Factor levels specification
234
FactorLevels = List[List]
235
236
# Design matrix type
237
Taguchi_Matrix = np.ndarray
238
239
class TaguchiObjective(Enum):
240
LARGER_IS_BETTER = "larger is better"
241
SMALLER_IS_BETTER = "smaller is better"
242
NOMINAL_IS_BEST = "nominal is best"
243
```
244
245
## Integration with Other Design Methods
246
247
Taguchi designs complement other experimental approaches:
248
249
- **Screening Phase**: Use Taguchi arrays for initial factor screening
250
- **Response Surface**: Follow up with RSM for optimization
251
- **Robust Design**: Combine with noise factors for comprehensive robustness
252
- **Sequential Experiments**: Use confirmation runs to validate optimal settings