Skip to main content

Implementation of deep learning, machine learning and math algorithms in NumPy and pure Python

Project description

enp (stands for Everything in NumPy) provides implementation of deep learning, machine learning, and math algorithms in NumPy and pure Python.

Installation

You can install the library using pip:

pip install enp

Description

The library consists of 3 main parts:

  • deep learning
    • examples of usage are in examples/nn

    • impementation is in enp/nn

    • loosely follows PyTorch conventions

  • machine learning
    • examples of usage are in examples/ml

    • impementation is in enp/ml

    • loosly follows scikit-learn conventions

  • linear algebra
    • examples of usage are in tests/test_linear_algebra.py and tests/test_linear_algebra_additional.py

    • impementation is in enp/linalg

Deep Learning

Example of building, prediction, and training a simple neural network consisting of linear layers:

from enp.nn import *

model = Model(learning_rate=0.0075)
input_layer = InputLayer(layer_dim=12288)
linear_1 = Linear(layer_dim=7, prev_layer=input_layer, activation='relu')
linear_2 = Linear(layer_dim=1, prev_layer=linear_1, activation='sigmoid')
cost_layer = BCELoss(layer_dim=1, prev_layer=linear_2)
model.layers = [input_layer, linear_1, linear_2, cost_layer]
model.train(x=train_x, y=train_y, num_iterations=2500)
test_y_pred = model.predict(test_x)

Machine Learning

Example of building, prediction, and training a linear regression:

from enp.ml import LinearRegression
import numpy as np

X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3
reg = LinearRegression().fit(X, y)
prediction = reg.predict(np.array([[3, 5]]))

Linear Algebra

Example of solving a system of linear equations Ax=b:

from enp.linalg import solve_system_of_linear_equations
import numpy as np

a = np.array([[0, -2],
              [4, 7]])
b = np.array([1, 2])
x = solve_system_of_linear_equations(a, b)

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

enp-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

enp-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file enp-0.1.0.tar.gz.

File metadata

  • Download URL: enp-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8

File hashes

Hashes for enp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48a50922274a0012b851a06605a320446b56d077c15a3f2b6e4c7a68d7a3108c
MD5 0da4e2868b46a90358f731c93276ecbf
BLAKE2b-256 8a24496aee0bd21e385c404897bc82de6034c3675db45a12b23631512fe1eb54

See more details on using hashes here.

File details

Details for the file enp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: enp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8

File hashes

Hashes for enp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fce46e8184a8fe79264bc00a1720feca2b2249d825011667ededefd2bd04311
MD5 d298387580d0a3986c0772d013049ed5
BLAKE2b-256 3a805a5bb64b35f73f76fae27d7debfedc35f4dd35972230517df457d616c771

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