Skip to main content

A simple utility for generating CNN architectures automatically, using genetic algorithms.

Project description

EasyNAS - a simple and effective CNN architecture generator

Purpose

Given a dataset, this python package will utilize genetic algorithms and Pytorch to optimize the structure a simple CNN for the task of classification. With simple meaning that the generated architecture is built of a series of layers, where each layers input is the output the previous one.

Installation

pip install easynas

Input data format

The input data should be split into training and validation sets, with the following dimensions:

[#samples, #channels, height, width]

This means that 2D image-like data is the expected input. If dealing, for example, with 1D time series data that contains a 'channels' dimension, one should include an extra dimension as such (example with numpy):

X = X[:, :, :, None]

Usage example

from easynas.genetic_algorithm import EasyNASGA
import torchvision
from sklearn.model_selection import train_test_split

train_data = torchvision.datasets.MNIST('/files/', train=True, download=True)
test_data = torchvision.datasets.MNIST('/files/', train=False, download=True)
X_train = train_data.data[:, None, :, :].float()
y_train = train_data.targets.float()
X_train, X_val, y_train, y_val = train_test_split(X_train, y_train, test_size=0.2, random_state=42)
easyga = EasyNASGA(X_train, y_train, X_val, y_val, generations=5, population_size=10, max_epochs=1, weight_inheritance=True)
easyga.ga.run()
best_individual = easyga.get_best_individual()
print(f'best individual: {best_individual}')

Credits

Anyone using this package for research/production purposes is requested to cite the following research articles:

Rapaport, E., Poese, I., Zilberman, P., Holschke, O., & Puzis, R. (2020).
Predicting traffic overflows on private peering.
arXiv preprint arXiv:2010.01380.

https://arxiv.org/abs/2010.01380

Rapaport, Elad, Oren Shriki, and Rami Puzis.
"EEGNAS: Neural Architecture Search for Electroencephalography Data Analysis and Decoding."
International Workshop on Human Brain and Artificial Intelligence.
Springer, Singapore, 2019.

https://link.springer.com/chapter/10.1007/978-981-15-1398-5_1

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

easynas-0.2.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

easynas-0.2.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file easynas-0.2.1.tar.gz.

File metadata

  • Download URL: easynas-0.2.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for easynas-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c2a42682e39c5c0f3efbed44867257edc0bb6b775643d1f7f544b768b7ba7595
MD5 e8b5a4515cc4f2c8b3cc77e9845b60f4
BLAKE2b-256 acda92e4f188924f06e9752d13dc6f9ea6f015b265486bd53c0b4a7d61041ce6

See more details on using hashes here.

File details

Details for the file easynas-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: easynas-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for easynas-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b1ea4e88536896723130b5d8aa43760945f6610d817d0ac5b5391652e99131bd
MD5 8e19795a2c08b51888b855290170bb19
BLAKE2b-256 2e1e6ed5a71f19e5984e85055d6f69545492fbd25135f0a19e70d4ffe42e038e

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