Skip to content

neurostatx.cli.FuzzyClustering

Attributes

NameDescription
appCyclopts application for the FuzzyClustering command-line tool.

Functions

NameDescription
FuzzyClusteringWrap Fuzzy C-Means clustering over k=2 to k.

appattributemodule attribute#

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

Cyclopts application for the FuzzyClustering command-line tool.

FuzzyClusteringfunction#

def FuzzyClustering(in_dataset: 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')], k: Annotated[int, Parameter(show_default=True, group='Clustering Options')] = 10, 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, init: Annotated[str, Parameter(show_default=True, group='Clustering Options')] = None, metric: Annotated[DistanceMetrics, Parameter(show_default=True, group='Clustering Options')] = DistanceMetrics.euclidean, pca: Annotated[bool, Parameter(--pca, show_default=True, group='Clustering Options')] = False, out_folder: Annotated[str, Parameter(group='Essential Files Options')] = './fuzzy_results/', processes: Annotated[int, Parameter(show_default=True, group='Computational Options')] = 1, 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)

Wrap Fuzzy C-Means clustering over k=2 to k.

FuzzyClustering runs the analysis for each cluster count up to –k and writes evaluation metrics plus summary barplots and parallel plots.

Parameters

NameTypeDefaultDescription
in_datasetstrrequiredInput dataset.
id_columnstrrequiredName of the column containing the subject’s ID tag. Required for proper handling of IDs and merging multiple datasets.
desc_columnsintrequiredNumber of descriptive columns at the beginning of the dataset to exclude in statistics and descriptive tables.
kint10Maximum k number of clusters to fit a model for. The script iterates until k is met. Defaults to 10.
mfloat2Exponentiation value to apply on the membership function. Determines the degree of fuzziness of the membership matrix. Defaults to 2.
errorfloat1e-06Error threshold for convergence stopping criterion. Defaults to 1e-6.
maxiterint1000Maximum number of iterations to perform. Defaults to 1000.
initstrNoneInitial fuzzy c-partitioned matrix. Defaults to None.
metricDistanceMetricsDistanceMetrics.euclideanMetric to use to compute distance between original points and cluster centroids. Defaults to euclidean.
pcaboolFalseIf set, will perform PCA decomposition to 2 components before clustering. Defaults to False.
out_folderstr'./fuzzy_results/'Path of the folder in which the results will be written. If not specified, current folder and default name will be used. Defaults to ./fuzzy_results/.
processesint1Number of processes to launch in parallel. Defaults to 1.
parallelplotboolFalseIf true, will output a parallel plot for each cluster solution. Defaults to False.
radarplotboolTrueIf true, will output a radar plot for each cluster solution. Defaults to True.
cmapstr'magma'Colormap to use for plotting. Defaults to magma. See https://matplotlib.org/stable/tutorials/colors/colormaps.html.
verboseboolFalseIf true, produce verbose output. Defaults to False.
save_parametersboolFalseIf true, will save input parameters to .txt file. Defaults to False.
overwriteboolFalseIf true, force overwriting of existing output files. Defaults to False.

Examples

Terminal window
FuzzyClustering --in-dataset dataset.csv --id-column ID --desc-columns
1 --k 10 --m 2 --error 1e-6 --maxiter 1000 --init init_folder --metric
euclidean --pca --out-folder ./fuzzy_results/ --processes 4 --verbose