Reservoir computing benchmark toolkit
Project description
RCbench - Reservoir Computing Benchmark Toolkit
RCbench (Reservoir Computing Benchmark Toolkit) is a comprehensive Python package for evaluating and benchmarking reservoir computing systems. It provides standardized tasks, flexible visualization tools, and efficient evaluation methods for both physical and simulated reservoirs.
๐ Features
RCbench provides:
-Multiple Benchmark Tasks: -NLT (Nonlinear Transformation): Evaluate reservoir performance on standard nonlinear transformations -NARMA: Test with Nonlinear Auto-Regressive Moving Average models of different orders -Memory Capacity: Measure the short and long-term memory capabilities -Sin(x): Assess reservoir ability to transform a random signal into a nonlinear function that use the input as argument -KernelRank: Evaluates the nonlinearityof the reservoir -GeneralizationRank: Evaluates the generalization capabilities of the reservoir
-Advanced Visualization: -Task-specific plotters with customizable configurations -General reservoir properties visualization (input signals, output responses, nonlinearity) -Frequency domain analysis of reservoir behavior -Target vs. prediction comparison with proper time alignment
-Efficient Data Handling: -Automatic measurement loading and parsing -Support for various experimental data formats -Feature selection and dimensionality reduction tools
๐ Project Structure
RCbench/
โโโ rcbench/
| |โโ examples/ # Example scripts
| | โโโ example_nlt.py
| | โโโ example_NARMA.py
| | โโโ example_sinx.py
| | โโโ example_MC.py
โ โโโ measurements/ # Data handling
โ โ โโโ dataset.py # ReservoirDataset class
โ โ โโโ loader.py # Data loading utilities
โ โ โโโ parser.py # Data parsing utilities
โ โโโ tasks/ # Reservoir computing tasks
โ โ โโโ baseevaluator.py # Base evaluation methods
โ โ โโโ nlt.py # Nonlinear Transformation
โ โ โโโ narma.py # NARMA tasks
โ โ โโโ memorycapacity.py # Memory Capacity
โ โ โโโ sinx.py # Sin(x) approximation
โ โ โโโ featureselector.py # Feature selection tools
โ โโโ visualization/ # Plotting utilities
โ โ โโโ base_plotter.py # Base plotting functionality
โ โ โโโ plot_config.py # Plot configurations
โ โ โโโ nlt_plotter.py # NLT visualization
โ โ โโโ narma_plotter.py # NARMA visualization
โ โ โโโ sinx_plotter.py # Sin(x) visualization
โ โโโ logger.py # Logging utilities
โ
๐ง Installation
Install directly from GitHub:
pip install rcbench
Or, install locally (development mode):
git clone https://github.com/nanotechdave/RCbench.git
cd RCbench
pip install -e .
๐ฆ Usage Example
Here's a quick example demonstrating how to perform an NLT evaluation:
import logging
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from rcbench import ReservoirDataset
from rcbench import NltEvaluator
from rcbench.visualization.plot_config import NLTPlotConfig
from rcbench.logger import get_logger
logger = get_logger(__name__)
logger.setLevel(logging.INFO)
BASE_DIR = "FILE_PATH"
filenameNLT = "YOUR_FILENAME"
measurement_file_NLT = BASE_DIR / filenameNLT
# Load the data directly using the ReservoirDataset class
dataset = ReservoirDataset(measurement_file_NLT)
# Get information about the electrodes
electrodes_info = dataset.summary()
logger.info(f"Parsed Electrodes: {electrodes_info}")
# Get input and node voltages directly from the dataset
input_elec = electrodes_info['input_electrodes'][0]
input_signal = dataset.get_input_voltages()[input_elec]
time = dataset.time
# Get node voltages (only node electrodes, not input)
nodes_output = dataset.get_node_voltages()
electrode_names = electrodes_info['node_electrodes']
# Create NLT plot configuration
plot_config = NLTPlotConfig(
save_dir=None, # Save plots to this directory
# General reservoir property plots
plot_input_signal=True, # Plot the input signal
plot_output_responses=True, # Plot node responses
plot_nonlinearity=True, # Plot nonlinearity of nodes
plot_frequency_analysis=True, # Plot frequency analysis
# Target-specific plots
plot_target_prediction=True, # Plot target vs prediction results
# Plot styling options
nonlinearity_plot_style='scatter',
frequency_range=(0, 20) # Limit frequency range to 0-20 Hz for clearer visualization
)
# Run NLT evaluation with plot config
evaluatorNLT = NltEvaluator(
input_signal=input_signal,
nodes_output=nodes_output,
time_array=time,
waveform_type='sine',
electrode_names=electrode_names,
plot_config=plot_config
)
resultsNLT = {}
for target_name in evaluatorNLT.targets:
try:
result = evaluatorNLT.run_evaluation(
target_name=target_name,
metric='NMSE',
feature_selection_method='pca',
num_features='all',
model="Ridge",
regression_alpha=0.01,
train_ratio=0.8,
plot=False, # Don't plot during evaluation
)
resultsNLT[target_name] = result
# Print results clearly
logger.output(f"NLT Analysis for Target: '{target_name}'")
logger.output(f" - Metric: {result['metric']}")
logger.output(f" - Accuracy: {result['accuracy']:.5f}")
logger.output(f" - Selected Features Indices: {[electrode_names[i] for i in result['selected_features']]}")
logger.output(f" - Model Weights: {result['model'].coef_}\n")
except Exception as e:
logger.error(f"Error evaluating {target_name}: {str(e)}")
evaluatorNLT.plot_results(existing_results=resultsNLT)
๐ Visualization Tools
RCbench features a unified visualization system with: -Task-Specific Plotters: Dedicated plotters for each task (NLTPlotter, NarmaPlotter, SinxPlotter) -Customizable Configurations: Control which plots to generate through configuration objects -Comprehensive Visualization: For each task, view: -General reservoir properties (input signals, node responses, nonlinearity) -Frequency domain analysis -Target vs. prediction comparisons
๐ Contributions & Issues
Contributions are welcome! Please open a pull request or an issue on GitHub.
-
Issue Tracker: https://github.com/nanotechdave/RCbench/issues
-
Pull Requests: https://github.com/nanotechdave/RCbench/pulls
๐ License
RCbench is licensed under the MIT License. See the LICENSE file for details.
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 rcbench-0.1.0.tar.gz.
File metadata
- Download URL: rcbench-0.1.0.tar.gz
- Upload date:
- Size: 42.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e9d0897f44f4d16b980d8470e8ff333e5fbba1916e01ca98c354596495340f4
|
|
| MD5 |
0e8ea1f0e248803bf9e3c50634e612d6
|
|
| BLAKE2b-256 |
daeb98a58747f9f3dcf03f0ca223addbdacd55b617c05df60ff7f7a99b3b3a46
|
File details
Details for the file rcbench-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rcbench-0.1.0-py3-none-any.whl
- Upload date:
- Size: 49.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01473e531e17dd74c49198853311d267cdab4a966cf33f1b705eccb30b410731
|
|
| MD5 |
51315d4574a9e21ee84ffd94f91a75f4
|
|
| BLAKE2b-256 |
a0dcd09d7a70cdb363245c15ee01e01f361749eacfe2faa4185d0e56f6de37b3
|