Skip to main content

The SVD Classifier Package

Project description

SVDClassifier

This package provides the implementation for the SVD-based classifier developed in the Autonomous Agent Learning Lab at Connecticut College. This classifier is designed to be used with Evolutionary Strategies such as CMA-ES, Open-ES, and others due to it's reduced number of weights compared to a traditional convolutional neural network.

Installation

To install SVDC, use pip:

pip install SVDClassifier

Usage Example

The following is a simple example of using the SVDC classifier on a toy input:

from  SVDC.SVDC  import  SVDC
import  numpy  as  np
# Example weight vector, if the length is wrong the correct length will be returned as an error
weights = [0.1] * 111
# Example 5x5 input
sensor_input_sample = np.random.rand(5, 5)
# Create the SVDC Classifier, weight sizes are calculated for you based on the input sample
model = SVDC(weights, output_size=4, layer_count=1, sensor_input_sample=sensor_input_sample)
# Run forward pass on example input
output = model.forward(sensor_input_sample)
print("Output:", output)

The SVDC classifier can be optimized with CMA-ES by the following:

from SVDC.SVDC_CMA import SVDC_CMA
# Define fitnesss function
def fit_func(): ...
# Define the optimizer
optimizer = SVDC_CMA(
    starting_weights=starting_weights,
    output_size=desired_output_size,
    SVDC_layers=number_of_layers,
    fitness_function=fit_func,
    generations=total_generations_count,
    log_folder=folder_for_logs,
)
# Then run the optmizer and save the best result
result = optimizer.train(sample_input)

A more detailed example can be found in the examples folder.

License

This project is licensed under the MIT License. View the license in LICENSE.md

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

svdclassifier-0.1.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

SVDClassifier-0.1.1-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file svdclassifier-0.1.1.tar.gz.

File metadata

  • Download URL: svdclassifier-0.1.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.0

File hashes

Hashes for svdclassifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 05da4ff7a27dd46a651aaebf4ab690b01a00151bf26abc531e3e957ffde2dcad
MD5 efac47f58b2ee1f0cdbad3550c113a2c
BLAKE2b-256 89a50735e2cb7125174366c59f82b07ad514c1af5607fe2f5c18bee4e9615de8

See more details on using hashes here.

File details

Details for the file SVDClassifier-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: SVDClassifier-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.0

File hashes

Hashes for SVDClassifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66aeace7a7bda57e5e8f11e1fda789ab502c803dd66a1ffbf38e9760cd0001eb
MD5 3ee9898834ef70dc6aece0911365efee
BLAKE2b-256 ca97701cad4663560cf6f11efa450e09af5226e56120402aa8733e7f116be20b

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