Skip to main content

Simple Deep Learning Framework

Project description

SimpleNN

SimpleNN is a simplified framework for building and training neural networks models. Framework is build on modularity and flexibility to enable easy adoption and feature expansions.

Currently SimpleNN only supports sequential models. Only sequential execution graphs are supported. This means that the following operations are not supported:

  • Concatenations of any kind (Residual gates or multiple inputs)
  • Addition/Multiplications of layers
  • Loops (RNNs)

Originally built as a learning excercise.

For complete examples check the /examples directory.


Getting Started

Install

pip install simple-neural
# Multi class classification
FEATURES = 5
N_CLASSES = 3

class DemoNetwork(Network):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.l1 = Dense(FEATURES, 64, W_l2=1e-3, b_l2=1e-3)
        self.activation1 = ReLu()
        self.l2 = Dense(32, N_CLASSES)
        self.output = SoftMaxLoss(loss=CategoricalCrossEntropy())

    def forward(self, x, targets): # define forward pass
        x = self.l1(x)
        x = self.activation1(x)
        x = self.l2(x)
        return self.output(x, targets)

optimizer = Adam(lr=0.03, decay=5e-7, b1=0.9, b2=0.999)
acc = Accuracy()
model = DemoNetwork(optimizer=optimizer)
model.fit(X, y, epochs=1000, metrics=[acc])

Saving/Loading Network

from simplenn import Network

# serialize
model.save('simplemodel.pkl')

# deserialize
m2 = Network.load('simplemodel.pkl')
yhat = m2.predict(X)

Features

Layers

  • Dense : simplenn.layers.Dense
  • Dropout : simplenn.layers.Dropout

Activations

  • ReLu : simplenn.activation.ReLu
  • Sigmoid : simplenn.activation.Sigmoid
  • SoftMax : simplenn.activation.SoftMax
  • Linear : simplenn.activation.Linear

Losses

  • Binary cross entropy : simplenn.metrics.loss.BinaryCrossEntropy
  • Categorical cross entropy : simplenn.metrics.loss.CategoricalCrossEntropy
  • Mean absolute error : simplenn.metrics.loss.MeanAbsoluteError
  • Mean squared error : simplenn.metrics.loss.MeanSquaredError

Optimizers

  • Stochastic Gradient Descent : simplenn.optimizers.SGD
  • Adaptive Gradient : simplenn.optimizers.AdaGrad
  • Root Mean Squared Propagation : simplenn.optimizers.RMSProp
  • Adaptive Moment Estimation : simplenn.optimizers.Adam

Metrics

  • Accuracy : simplenn.metrics.Accuracy
  • Mean absolute error : simplenn.metrics.loss.MeanAbsoluteError
  • Mean squared error : simplenn.metrics.loss.MeanSquaredError
  • Area under the curve - receiver operating characteristic : simplenn.metrics.AucROC
  • Area under the curve - precision recall curve : simplenn.metrics.AucPRC
  • TPR (Recall) : simplenn.metrics.TPR
  • FPR : simplenn.metrics.FPR

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

simple-neural-0.0.4.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_neural-0.0.4-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file simple-neural-0.0.4.tar.gz.

File metadata

  • Download URL: simple-neural-0.0.4.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for simple-neural-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8de2561277f3ae15bb058f08ff211be34b00f3fdb87d9bc4133249020b29982a
MD5 35385838f71ad97a1b5ac2c0f1a72156
BLAKE2b-256 4e779d64d95d99e54335018ea5d1f1661d6502bb9f0d712bcffe1e095ff3497a

See more details on using hashes here.

File details

Details for the file simple_neural-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: simple_neural-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for simple_neural-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2eb6507e9d82dd0cc9d4de282f3f399e2519a75198eccda353a751726a5ae52e
MD5 07495162d901a06f2fd54639dc44e981
BLAKE2b-256 582a426dd6f1037d6aa38657d8659619e22775e8c2bb7c306ed5935dffc21d5f

See more details on using hashes here.

Supported by

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