Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.3%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: short-greg
- License: mit
- Language: Python
- Default Branch: master
- Size: 1.99 MB
Statistics
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
Zenkai
Zenkai is a framework built on PyTorch for deep learning researchers - to explore a wider variety of machine architectures - to explore learning algorithms that do not rely on gradient descent
It is fundamentally based on the concepts of target propagation. In target propagation, targets are propagated to each layer of the network by using an inversion or approximating an inversion operation. Thus, each layer has its own target. While Zenkai allows for more than just using target propagation, it is based on the concept of each layer having its own target.
Installation
bash
pip install zenkai
Brief Overview
Zenkai consists of several packages to more flexibly define and train deep learning machines beyond what is easy to do with Pytorch.
- zenkai: The core package. It contains all modules necessary for defining a learning machine.
- zenkai.tansaku: Package for adding more exploration to learning. Contains framework for defining and creating population-based optimizers.
- zenkai.ensemble: Package used to create ensemble models within the Zenkai framework.
- zenkai.targetprop Package used for creating systems that use target propagation.
- zenkai.feedback Package for performing various kinds of feedback alignment.
- zenkai.scikit Package wrapping scikit learn to create Zenkai LeraningMachines using scikit learn modules.
- zenkai.utils: Utils contains a variety of utility functions that are used by the rest of the application. For example utils for getting and setting parameters or gradients.
Further documentation is available at https://zenkai.readthedocs.io
Usage
Zenkai's primary feature is the "LearningMachine" which aims to make defining learning machines flexible. The design is similar to Torch, in that there is a forward method, a parameter update method similar to accGradParameters(), and a backpropagation method similar to updateGradInputs(). So the primary usage will be to implement them.
Here is a (non-working) example ```bash
class MyLearner(zenkai.LearningMachine): """A LearningMachine couples the learning mechanics for the machine with its internal mechanics."""
def __init__(
self, module: nn.Module, step_theta: zenkai.StepTheta,
step_x: StepX, loss: zenkai.Loss
):
super().__init__()
self.module = module
# step_theta is used to update the parameters of the
# module
self._step_theta = step_theta
# step_x is used to update the inputs to the module
self._step_x = step_x
self.loss = loss
def step(
self, x: IO, t: IO, state: State, **kwargs
):
# use to update the parameters of the machine
# x (IO): The input to update with
# t (IO): the target to update
# outputs for a connection of two machines
return self._step_theta(x, state._y, t, state)
def step_x(
self, x: IO, t: IO, state: State, **kwargs
) -> IO:
# use to update the target for the machine
# step_x is analogous to updateGradInputs in Torch except
# it calculates "new targets" for the incoming layer
return self._step_x(x, state._y, t, state)
def forward_nn(self, x: zenkai.IO, state: State) -> zenkai.IO:
return self.module(x.f)
my_learner = MyLearner(...)
zenkai.setlmode(mylearner, zenkai.LMode.WithStep)
for x, t in dataloader: # set the "learning mode" to perform a step loss(my_learner(x), t).backward()
```
Learning machines can be stacked by making use of step_x in the training process.
Note: Since Zenkai has been set up to make use of Torch's backpropagation skills
```bash
class MyMultilayerLearner(LearningMachine): """A LearningMachine couples the learning mechanics for the machine with its internal mechanics."""
def __init__(
self, layer1: LearningMachine, layer2: LearningMachine
):
super().__init__()
self.layer1 = layer1
self.layer2 = layer2
# use these hooks to indicate a dependency on another method
self.add_step(StepXDep(self, 't1'))
self.add_step_x(ForwardDep(self, 'y1'))
def step(
self, x: IO, t: IO, state: State, **kwargs
):
# use to update the parameters of the machine
# x (IO): The input to update with
# t (IO): the target to update
# outputs for a connection of two machines
self.layer2.step(state._y1, t, state.sub('layer2'))
self.layer1.step(state._y2, state._t1, state.sub('layer1'))
def step_x(
self, x: IO, t: IO
) -> IO:
# use to update the target for the machine
# it calculates "new targets" for the incoming layer
t1 = state._t1 = self.layer2.step_x(state._y1, t, state.sub('layer1'))
return self.layer1.step_x(x, t1, state.sub('layer1'))
def forward_nn(self, x: zenkai.IO, state: State) -> zenkai.IO:
# define the state to be for the self, input pair
x = state._y1 = self.layer1(x, state.sub('layer1'))
x = state._y2 = self.layer2(x, state.sub('layer2'))
return x
mylearner = MyLearner(...) zenkai.setlmode(my_learner, zenkai.LMode.WithStep)
for x, t in dataloader: assessment = loss(my_learner(x), t) loss.backward()
```
Build documentation
cd docs make clean sphinx-autogen source/api.rst make html
Tutorials
Tutorials are being made available at https://github.com/short-greg/zenkai_tutorials .
Contributing
To contribute to the project
- Fork the project
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a pull request
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Citing this Software
If you use this software in your research, we request you cite it. We have provided a CITATION.cff file in the root of the repository. Here is an example of how you might use it in BibTeX:
Owner
- Login: short-greg
- Kind: user
- Repositories: 5
- Profile: https://github.com/short-greg
Citation (CITATION.cff)
cff-version: 0.0.1 message: "If you use this software, please cite as below." authors: - family-names: "Short" given-names: "Greg" title: Zenkai - Deep Learning Beyond Backpropagation date-released: 2023-07-17 url: "https://github.com/short-greg/zenkai"
GitHub Events
Total
- Watch event: 2
- Push event: 41
Last Year
- Watch event: 2
- Push event: 41
Issues and Pull Requests
Last synced: almost 2 years ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- eltociear (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 17 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 8
- Total maintainers: 1
pypi.org: zenkai
A framework for flexibly developing beyond bakcpropagation.
- Homepage: https://github.com/short-greg/zenkai
- Documentation: https://zenkai.readthedocs.com
- License: LICENSE
-
Latest release: 0.0.9
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- sphinx-rtd-theme ==1.3.0
- black ^21 develop
- blacken-docs ^1 develop
- flake8 ^3 develop
- isort ^5 develop
- pytest ^6 develop
- numpy >=1
- pandas >=1,<2
- python >=3.8,<4.0
- scikit-learn >=1.0.0
- scipy >=1.5,<2.0
- tqdm >=4.0