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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file svdclassifier-0.1.0.tar.gz.
File metadata
- Download URL: svdclassifier-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
238607b1ec73d48b8c81c03ef0914a9b6b8bf19046169fb9d82d014f81370d39
|
|
| MD5 |
e90321d8351eeb07f0fc22b4e7522da9
|
|
| BLAKE2b-256 |
9087f3c7d3c0053b501d1eaa3a71adadff1f10159511efa08fa20379bc8348e4
|
File details
Details for the file SVDClassifier-0.1.0-py3-none-any.whl.
File metadata
- Download URL: SVDClassifier-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6feb60797ca27adf53155b2dce1795644511e4cd9ea61109bf5531704ccfd3ca
|
|
| MD5 |
3484998516aa8a5a40a5525f1173b447
|
|
| BLAKE2b-256 |
89378e616e11dafe8786b148a5b5236b496708a11bfd1794dbbd980bf262037d
|