Skip to main content

A Python library for Adaptive Resonance Theory (ART) algorithms.

Project description

AdaptiveResonanceLib

Welcome to AdaptiveResonanceLib, a comprehensive and modular Python library for Adaptive Resonance Theory (ART) algorithms. Based on scikit-learn, our library offers a wide range of ART models designed for both researchers and practitioners in the field of machine learning and neural networks. Whether you're working on classification, clustering, or pattern recognition, AdaptiveResonanceLib provides the tools you need to implement ART algorithms efficiently and effectively.

Available Models

AdaptiveResonanceLib includes implementations for the following ART models:

Comparison of Elementary Models

Comparison of Elementary Images

Installation

To install AdaptiveResonanceLib, simply use pip:

pip install artlib

Or to install directly from the most recent source:

pip install git+https://github.com/NiklasMelton/AdaptiveResonanceLib.git@develop

Ensure you have Python 3.9 or newer installed.

Quick Start

Here are some quick examples to get you started with AdaptiveResonanceLib:

Clustering Data with the Fuzzy ART model

from artlib import FuzzyART
import numpy as np

# Your dataset
train_X = np.array([...]) # shape (n_samples, n_features)
test_X = np.array([...])

# Initialize the Fuzzy ART model
model = FuzzyART(rho=0.7, alpha = 0.0, beta=1.0)

# Prepare Data
train_X_prep = model.prepare_data(train_X)
test_X_prep = model.prepare_data(test_X)

# Fit the model
model.fit(train_X_prep)

# Predict data labels
predictions = model.predict(test_X_prep)

Fitting a Classification Model with SimpleARTMAP

from artlib import GaussianART, SimpleARTMAP
import numpy as np

# Your dataset
train_X = np.array([...]) # shape (n_samples, n_features)
train_y = np.array([...]) # shape (n_samples, ), must be integers
test_X = np.array([...])

# Initialize the Gaussian ART model
sigma_init = np.array([0.5]*train_X.shape[1]) # variance estimate for each feature
module_a = GaussianART(rho=0.0, sigma_init=sigma_init)

# Initialize the SimpleARTMAP model
model = SimpleARTMAP(module_a=module_a)

# Prepare Data
train_X_prep = model.prepare_data(train_X)
test_X_prep = model.prepare_data(test_X)

# Fit the model
model.fit(train_X_prep, train_y)

# Predict data labels
predictions = model.predict(test_X_prep)

Fitting a Regression Model with FusionART

from artlib import FuzzyART, HypersphereART, FusionART
import numpy as np

# Your dataset
train_X = np.array([...]) # shape (n_samples, n_features_X)
train_y = np.array([...]) # shape (n_samples, n_features_y)
test_X = np.array([...])

# Initialize the Fuzzy ART model
module_x = FuzzyART(rho=0.0, alpha = 0.0, beta=1.0)

# Initialize the Hypersphere ART model
r_hat = 0.5*np.sqrt(train_X.shape[1]) # no restriction on hyperpshere size
module_y = HypersphereART(rho=0.0, alpha = 0.0, beta=1.0, r_hat=r_hat)

# Initialize the FusionARTMAP model
gamma_values = [0.5, 0.5] # eqaul weight to both channels
channel_dims = [
  2*train_X.shape[1], # fuzzy ART complement codes data so channel dim is 2*n_features
  train_y.shape[1]
]
model = FusionART(
  modules=[module_x, module_y],
  gamma_values=gamma_values,
  channel_dims=channel_dims
)

# Prepare Data
train_Xy = model.join_channel_data(channel_data=[train_X, train_y])
train_Xy_prep = model.prepare_data(train_Xy)
test_Xy = model.join_channel_data(channel_data=[train_X], skip_channels=[1])
test_Xy_prep = model.prepare_data(test_Xy)

# Fit the model
model.fit(train_X_prep, train_y)

# Predict y-channel values
pred_y = model.predict_regression(test_Xy_prep, target_channels=[1])

Documentation

For more detailed documentation, including the full list of parameters for each model, visit our Read the Docs page.

Examples

For examples of how to use each model in AdaptiveResonanceLib, check out the /examples directory in our repository.

Contributing

We welcome contributions to AdaptiveResonanceLib! If you have suggestions for improvements, or if you'd like to add more ART models, please see our CONTRIBUTING.md file for guidelines on how to contribute.

You can also join our Discord server and participate directly in the discussion.

License

AdaptiveResonanceLib is open source and available under the MIT license. See the LICENSE file for more info.

Contact

For questions and support, please open an issue in the GitHub issue tracker or message us on our Discord server. We'll do our best to assist you.

Happy Modeling with AdaptiveResonanceLib!

Citing this Repository

If you use this project in your research, please cite it as:

Melton, N. (2024). AdaptiveResonanceLib (Version 0.1.3)

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

artlib-0.1.3.tar.gz (59.9 kB view details)

Uploaded Source

Built Distribution

artlib-0.1.3-py3-none-any.whl (85.9 kB view details)

Uploaded Python 3

File details

Details for the file artlib-0.1.3.tar.gz.

File metadata

  • Download URL: artlib-0.1.3.tar.gz
  • Upload date:
  • Size: 59.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for artlib-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ede97ff740b7ed13b4066f50c6b557f85fe2d11bc163c0153f09170fa6afb7a1
MD5 0c8f569c0dfe1f25b814d43ea8ffb01a
BLAKE2b-256 7a35dc9aa8e8bcbb2686f649179fb5ef18a40b3ec714b77804a089357f897e34

See more details on using hashes here.

File details

Details for the file artlib-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: artlib-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 85.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for artlib-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 de3756eb7d93e4e51ed8edde79a61134cfa3d135729a1dcf5dedcd2c3c9e43b5
MD5 aa8684cae686cbfe30bb9c57107f2147
BLAKE2b-256 f7c519de330a786a5b830c57fec0955b2c40b856a31b886145e5f362194ab83e

See more details on using hashes here.

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