Skip to content

Commit e9c0b48

Browse files
Add resonator network and sparse distributed memory (#123)
* Implement resonator network and sparse distributed memory * [github-action] formatting fixes * Add memory and models modules to conda * Add missing scipy dependency --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 2a12aae commit e9c0b48

File tree

12 files changed

+258
-3
lines changed

12 files changed

+258
-3
lines changed

conda/meta.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ requirements:
2020
run:
2121
- python>=3.6
2222
- pytorch
23+
- scipy
2324
- pandas
2425
- requests
2526
- tqdm
@@ -30,6 +31,8 @@ test:
3031
- torchhd.functional
3132
- torchhd.embeddings
3233
- torchhd.structures
34+
- torchhd.models
35+
- torchhd.memory
3336
- torchhd.datasets
3437

3538
about:

dev-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
torch>=1.9.0
22
torchvision
3+
scipy
34
pandas
45
requests
56
numpy

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Welcome to the Torchhd documentation!
22
=====================================
33

4-
Torchhd is a Python library dedicated to *Hyperdimensional Computing* (also known as *Vector Symbolic Architectures*).
4+
Torchhd is a Python library dedicated to *Hyperdimensional Computing* also known as *Vector Symbolic Architectures*.
55

66
.. toctree::
77
:glob:
@@ -19,6 +19,7 @@ Torchhd is a Python library dedicated to *Hyperdimensional Computing* (also know
1919
embeddings
2020
structures
2121
models
22+
memory
2223
datasets
2324
utils
2425

docs/memory.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. _memory:
2+
3+
torchhd.memory
4+
==================
5+
6+
.. currentmodule:: torchhd.memory
7+
8+
.. autosummary::
9+
:toctree: generated/
10+
:template: class.rst
11+
12+
SDM

docs/models.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ torchhd.models
1010
:template: class.rst
1111

1212
Centroid
13-

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
torch
22
torchvision
33
pandas
4+
scipy
45
requests
56
tqdm
67
numpy

docs/torchhd.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Operations
3838
randsel
3939
multirandsel
4040
create_random_permute
41+
resonator
4142
soft_quantize
4243
hard_quantize
4344

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
license="MIT",
2121
install_requires=[
2222
"torch>=1.9.0",
23+
"scipy",
2324
"pandas",
2425
"numpy",
2526
"requests",

torchhd/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import torchhd.embeddings as embeddings
33
import torchhd.structures as structures
44
import torchhd.models as models
5+
import torchhd.memory as memory
56
import torchhd.datasets as datasets
67
import torchhd.utils as utils
78

@@ -42,6 +43,7 @@
4243
cross_product,
4344
ngrams,
4445
graph,
46+
resonator,
4547
map_range,
4648
value_to_index,
4749
index_to_value,
@@ -60,6 +62,7 @@
6062
"embeddings",
6163
"structures",
6264
"models",
65+
"memory",
6366
"datasets",
6467
"utils",
6568
"as_vsa_model",
@@ -92,6 +95,7 @@
9295
"cross_product",
9396
"ngrams",
9497
"graph",
98+
"resonator",
9599
"map_range",
96100
"value_to_index",
97101
"index_to_value",

torchhd/datasets/ccpp.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ class CyclePowerPlant(data.Dataset):
1212
"""`Combined cycle power planet <https://archive.ics.uci.edu/ml/datasets/combined+cycle+power+plant>`_ dataset.
1313
Features consist of hourly average ambient variables Temperature (T), Ambient Pressure (AP), Relative Humidity (RH) and Exhaust Vacuum (V) to predict the net hourly electrical energy output (EP) of the plant.
1414
15+
.. list-table::
16+
:widths: 10 10 10 10
17+
:align: center
18+
:header-rows: 1
19+
20+
* - Instances
21+
- Attributes
22+
- Task
23+
- Area
24+
* - 9568
25+
- 4
26+
- Regression
27+
- Computer
28+
1529
Args:
1630
root (string): Root directory of dataset where downloaded dataset exists
1731
download (bool, optional): If True, downloads the dataset from the internet and

0 commit comments

Comments
 (0)