Skip to main content

HyperFlow: Next-Generation Computational Framework for Machine Learning & Deep Learning

Project description

HyperFlow: Next-Generation Computational Framework for Machine Learning & Deep Learning

Project Image

๐Ÿ“„ Read the Full Documentation

๐Ÿš€ Introduction

HyperFlow is an advanced computational framework designed to enhance machine learning and deep learning research. At its core is the FlowUnit class, an optimized and modular implementation supporting:

  • ๐Ÿ”ข Mathematical operations
  • โš™๏ธ Activation functions
  • ๐Ÿ“‰ Optimization techniques
  • ๐Ÿ”„ Backpropagation

HyperFlow provides simplicity and power, making it ideal for understanding neural networks, automatic differentiation, and optimization techniques.

๐ŸŽฏ Inspiration

Inspired by Micrograd by Andrej Karpathy, HyperFlow extends its capabilities by offering:

  • ๐Ÿš€ Advanced mathematical operations
  • ๐ŸŽฏ Broader activation function support
  • โšก Optimized backpropagation
  • ๐Ÿ” Enhanced modularity

It serves as a lightweight yet powerful alternative to complex deep learning frameworks like PyTorch.

๐Ÿ’ก Why HyperFlow?

โœ… Lightweight & Transparent โ€“ Focuses on raw Python implementations to help understand ML/DL concepts.
โšก Efficient & Optimized โ€“ Uses map functions for better performance.
๐Ÿ”ง Flexible & Powerful โ€“ Supports neural networks, including backpropagation.
๐Ÿ“‰ Minimal NumPy Dependency โ€“ Encourages learning without excessive reliance on pre-built libraries.

๐Ÿ”‘ Core Functionalities

๐Ÿ”ข Mathematical Operations

  • create2darray, convert2darray, add, sub, mul, matmul, dot, pow

โš™๏ธ Activation Functions

  • sigmoid, tanh, ReLU, Leaky ReLU, softmax

๐Ÿ“‰ Loss Functions

  • categorical_cross_entropy, binary_cross_entropy, mse_loss

๐Ÿ”„ Optimization & Backpropagation

  • backpropagate, gradient_descent

๐Ÿง  Neural Network Implementation

The Neuron.py module simplifies the creation of:

  • ๐Ÿ— Neurons
  • ๐Ÿ”— Layers
  • ๐Ÿ› Complete Neural Networks

This module offers full control over weights, biases, and architecture for in-depth experimentation.

๐Ÿ“Œ Examples & Outputs

โœ… Dot Product Calculation

from hyperflow import FlowUnit

a = FlowUnit([1, 2, 3])
b = FlowUnit([4, 5, 6])

result = a.__dot__(b)
print(f"Dot product result: {result.data}")

Output:

Dot product result: 32

๐Ÿ”„ Backpropagation Test

def test_backpropagation():
    x = FlowUnit(2.0)
    y = FlowUnit(-3.0)
    z = FlowUnit(1.5)

    a = x.sigmoid()
    b = y.tanh()
    c = z.relu()
    d = x.leaky_relu()

    loss = a + b + c + d
    loss.backpropagate()

    print(f"x.grad: {x.grad}")
    print(f"y.grad: {y.grad}")
    print(f"z.grad: {z.grad}")

test_backpropagation()

Output:

x.grad: 1.1049935854035067
y.grad: 0.00986603716543999
z.grad: 1.0

๐Ÿ”ข Activation Function Tests

def test_flow_unit_functions():
    data = np.array([1.0, 2.0, 3.0])
    flow_unit = FlowUnit(data)

    sigmoid_out = flow_unit.sigmoid()
    print("Sigmoid Output:", sigmoid_out.data)

    tanh_out = flow_unit.tanh()
    print("Tanh Output:", tanh_out.data)

    relu_out = flow_unit.relu()
    print("ReLU Output:", relu_out.data)

    leaky_relu_out = flow_unit.leaky_relu(alpha=0.01)
    print("Leaky ReLU Output:", leaky_relu_out.data)

    softmax_out = flow_unit.softmax()
    print("Softmax Output:", softmax_out.data)

test_flow_unit_functions()

Output:

Sigmoid Output: [0.731 0.880 0.952]
Tanh Output: [0.761 0.964 0.995]
ReLU Output: [1.0 2.0 3.0]
Leaky ReLU Output: [1.0 2.0 3.0]
Softmax Output: [0.090 0.244 0.665]

๐Ÿ“‰ Loss Function Tests

def test_loss_functions():
    logits = FlowUnit(np.array([2.0, 1.0, 0.1]))
    target = [1, 0, 0]

    cce_loss = LossFunctions.categorical_cross_entropy(logits, target)
    print("Categorical Cross-Entropy Loss:", cce_loss.data)

    inputs = FlowUnit(np.array([[1.0, 2.0], [3.0, 4.0]]))
    target = FlowUnit(np.array([1, 0]))
    parameters = (FlowUnit(np.array([0.5, -0.5])), FlowUnit(0.1))

    bce_loss = LossFunctions.binary_cross_entropy_loss(inputs, target, parameters)
    print("Binary Cross-Entropy Loss:", bce_loss.data)

test_loss_functions()

Output:

Categorical Cross-Entropy Loss: 0.417
Binary Cross-Entropy Loss: [0.715]

๐Ÿ“š Explore More Use Cases

Find more examples and use cases in the GitHub repository.

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

hyperflow_package-1.0.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

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

HyperFlow_Package-1.0.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file hyperflow_package-1.0.0.tar.gz.

File metadata

  • Download URL: hyperflow_package-1.0.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for hyperflow_package-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3d489de391adcca4f1f348655a6fdd970894c0b7caf3abe9b2bb39c22b81fd57
MD5 116f578f00875dc99cdab6bfab183a74
BLAKE2b-256 6998343e627712184e7216707476407ca03422127c044bbd31822bc16c045e6f

See more details on using hashes here.

File details

Details for the file HyperFlow_Package-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for HyperFlow_Package-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dfb40fa0e8904cc7ffa11e6acd71418603a3f7c43b33a21709953c1a8f5b583
MD5 21f0f2b233ff67c8e34fe47d99fe06bf
BLAKE2b-256 b2c5aeda8ea46f1f110279139c560b9836d86d0ae02b8e3b499c61f6288ea0cd

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