Skip to main content

Train Multilayer Perceptrons with Genetic Algorithms.

Project description

Neural Networks optimization with Genetic Algorithms

  • Author: Luis Liñán Villafranca

  • Mentor: Juan Julián Merelo Guervós

Index


Installation

The first prerequisite is to have Python 3.6, 3.7 or 3.8 and pip installed on the system. It is recommended to create a virtual environment to isolate the used package versions. For more information about pip and venv check the official tutorial.

Virtual environment creation

First, you need to install a version of python that’s been compiled with -fPIC. pyenv versions by default are not, so you will need to issue something like this:

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.9

We can then use a core module to create the virtual environment, it’s been working since version 3.3

python -m venv .venv

Please make sure when you do this that all __pycache__ directories have been deleted; otherwise, it might fail in some unexpected place.

This will create a virtual environment in the .venv directory. Once that’s been done, we need to activate it; use one of the following commands (depending on the interpreter) (obtained from the official venv documentation):

Platform

Shell

Command to activate virtual environment

POSIX

bash/zsh fish csh/tcsh PowerShell Core

$ source <venv>/bin/activate $ . <venv>/bin/activate.fish $ source <venv>/bin/activate.csh $ <venv>/bin/Activate.ps1

Windows

cmd.exe PowerShell

C:\> <venv>\Scripts\activate.bat PS C:\> <venv>\Scripts\Activate.ps1

Table 1.1: Activating the virtual environment.

You won’t need to create the virtual environment in the case you’re using global installation of modules via version managers such as pyenv.

Installing the DeepGProp CLI

To run DeepGProp first we need to install its cli. You can install it with pip:

pip install -U DeepGProp

Or downloading the repository with:

pip install .

On the other hand, if we want the code to be updated as we change it, we will need to install DeepGProp in editable mode. To do this, we need to add the option -e/--editable to the installation command:

pip install -e .

After installing it, we will be able to use it through the command dgp. You can run dgp --help to list the available options.

Extra modules

I’ve divided all the used packages in different groups to avoid installing undesirable ones for specific use of the repository:

Purpose

File path

Description

Test

requirements/tests.txt

Necessary packages for tests. Nox installs them automaticly when running the tests.

Lint

requirements/lint.txt

Necessary packages for linting. Nox installs them automaticly when linting the code.

Format

requirements/format.txt

Necessary packages for formatting. Nox installs them automaticly when running format command.

Dev

requirements/dev.txt

All above packages.

To install any of these packages you can run:

pip install -r <file path>

If you are not using any virtual environment, make sure you install these packages so that they are available in the required Python version.

Tests and formatting

First, we need to install the Nox tool:

pip install -U nox

To run all the tests:

nox -k test

To run the linters:

nox -k lint

You can check all the possible sessions with the following command:

nox -l

Frameworks

  • Keras - base library to create and run the neural networks.

  • DEAP - genetic algorithms library used to optimize the models hyper parametters.

Utilidades

  • Automation:

    • Nox - automation tool to run different tasks as the tests or the code formatting check.

  • Tests:

    • pytest - Python test framework to run the tests.

Licencia

The original code can be found in the DeepGProp repo under GPLv3 License.

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

DeepGProp-1.0.7.tar.gz (580.3 kB view details)

Uploaded Source

Built Distribution

DeepGProp-1.0.7-py3-none-any.whl (629.2 kB view details)

Uploaded Python 3

File details

Details for the file DeepGProp-1.0.7.tar.gz.

File metadata

  • Download URL: DeepGProp-1.0.7.tar.gz
  • Upload date:
  • Size: 580.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for DeepGProp-1.0.7.tar.gz
Algorithm Hash digest
SHA256 82ef2012df4b24059b5a56ee0b7f49451d0a7196aededca8c311d733c6078e4e
MD5 0975409acf493e0b7f6153d002f3f900
BLAKE2b-256 359915106cfd93f7c0164fa54a373f9fb789e65cb819f6e0a0947cf336da5ce2

See more details on using hashes here.

File details

Details for the file DeepGProp-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: DeepGProp-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 629.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for DeepGProp-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8006af27b6eb0c0d75b18fa5bf224e67d210396cbfcc97c984ff57df8ac838f4
MD5 d4e32a063b792a3a843017abfb629958
BLAKE2b-256 313c08c52887f9cf791a7ba30bee3f5112a0f5fc1a2a44d23bddfe6e32f4fdf1

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