Skip to main content

Generative Topographic Mapping and Analysis Toolkit

Introduction

The Generative Topographic Mapping and Analysis Toolkit is a Python package designed for high-dimensional data analysis using Generative Topographic Mapping (GTM). This toolkit facilitates the visualization of high-dimensional datasets in lower-dimensional spaces, supports both forward and inverse mappings, and offers comprehensive tools for model fitting, dimensionality reduction, error analysis, and hyperparameter optimization. It is particularly useful for researchers and practitioners in machine learning, data science, and bioinformatics.

Features

  • GTM model fitting for dimensionality reduction and data visualization.
  • k-nearest neighbor normalized error (k3n-error) calculation for error analysis.
  • Cross-validation based hyperparameter optimization for GTM models.
  • Support for both forward analysis (regression) and inverse analysis.
  • Visualization tools for low-dimensional embeddings of high-dimensional data.

Installation

To install the GTMAnalysisToolkit, run the following command in your terminal:

pip install GTMAnalysisToolkit

Ensure you have Python 3.x installed on your system. This package depends on numpy, scipy, matplotlib, and sklearn, which will be automatically installed during the GTMAnalysisToolkit installation.

Quick Start

Here's a quick example to get you started with using the GTMAnalysisToolkit:

import matplotlib.figure as figure
import matplotlib.pyplot as plt
from GTMAnalysisToolkit import GTM
from sklearn.datasets import load_iris

# settings
shape_of_map = [10, 10]
shape_of_rbf_centers = [5, 5]
variance_of_rbfs = 4
lambda_in_em_algorithm = 0.001
number_of_iterations = 300
display_flag = 1

# load an iris dataset
iris = load_iris()
# input_dataset = pd.DataFrame(iris.data, columns=iris.feature_names)
input_dataset = iris.data
color = iris.target

# autoscaling
input_dataset = (input_dataset - input_dataset.mean(axis=0)) / input_dataset.std(axis=0, ddof=1)

# construct GTM model
model = GTM(shape_of_map, shape_of_rbf_centers, variance_of_rbfs, lambda_in_em_algorithm, number_of_iterations,
            display_flag)
model.fit(input_dataset)

if model.success_flag:
    # calculate of responsibilities
    responsibilities = model.responsibility(input_dataset)

    # plot the mean of responsibilities
    means = responsibilities.dot(model.map_grids)
    plt.figure(figsize=figure.figaspect(1))
    plt.scatter(means[:, 0], means[:, 1], c=color)
    plt.ylim(-1.1, 1.1)
    plt.xlim(-1.1, 1.1)
    plt.xlabel("z1 (mean)")
    plt.ylabel("z2 (mean)")
    plt.show()

    # plot the mode of responsibilities
    modes = model.map_grids[responsibilities.argmax(axis=1), :]
    plt.figure(figsize=figure.figaspect(1))
    plt.scatter(modes[:, 0], modes[:, 1], c=color)
    plt.ylim(-1.1, 1.1)
    plt.xlim(-1.1, 1.1)
    plt.xlabel("z1 (mode)")
    plt.ylabel("z2 (mode)")
    plt.show()

License

This project is licensed under the GNU General Public License version 3 (GPL-3.0) - see the LICENSE file for details.

Contributing

We welcome contributions to the GTMAnalysisToolkit! If you have suggestions or want to contribute code, please feel free to open an issue or pull request on our GitHub repository.

Contact

For questions or support, please contact Eng. Alberto Biscalchin at biscalchin.mau.se@gmail.com

Release files for GTMAnalysisToolkit 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GTMAnalysisToolkit 1.0.2
File Size Uploaded
GTMAnalysisToolkit-1.0.2.tar.gz 26.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for GTMAnalysisToolkit 1.0.2
File Interpreter ABI Platform
GTMAnalysisToolkit-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 51.2 kB

Release files / GTMAnalysisToolkit-1.0.2.tar.gz

Download URL GTMAnalysisToolkit-1.0.2.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2f723735c3ef9dd19a6e371cc2a1570635e6798735872ea35a0e5dbcd1916072
BLAKE2b-256 checksum
How to use checksums
9f8887264ee16bb07b636e06ae8ebe952aae2e950a0529445e25c3a8b211387c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / GTMAnalysisToolkit-1.0.2-py3-none-any.whl

Download URL GTMAnalysisToolkit-1.0.2-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f64b93a435da5ef12a1f3b0d55bfc8817efb5e8887bef1c5152c1905e377d88
BLAKE2b-256 checksum
How to use checksums
42cc55966bd55bc5c852ddeb153a2a37ef842bb9ebc587e3c48c6b6731bf8c98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page