# neurostatx.cli.PredictFuzzyMembership

*module*

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/cli/PredictFuzzyMembership.py#L1-L1)

## neurostatx.cli.PredictFuzzyMembership.app

*attribute* · *module attribute*

```python
app = App(default_parameter=Parameter(negative=()))
```

Cyclopts application for the PredictFuzzyMembership command-line tool.

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/cli/PredictFuzzyMembership.py#L25-L25)

## neurostatx.cli.PredictFuzzyMembership.PredictFuzzyMembership

*function*

```python
def PredictFuzzyMembership(in_dataset: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], in_cntr: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], id_column: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], desc_columns: Annotated[int, Parameter(show_default=False, group='Essential Files Options')], out_folder: Annotated[str, Parameter(show_default=False, group='Essential Files Options')] = './output/', m: Annotated[float, Parameter(show_default=True, group='Clustering Options')] = 2, error: Annotated[float, Parameter(show_default=True, group='Clustering Options')] = 1e-06, maxiter: Annotated[int, Parameter(show_default=True, group='Clustering Options')] = 1000, metric: Annotated[DistanceMetrics, Parameter(show_default=True, group='Clustering Options')] = DistanceMetrics.euclidean, pca: Annotated[bool, Parameter(--pca, show_default=True, group='Clustering Options')] = False, pca_model: Annotated[str, Parameter(show_default=True, group='Clustering Options')] = None, parallelplot: Annotated[bool, Parameter(show_default=True, group='Visualization Options')] = False, radarplot: Annotated[bool, Parameter(show_default=True, group='Visualization Options')] = True, cmap: Annotated[str, Parameter(show_default=True, group='Visualization Options')] = 'magma', verbose: Annotated[bool, Parameter(-v, --verbose, group='Optional parameters')] = False, save_parameters: Annotated[bool, Parameter(-s, --save_parameters, group='Optional parameters')] = False, overwrite: Annotated[bool, Parameter(-f, --overwrite, group='Optional parameters')] = False)
```

Predict fuzzy membership from trained C-Means centroids.

Only the centroids from a trained model are required for the prediction.

> **Notes**
>
> **Fuzziness**
> 
> The --m parameter defines the degree of fuzziness of the resulting
> membership matrix. Using --m 1 returns crisp clusters, whereas --m > 1
> returns increasingly fuzzy clusters. Use the same m value as during
> training.

**Parameters**

- `in_dataset` (`str`) — Input dataset.
- `in_cntr` (`str`) — Centroid file to use for prediction. Should come from a trained C-Means model such as [FuzzyClustering][neurostatx.cli.FuzzyClustering.FuzzyClustering].
- `id_column` (`str`) — Name of the column containing the subject's ID tag. Required for proper handling of IDs and merging multiple datasets.
- `desc_columns` (`int`) — Number of descriptive columns at the beginning of the dataset to exclude in statistics and descriptive tables.
- `out_folder` (`str`) (default: `'./output/'`) — Output folder for the predicted membership matrix. Defaults to ``./output/``.
- `m` (`float`) (default: `2`) — Exponentiation value to apply on the membership function. Determines the degree of fuzziness of the membership matrix. Defaults to 2.
- `error` (`float`) (default: `1e-06`) — Error threshold for convergence stopping criterion. Defaults to 1e-6.
- `maxiter` (`int`) (default: `1000`) — Maximum number of iterations to perform. Defaults to 1000.
- `metric` (`DistanceMetrics`) (default: `DistanceMetrics.euclidean`) — Metric to use to compute distance between original points and cluster centroids. Defaults to euclidean.
- `pca` (`bool`) (default: `False`) — If set, will perform PCA decomposition to 3 components before clustering. Defaults to False.
- `pca_model` (`str`) (default: `None`) — If set, will load a pre-trained PCA model to apply on the dataset. Defaults to None.
- `parallelplot` (`bool`) (default: `False`) — If true, will output a parallel plot for each cluster solution. Defaults to False.
- `radarplot` (`bool`) (default: `True`) — If true, will output a radar plot for each cluster solution. Defaults to True.
- `cmap` (`str`) (default: `'magma'`) — Colormap to use for plotting. Defaults to ``magma``. See Matplotlib (https://matplotlib.org/stable/tutorials/colors/colormaps.html).
- `verbose` (`bool`) (default: `False`) — If true, produce verbose output. Defaults to False.
- `save_parameters` (`bool`) (default: `False`) — If true, will save input parameters to .txt file. Defaults to False.
- `overwrite` (`bool`) (default: `False`) — If true, force overwriting of existing output files. Defaults to False.

**Examples**

```bash
PredictFuzzyMembership --in_dataset dataset.xlsx --in_cntr
centroids.xlsx --id_column ID --desc_columns 1 --out_folder
predicted_membership_matrix/ --m 2 --error 1e-6 --maxiter 1000
--metric euclidean --verbose --save_parameters --overwrite
```

[View source](https://github.com/gagnonanthony/NeuroStatX/blob/main/neurostatx/cli/PredictFuzzyMembership.py#L29-L358)
