Skip to main content

Golden Ratio ReLU activation for Neural Networks

Project description

GldReLU

Golden Ratio ReLU (GldReLU) is a custom activation function for TensorFlow

PyPI version Python Version

Golden Ratio ReLU (GldReLU) is a custom activation function for TensorFlow based on the Golden Ratio constant. It can be used in deep learning models just like other activation, and is especially useful for deep networks in medical imaging and research applications.


$$ GldReLU(x) = \max(0, (\phi - 1))\cdot x $$

where:

$$ \phi = \frac{1 + \sqrt{5}}{2} \approx 1.618 $$

so that:

$$ \phi - 1 \approx 0.618 $$

$$ \text{GldReLU}(x) = \begin{cases} 0.618 , x, & \text{if } x > 0 \[2mm] 0, & \text{if } x \leq 0 \end{cases} $$

Installation

pip install gldrelu

Usage Example

1️ Using "GldReLU" as a string (no function import needed)

import tensorflow as tf
import GldReLU  # registers GldReLU automatically

model = tf.keras.Sequential([
    tf.keras.layers.Dense(128, activation="GldReLU"),
    tf.keras.layers.Dense(10, activation="softmax")
])

model.summary()


###  Using the function directly

from GldReLU import GldReLU
import tensorflow as tf

model = tf.keras.Sequential([
    tf.keras.layers.Dense(128, activation=GldReLU),
    tf.keras.layers.Dense(10, activation="softmax")
])

model.summary()



If you use GldReLU in your research,  cite:

@article{lakshmi2025novel,
  title={A novel GldReLU activation function with enhanced RESNET50 for classification of X-ray images},
  author={Lakshmi, P Pankaja and Sivagami, M},
  journal={Neural Computing and Applications},
  volume={37},
  number={26},
  pages={21997--22028},
  year={2025},
  publisher={Springer}
}

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gldrelu-1.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

gldrelu-1.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file gldrelu-1.1.tar.gz.

File metadata

  • Download URL: gldrelu-1.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for gldrelu-1.1.tar.gz
Algorithm Hash digest
SHA256 af356f5fd645146d7bbfd27a466f921d8343c46b06d3b65e2b12541b0cfb8ba9
MD5 184701084154861847d18bc846edbfc9
BLAKE2b-256 8d4b987d194c58e99c29ebad95abbc10060d85e7aeaf8113fe82246fadba6b9f

See more details on using hashes here.

File details

Details for the file gldrelu-1.1-py3-none-any.whl.

File metadata

  • Download URL: gldrelu-1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for gldrelu-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0c92d97b69b16f30eae9bc80f5524b0934616cea83e3eff28d95e504679e560
MD5 11047831bdafdb490751d841df76732d
BLAKE2b-256 40d6802e6fb90d8afd07c5a221482bc5e3fb3a90937163f8a832f865f97dd24e

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