Skip to main content

Framework for Optimal Extraction of Clusters

Project description

FOSC

A Python version of the Framework for optimal extraction of clusters (FOSC).

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_path with 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 usecols parameter.

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fosc-0.1.0a1.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fosc-0.1.0a1-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file fosc-0.1.0a1.tar.gz.

File metadata

  • Download URL: fosc-0.1.0a1.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for fosc-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 6e714b46598aac202593a72dbf76df162b1d7a0a1957693f244bcdfaf3d70ec3
MD5 65a633c10f8791cfcb15449bcc1cb103
BLAKE2b-256 0268f1419c0f488d76af7421c200cbcf4003966e12ba935e0e58fc8fe8a300d8

See more details on using hashes here.

File details

Details for the file fosc-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: fosc-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for fosc-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 50c8ea83056d3b03f44f769904c41b9e2eb319bb86a48e45420cdd232f214a20
MD5 f9e6f77c7369e69536b67125e210fd5c
BLAKE2b-256 bf6aa6dbc9e44e73c49e2538b7fed6a629a162556b23e57b991fca548f0f2c46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page