Skip to content

Commit f332546

Browse files
author
Alexander Ororbia
committed
revised elements of utils to comply with docs
1 parent ab6c716 commit f332546

File tree

10 files changed

+85
-26
lines changed

10 files changed

+85
-26
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ngclearn.utils.feature\_dictionaries package
2+
============================================
3+
4+
Submodules
5+
----------
6+
7+
ngclearn.utils.feature\_dictionaries.polynomialLibrary module
8+
-------------------------------------------------------------
9+
10+
.. automodule:: ngclearn.utils.feature_dictionaries.polynomialLibrary
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
Module contents
16+
---------------
17+
18+
.. automodule:: ngclearn.utils.feature_dictionaries
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ngclearn.utils.masks package
2+
============================
3+
4+
Submodules
5+
----------
6+
7+
ngclearn.utils.masks.multiblock2d module
8+
----------------------------------------
9+
10+
.. automodule:: ngclearn.utils.masks.multiblock2d
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
Module contents
16+
---------------
17+
18+
.. automodule:: ngclearn.utils.masks
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:

docs/source/ngclearn.utils.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Subpackages
1010
ngclearn.utils.analysis
1111
ngclearn.utils.density
1212
ngclearn.utils.diffeq
13+
ngclearn.utils.feature_dictionaries
14+
ngclearn.utils.masks
1315
ngclearn.utils.optim
1416
ngclearn.utils.viz
1517

ngclearn/utils/diffeq/ode_utils.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
"""
22
Routines and co-routines for ngc-learn's differential equation integration backend.
33
4-
Currently supported back-end forms of integration in ngc-learn include:
5-
0) Euler integration (RK-1);
6-
1) Midpoint method (RK-2);
7-
2) Heun's method (error-corrector RK-2);
8-
3) Ralston's method (error-corrector RK-2);
9-
4) 4th-order Runge-Kutta method (RK-4);
4+
| Currently supported back-end forms of integration in ngc-learn include:
5+
| 0) Euler integration (RK-1);
6+
| 1) Midpoint method (RK-2);
7+
| 2) Heun's method (error-corrector RK-2);
8+
| 3) Ralston's method (error-corrector RK-2);
9+
| 4) 4th-order Runge-Kutta method (RK-4);
10+
1011
"""
1112

1213
from jax import numpy as jnp, random, jit #, nn

ngclearn/utils/diffeq/odes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
"""
2+
In-built dynamical systems built on differential equations. Note that these systems are designed such that they
3+
directly operzte with ngc-learn's ODE integration backend.
4+
5+
| Currently in-built dynamical systems include:
6+
| 0) A continuous linear 2D system;
7+
| 1) A continuous cubic 2D system;
8+
| 2) A Lorenz attractor system;
9+
| 3) A continuous linear 3D system;
10+
| 4) A continuous oscillator system.
11+
12+
"""
13+
114
import jax.numpy as jnp
215

316
def linear_2D(t, x, params):

ngclearn/utils/feature_dictionaries/__init__.py

Whitespace-only changes.

ngclearn/utils/feature_dictionaries/polynomialLibrary.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
import jax.numpy as jnp
2-
from jax import jit, random
3-
import jax.numpy as jnp
1+
from jax import jit, random, numpy as jnp
42
from typing import List, Tuple, Union
53
from dataclasses import dataclass
64

7-
8-
95
@dataclass
106
class PolynomialLibrary:
117
"""
128
A class for creating polynomial feature libraries in 1D, 2D, or 3D.
139
14-
Attributes:
15-
poly_order (int): Maximum order of polynomial terms
16-
include_bias (bool): Whether to include the bias term in the output
10+
Args:
11+
poly_order (int): Maximum order of polynomial terms (Attribute)
12+
13+
include_bias (bool): Whether to include the bias term in the output (Attribute)
1714
"""
1815

1916
poly_order: int = None

ngclearn/utils/masks/__init__.py

Whitespace-only changes.

ngclearn/utils/patch.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def target(self, img: jnp.ndarray):
9393
plt.show()
9494

9595

96-
97-
gen = PatchGenerator(patch_width=5, patch_height=5, horizontal_alignment='center', horizontal_stride=1)
98-
99-
test_img = jnp.zeros((32, 32))
100-
101-
gen.target(test_img)
96+
## testing code
97+
# gen = PatchGenerator(patch_width=5, patch_height=5, horizontal_alignment='center', horizontal_stride=1)
98+
#
99+
# test_img = jnp.zeros((32, 32))
100+
#
101+
# gen.target(test_img)

ngclearn/utils/patch_utils.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ class Create_Patches:
3939
4040
Args:
4141
img: jax array of size (H, W)
42-
patched: (height_patch, width_patch)
43-
overlap: (height_overlap, width_overlap)
4442
45-
add_frame: increases the img size by (height_patch - height_overlap, width_patch - width_overlap)
46-
create_patches: creates small patches out of the image based on the provided attributes.
43+
patch_shape: (height_patch, width_patch)
44+
45+
overlap_shape: (height_overlap, width_overlap)
4746
4847
Returns:
49-
jnp.array: Array containing the patches
50-
shape: (num_patches, patch_height, patch_width)
48+
jnp.array: Array containing the patches, shape: (num_patches, patch_height, patch_width)
5149
5250
"""
51+
#patched: (height_patch, width_patch)
52+
#overlap: (height_overlap, width_overlap)
53+
#add_frame: increases the img size by (height_patch - height_overlap, width_patch - width_overlap)
54+
#create_patches: creates small patches out of the image based on the provided attributes.
5355

5456
def __init__(self, img, patch_shape, overlap_shape):
5557
self.img = img
@@ -90,6 +92,8 @@ def create_patches(self, add_frame=False, center=True):
9092
Keyword Args:
9193
add_frame: If true the function will add zero frames (increase the dimension) to the image
9294
95+
center:
96+
9397
Returns:
9498
jnp.array: Array containing the patches
9599
shape: (num_patches, patch_height, patch_width)

0 commit comments

Comments
 (0)