-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change logo depending on light vs dark mode & update docs
- Loading branch information
1 parent
334c9ae
commit 2b34e0d
Showing
12 changed files
with
151 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<img id="logo_light_mode" src="{{ config.theme.logo_light_mode | url }}" alt="logo"> | ||
<img id="logo_dark_mode" src="{{ config.theme.logo_dark_mode | url }}" alt="logo"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# make_mlp | ||
|
||
::: jpc.make_mlp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
!!! info | ||
JPC provides two types of API depending on the use case: | ||
* a simple, basic API that allows to train and test models with predictive | ||
coding with a few lines of code | ||
* a more advanced and flexible API allowing for | ||
|
||
Describe purposes/use cases of both basic and advanced. | ||
|
||
# Basic usage | ||
|
||
JPC provides a single convenience function `jpc.make_pc_step()` to train | ||
predictive coding networks (PCNs) on classification and generation tasks, in a | ||
supervised as well as unsupervised manner. | ||
```py | ||
import jpc | ||
|
||
relu_net = jpc.get_fc_network(key, [10, 100, 100, 10], "relu") | ||
result = jpc.make_pc_step( | ||
model=relu_net, | ||
optim=optim, | ||
opt_state=opt_state, | ||
y=y, | ||
x=x | ||
) | ||
``` | ||
At a minimum, `jpc.make_pc_step()` takes a model, an optax optimiser and its | ||
state, and an output target. Under the hood, `jpc.make_pc_step()` uses diffrax | ||
to solve the activity (inference) dynamics of PC. The arguments can be changed | ||
```py | ||
import jpc | ||
|
||
result = jpc.make_pc_step( | ||
model=network, | ||
optim=optim, | ||
opt_state=opt_state, | ||
y=y, | ||
x=x, | ||
solver=other_solver, | ||
dt=1e-1, | ||
) | ||
``` | ||
Moreover, | ||
|
||
JPC provides a similar function for training a hybrid PCN | ||
```py | ||
import jax | ||
import jax.numpy as jnp | ||
from equinox import nn as nn | ||
|
||
# some data | ||
x = jnp.array([1., 1., 1.]) | ||
y = -x | ||
|
||
# network | ||
key = jax.random.key(0) | ||
_, *subkeys = jax.random.split(key) | ||
network = [nn.Sequential( | ||
[ | ||
nn.Linear(3, 100, key=subkeys[0]), | ||
nn.Lambda(jax.nn.relu)], | ||
), | ||
nn.Linear(100, 3, key=subkeys[1]), | ||
] | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters