Skip to main content

Simultaneous Component and Clustering Models for Three-way Data: Within and Between Approaches.

Project description

python-simuclustfactor

Perform simultaneous clustering and factor decomposition in Python for three-mode datasets, a library utility.

The main use cases of the library are:

  • performing tandem clustering and factor-decomposition procedures sequentially (TWCFTA).
  • performing tandem factor-decomposition and clustering procedures sequentially (TWFCTA).
  • performing the clustering and factor decomposition procedures simultaneously (T3Clus).
  • performing factor-decomposition and clustering procedures simultaneously (3FKMeans).
  • performing combined T3Clus and 3FKMeans procedures simultaneously (CT3Clus).

Installation

To install the Python library, run:

pip install simuclustfactor

You may consider installing the library only for the current user:

pip install simuclustfactor --user

Library usage

The package provides just two main modules namely,

  • tandem: encapsulating TWCFTA and TWFCTA
  • simultaneous: encapsulating T3Clus, TFKMeans and CT3Clus
>>> import numpy as np
>>> from simuclustfactor import tandem
>>> from simuclustfactor import simultaneous
>>> from sklearn.datasets import make_blobs

>>> I,J,K = 40,15,20  # dimensions in the full space.
>>> G,Q,R = 8,4,3  # tensor dimensions in reduced space.  
>>> X_i_jk, y = make_blobs(n_samples=I, centers=G, n_features=J*K, random_state=0)  # generate dataset

>>> twcfta = tandem.TWCFTA(random_state=0,verbose=True, n_max_iter=10).fit(X_i_jk, full_tensor_shape=(I,J,K), reduced_tensor_shape=(G,Q,R))

>>> twfcta = tandem.TWFCTA(random_state=0,verbose=True, n_max_iter=10).fit(X_i_jk, full_tensor_shape=(I,J,K), reduced_tensor_shape=(G,Q,R))

>>> t3clus = simultaneous.T3Clus(random_state=0, init='random', verbose=True, n_max_iter=10).fit(X_i_jk, full_tensor_shape=(I,J,K), reduced_tensor_shape=(G,Q,R))

>>> tfkmeans = simultaneous.TFKMeans(random_state=0, init='random', verbose=True, n_max_iter=10).fit(X_i_jk, full_tensor_shape=(I,J,K), reduced_tensor_shape=(G,Q,R))

>>> tfkmeans_1 = simultaneous.CT3Clus(random_state=0, init='random', verbose=True, n_max_iter=10).fit(X_i_jk, full_tensor_shape=(I,J,K), reduced_tensor_shape=(G,Q,R), alpha=0)

>>> t3clus_1 = simultaneous.CT3Clus(random_state=0, init='random', verbose=True, n_max_iter=10).fit(X_i_jk, full_tensor_shape=(I,J,K), reduced_tensor_shape=(G,Q,R), alpha=1)

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

simuclustfactor-0.0.2.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

simuclustfactor-0.0.2-py3-none-any.whl (2.2 kB view hashes)

Uploaded Python 3

Supported by

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