Skip to main content

Generative Topographic Mapping and Analysis Toolkit

Project description

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

Not available yet on pipy, follows for more info in the future

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()

Documentation

WORK IN PROGRESS

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

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

GTMAnalysisToolkit-1.0.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

GTMAnalysisToolkit-1.0.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file GTMAnalysisToolkit-1.0.0.tar.gz.

File metadata

  • Download URL: GTMAnalysisToolkit-1.0.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for GTMAnalysisToolkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 030f29b1f8f388c03dcd3c68e3bc5437abeaf751c274d297d43d0e08a9c2371a
MD5 caf15f7db7cf1798bb6ea29beb81d63b
BLAKE2b-256 2ff7fa54a302359dc058e19fcb557ccf0abe531a73db969ce212cde41d07e011

See more details on using hashes here.

File details

Details for the file GTMAnalysisToolkit-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for GTMAnalysisToolkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c5728dc9d6801d899b53349587e5dcaf2526b860816aa9b46bc1c8b55e9186
MD5 b69af800bef52393d29bbb23aee9d0d6
BLAKE2b-256 d32523b401a1d903e4270c67be87572fe147eed30ca639e74a74a94654df90db

See more details on using hashes here.

Supported by

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