Skip to main content

On-Ramp to Deep Learning. Built on Keras

Project description

The On-Ramp to Deep Learning

Built in Python 3 on Keras 2.

Binder CircleCI codecov Documentation Status PyPI version

Read the documentation at conx.readthedocs.io

Ask questions on the mailing list: conx-users

Implements Deep Learning neural network algorithms using a simple interface with easy visualizations and useful analytical. Built on top of Keras, which can use either TensorFlow, Theano, or CNTK.

The network is specified to the constructor by providing sizes. For example, Network(“XOR”, 2, 5, 1) specifies a network named “XOR” with a 2-node input layer, 5-unit hidden layer, and a 1-unit output layer.

Example

Computing XOR via a target function:

import conx as cx

dataset = [[[0, 0], [0]],
           [[0, 1], [1]],
           [[1, 0], [1]],
           [[1, 1], [0]]]

net = cx.Network("XOR", 2, 5, 1, activation="sigmoid")
net.set_dataset(dataset)
net.compile(error='mean_squared_error',
            optimizer="sgd", lr=0.3, momentum=0.9)
net.train(2000, report_rate=10, accuracy=1.0)
net.test(show=True)

Creates dynamic, rendered visualizations like this:

Don’t Install

Rather than installing conx, consider one of the following pre-built options:

Install

conx requires Python3, Keras version 2.0.8 or greater, and some other Python modules that are installed automatically with pip.

On Linux, you may need to install libffi and libffi-dev in order to render layers for the network display. If you attempt to display a network and it appears empty, or if you attempt to network.propagate_to_image() and it gives a PIL error, you need these libraries.

On Ubuntu or other Debian-based system:

sudo apt install libffi-dev libffi6

Next, we use pip to install the Python packages.

Note: you may need to use pip3, or admin privileges (eg, sudo), or install into a user environment.

pip install conx -U

You will need to decide whether to use Theano, TensorFlow, or CNTK. Pick one. See docs.microsoft.com for installing CNTK on Windows or Linux. All platforms can also install either of the others using pip:

pip install theano

or

pip install tensorflow

On MacOS, you may also need to render the SVG visualizations:

brew install cairo

To make MP4 movies, you will need the ffmpeg executable installed and available on your default path.

On MacOS, you could use:

brew install ffmpeg

On Windows:

See, for example, https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg

On Linux:

sudo apt install ffmpeg
# or perhaps:
sudo yum install ffmpeg

Use with Jupyter Notebooks

To use the Network.dashboard() and camera functions, you will need to enable ipywidgets:

jupyter nbextension enable --py widgetsnbextension

If you install via conda, then it will already be enabled:

conda install -c conda-forge ipywidgets

Setting the Keras Backend

To use a Keras backend other than TensorFlow, edit (or create) ~/.keras/kerson.json, like:

{
    "backend": "theano",
    "image_data_format": "channels_last",
    "epsilon": 1e-07,
    "floatx": "float32"
}

Troubleshooting

  1. If you have a problem after installing matplotlib with pip, and you already have matplotlib installed (say, with apt) you may want to remove the apt-installed version of matplotlib.

  2. Theano has many known problems. Don’t use Theano, use TensorFlow.

Examples

See the notebooks folder and the documentation for additional examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

conx-3.5.100.tar.gz (83.8 kB view details)

Uploaded Source

Built Distribution

conx-3.5.100-py2.py3-none-any.whl (90.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file conx-3.5.100.tar.gz.

File metadata

  • Download URL: conx-3.5.100.tar.gz
  • Upload date:
  • Size: 83.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for conx-3.5.100.tar.gz
Algorithm Hash digest
SHA256 50263bdf2f098c041353c53257ca34dfc0b1678d8ab74b8ce73c7130b5f3d799
MD5 aadbb65d5ec864d9c7399316b3fc3c02
BLAKE2b-256 31c43b529f491d9a16bf6a3cb500e47246097477506463119cf3ef8c462b5e2a

See more details on using hashes here.

File details

Details for the file conx-3.5.100-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for conx-3.5.100-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 86bf821a24c7c7e6d5be6363d7fe7fda72efcdde2b89c92c09d12181f0393ce7
MD5 6a9fcb5a0d08e9fa58d80bea32e1e8e9
BLAKE2b-256 55171caca71f58b211769dc1d603508ee09f40635c588faaae31c82c64f424dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page