Framework for Optimal Extraction of Clusters
Project description
FOSC
A Python version of the Framework for optimal extraction of clusters (FOSC) (CAMPELLO et al., 2013) [1].
Note: This is a test version and may contain bugs. If you notice anything wrong, please contact the developers.
Quick Start Tutorial
This is a tutorial that teaches how to quickly start using the FOSC package.
Considering you have a dataset in a CSV file, start by loading its data.
import numpy as np
mat = np.genfromtxt(file_path, dtype=float, delimiter=',', usecols=range(0, -1), missing_values=np.nan)
Note:
Replace
file_pathwith your dataset's path.In this example, the last column represents the cluster to which an object is assigned, according to another algorithm. Since we are using our own method, we ignore the last column with the
usecolsparameter.
Choose the MClSize (minimum cluster size) parameter and the method of linkage:
mclsize = 30
linkage_method = "single"
Calculate the distance matrix:
from scipy.spatial import distance_matrix
dist_mat = distance_matrix(mat, mat, p=2)
Now, you can instantiate the FOSC object:
from FOSC import FOSC
foscFramework = FOSC(dist_mat, linkage_method, mclsize)
And run the FOSC algorithm:
infiniteStability = foscFramework.propagateTree()
partition, lastObjects = foscFramework.findProminentClusters(1, infiniteStability)
The partition returned from the findProminentClusters method is the result of running the FOSC algorithm, i.e., the cluster extraction.
Finally, you can visualize the results using the functions available in the Plot module:
from FOSC import Plot
Plot.plotDendrogram(foscFramework)
Plot.plotSilhouette(foscFramework, partition)
Plot.plotReachability(foscFramework, partition)
References
[1] CAMPELLO, R. J.; MOULAVI, D.; ZIMEK, A.; SANDER, J. A framework for semi-supervised and unsupervised optimal extraction of clusters from hierarchies. Data Mining and Knowledge Discovery, Springer, v. 27, p. 344–371, 2013.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fosc-0.1.1a1.tar.gz.
File metadata
- Download URL: fosc-0.1.1a1.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ab2441c9ac61ce32c46b386c4d1271e6ffe19aacb636798405e2d4848e812e6
|
|
| MD5 |
19976926f586f734188c90d701ebaddb
|
|
| BLAKE2b-256 |
62c61cdab813d5455757d4fcc775d9509efa73750bf56760225c0b48ad9635b3
|
File details
Details for the file fosc-0.1.1a1-py3-none-any.whl.
File metadata
- Download URL: fosc-0.1.1a1-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce165d435e3a0fca49d820038f92d16854b1956d0684332c47343547ba34bcb2
|
|
| MD5 |
12af208d8952e14d007436f06754e3ab
|
|
| BLAKE2b-256 |
91efdb4d27e26e618cddebe87f66df41ff0ffe2db2da8f86c1171d1b3a504bec
|