# Specification: Type-1 vs Interval Type-2 Fuzzy Systems

## 1. Research Objective

Compare a Type-1 Takagi–Sugeno–Kang (TSK) fuzzy inference system with an Interval Type-2 TSK system under increasing levels of input noise.

The primary metric is Root Mean Squared Error (RMSE). Lower RMSE indicates better predictions.

## 2. Type-1 Fuzzy System

For input feature \(x_j\), rule \(k\) has a Gaussian membership function:

\[
\mu_{kj}(x_j)=
\exp\left(-\frac{(x_j-m_{kj})^2}{2\sigma_{kj}^2}\right)
\]

The firing strength of rule \(k\) is:

\[
f_k=\prod_j\mu_{kj}(x_j)
\]

The rule's linear consequent is:

\[
g_k(x)=a_{k0}+\sum_j a_{kj}x_j
\]

The final prediction is:

\[
y=\frac{\sum_k f_k g_k(x)}{\sum_k f_k}
\]

## 3. Interval Type-2 Fuzzy System

Use the same Gaussian mean for the lower and upper membership functions.

Define the uncertain standard deviations as:

\[
\sigma_{\mathrm{lo}}=\sigma(1-\delta)
\]

\[
\sigma_{\mathrm{hi}}=\sigma(1+\delta)
\]

where \(0\leq\delta<1\).

The lower and upper firing strengths are calculated using the product of their respective membership values:

\[
f_{\mathrm{lo},k}=\prod_j\mu_{\mathrm{lo},kj}(x_j)
\]

\[
f_{\mathrm{hi},k}=\prod_j\mu_{\mathrm{hi},kj}(x_j)
\]

Use the Nie–Tan output method:

\[
y=\frac{\sum_k(f_{\mathrm{lo},k}+f_{\mathrm{hi},k})g_k(x)}
{\sum_k(f_{\mathrm{lo},k}+f_{\mathrm{hi},k})}
\]

Both systems must use the same consequent-fitting procedure.

## 4. Training Procedure

1. Standardize features using training data only.
2. Initialize rule centers using k-means.
3. Estimate Gaussian spreads from training clusters.
4. Fit the linear consequents using least squares.
5. Select hyperparameters using validation data only.
6. Keep the final test data separate from all tuning decisions.

The Type-1 and Type-2 systems must receive comparable tuning budgets.

## 5. Experiment

Train on clean data and evaluate on clean and noisy test inputs.

Use noise levels:

alpha = [0, 0.1, 0.2, 0.3, 0.5]

For each feature \(j\), generate noise as:

\[
x_{\mathrm{noisy},j}=x_j+\epsilon_j
\]

where:

\[
\epsilon_j\sim\mathcal{N}(0,(\alpha\,s_j)^2)
\]

Here, \(s_j\) is the feature's standard deviation estimated from training data.

Evaluate using 10 reproducible random seeds and report RMSE.

Compare paired Type-1 and Type-2 RMSE results using the Wilcoxon signed-rank test at each noise level.

## 6. Required Correctness Tests

- When delta equals zero, Type-1 and Type-2 predictions must agree within numerical tolerance, provided they share the same means, spreads, rules, and consequents.
- Lower firing strengths must not exceed upper firing strengths.
- Normalized rule weights must sum to one.
- Predictions must be finite, including in numerically difficult cases.
- Results must be reproducible using fixed random seeds.

## 7. Required Outputs

- RMSE-versus-noise plot for both systems.
- Footprint of Uncertainty (FOU) visualization for one input feature.
- Sensitivity plot showing RMSE versus delta at a selected noise level.
- CSV files containing experimental results.
- A README documenting methods, results, and limitations.

Do not invent experimental results. Report only results produced by the implementation.
