All Projects → madvn → Ctrnn

madvn / Ctrnn

Licence: mit
Python package that implements Continuous Time Recurrent Neural Networks (CTRNNs)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Ctrnn

Armnn
Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
Stars: ✭ 696 (+3994.12%)
Mutual labels:  neural-networks
Arraymancer
A fast, ergonomic and portable tensor library in Nim with a deep learning focus for CPU, GPU and embedded devices via OpenMP, Cuda and OpenCL backends
Stars: ✭ 793 (+4564.71%)
Mutual labels:  neural-networks
Deepmedic
Efficient Multi-Scale 3D Convolutional Neural Network for Segmentation of 3D Medical Scans
Stars: ✭ 809 (+4658.82%)
Mutual labels:  neural-networks
Machine Learning
머신러닝 입문자 혹은 스터디를 준비하시는 분들에게 도움이 되고자 만든 repository입니다. (This repository is intented for helping whom are interested in machine learning study)
Stars: ✭ 705 (+4047.06%)
Mutual labels:  neural-networks
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (+4394.12%)
Mutual labels:  neural-networks
Lab
Disclaimer: This is not an official Google product.
Stars: ✭ 6,595 (+38694.12%)
Mutual labels:  neural-networks
Deep learning and the game of go
Code and other material for the book "Deep Learning and the Game of Go"
Stars: ✭ 677 (+3882.35%)
Mutual labels:  neural-networks
Basic reinforcement learning
An introductory series to Reinforcement Learning (RL) with comprehensive step-by-step tutorials.
Stars: ✭ 826 (+4758.82%)
Mutual labels:  neural-networks
Neural Structured Learning
Training neural models with structured signals.
Stars: ✭ 790 (+4547.06%)
Mutual labels:  neural-networks
Pyclustering
pyclustring is a Python, C++ data mining library.
Stars: ✭ 806 (+4641.18%)
Mutual labels:  neural-networks
Tensorpack
A Neural Net Training Interface on TensorFlow, with focus on speed + flexibility
Stars: ✭ 6,136 (+35994.12%)
Mutual labels:  neural-networks
Tensorflow Tutorial
TensorFlow and Deep Learning Tutorials
Stars: ✭ 748 (+4300%)
Mutual labels:  neural-networks
Minisom
🔴 MiniSom is a minimalistic implementation of the Self Organizing Maps
Stars: ✭ 801 (+4611.76%)
Mutual labels:  neural-networks
Deepfacelab
DeepFaceLab is the leading software for creating deepfakes.
Stars: ✭ 30,308 (+178182.35%)
Mutual labels:  neural-networks
Xnnpack
High-efficiency floating-point neural network inference operators for mobile, server, and Web
Stars: ✭ 808 (+4652.94%)
Mutual labels:  neural-networks
Sciblog support
Support content for my blog
Stars: ✭ 694 (+3982.35%)
Mutual labels:  neural-networks
3d Machine Learning
A resource repository for 3D machine learning
Stars: ✭ 7,405 (+43458.82%)
Mutual labels:  neural-networks
Awesome Ai Ml Dl
Awesome Artificial Intelligence, Machine Learning and Deep Learning as we learn it. Study notes and a curated list of awesome resources of such topics.
Stars: ✭ 831 (+4788.24%)
Mutual labels:  neural-networks
Kur
Descriptive Deep Learning
Stars: ✭ 811 (+4670.59%)
Mutual labels:  neural-networks
Quickdraw
Implementation of Quickdraw - an online game developed by Google
Stars: ✭ 805 (+4635.29%)
Mutual labels:  neural-networks

CTRNN

Python package that implements Continuous Time Recurrent Neural Networks (CTRNNs)

See Beer, R.D. (1995). On the dynamics of small continuous-time recurrent neural networks. Adaptive Behavior 3:469-509. for a study of CTRNNs.

Using this repo in conjunction with StochSearch allows you to optimize CTRNNs to perform different tasks. Stochsearch uses Python's multiprocessing framework to parallelize population based stochastic search optimization methods.

You can also find a Tensorflow version of building and implementing a population of CTRNNs here. Refer to this same repo for optimizing CTRNNs using Tensorflow on a GPU.

Installation instructions

    $ pip install CTRNN

Requirements: numpy, scipy

Using the package

Importing the CTRNN package:

    from CTRNN import CTRNN

Creating a CTRNN object:

    cns = CTRNN(network_size,step_size=0.1) 

weights are initialized randomly; gains, time-constants and biases are set to 1

Setting gain for neuron i:

    cns.gains[i] = 1 

where i is in range [0,network_size)

Setting gain for all neurons:

    cns.gains = [1,2,3,..] 

with list of size=network_size

Setting biases and time-constants (taus) is similar

    cns.biases
    cns.taus

Setting weights to neuron i from neuron j:

    cns.weights[i,j] = 3 

where i,j in range [0,network_size)

Setting weights as a matrix:

    from scipy.sparse import csr_matrix
    cns.weights = csr_matrix(weights_matrix) 

where weights_matrix is of size=network_sizeXnetwork_size

Euler stepping the network:

    cns.euler_step(external_inputs)

where external_inputs is a list of size=network_size

Accessing/Setting output of neuron i:

    print(cns.outputs[i]) 
    cns.outputs[i] = 0.5

where i in range [0,network_size) and output in range [0,1]

Accessing/Setting output of all neurons:

    print(cns.outputs)
    cns.outputs = [0.5,0.75,0.4]

where list is of size=network_size

Same as above for states

    cns.states

where state values can range in (-inf,inf)

Randomizing states/outputs

    cns.randomize_states(ub,lb) 

upper bound and lower bound in range (-inf,inf)

    cns.randomize_outputs(ub,lb) 

upper bound and lower bound in [0,1]

Example

The following code creates a 2-neuron CTRNN sinusoidal oscillator, See demo folder::

    # imports
    import numpy as np
    import matplotlib.pyplot as plt
    # importing the CTRNN class
    from CTRNN import CTRNN

    # params
    run_duration = 250
    net_size = 2
    step_size = 0.01

    # set up network
    network = CTRNN(size=net_size,step_size=step_size)
    network.taus = [1.,1.]
    network.biases = [-2.75,-1.75]
    network.weights[0,0] = 4.5
    network.weights[0,1] = 1
    network.weights[1,0] = -1
    network.weights[1,1] = 4.5

    # initialize network
    network.randomize_outputs(0.1,0.2)

    # simulate network
    outputs = []
    for _ in range(int(run_duration/step_size)):
        network.euler_step([0]*net_size) # zero external_inputs
        outputs.append([network.outputs[i] for i in range(net_size)])
    outputs = np.asarray(outputs)

    # plot oscillator output
    plt.plot(np.arange(0,run_duration,step_size),outputs[:,0])
    plt.plot(np.arange(0,run_duration,step_size),outputs[:,1])
    plt.xlabel('Time')
    plt.ylabel('Neuron outputs')
    plt.show()

Output:

demo/osc.png

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].