项目作者: Pjottos

项目描述 :
Experiments with binary weights for neural networks
高级语言: Rust
项目地址: git://github.com/Pjottos/binary-brain.git
创建时间: 2020-11-11T16:03:33Z
项目社区:https://github.com/Pjottos/binary-brain

开源协议:MIT License

下载


binary-brain

A densely connected neural net that has every neuron connected to every other neuron with binary (-1/+1) weights.
It is different from typical neural networks in that no forward pass is defined.
Instead, it uses the concept of cycles, where every cycle updates the neurons once.
This means the training algorithm is responsible for figuring out the way the input should propagate through the network, which makes this a very generic solution to machine learning tasks.

Usage

Install rust - https://rustup.rs/
If you want to run OpenAI gym examples, follow the install instructions for gym-rs - https://github.com/MrRobb/gym-rs

  1. rustup override set nightly
  2. cargo run --example <example>

For benchmarks:

  1. rustup override set nightly
  2. RUSTFLAGS="-C target-cpu=native" cargo bench

Performance

Benchmark results on an i7-4790k:

  1. test benches::cycle_32768 ... bench: 11,015,509 ns/iter (+/- 1,051,552)
  2. test benches::cycle_4096 ... bench: 133,047 ns/iter (+/- 6,552)
  3. test benches::cycle_512 ... bench: 4,894 ns/iter (+/- 601)
  4. test benches::cycle_64 ... bench: 229 ns/iter (+/- 11)

The number after cycle is the amount of neurons in the brain.
For each benchmark 32 inputs and 32 outputs are used.