Skip to content

Instantly share code, notes, and snippets.

@DSamuelHodge
Created May 5, 2025 17:18
Show Gist options
  • Select an option

  • Save DSamuelHodge/b40af1dad6c6cecd6f3f4160161caa8e to your computer and use it in GitHub Desktop.

Select an option

Save DSamuelHodge/b40af1dad6c6cecd6f3f4160161caa8e to your computer and use it in GitHub Desktop.

Core AEG Components in the Code

  1. Complex Normalization Function
def normalize(self, z):
    rho = th.abs(z)
    theta = th.atan2(th.imag(z), th.real(z))
    return th.tanh(rho) * (th.cos(theta) + 1.0j * th.sin(theta))

This function maps complex values onto a curved manifold by:

  • Converting to polar coordinates (magnitude rho and phase theta)
  • Applying hyperbolic tangent (tanh) to the magnitude
  • Preserving angular information while bounding magnitude
  1. Flow Transformation
def flow(self, dx, dy, data):
    return data * (1 + dy) + dx

This seemingly simple operation actually defines a complex Möbius-like transformation that:

  • Performs both scaling (data * (1 + dy)) and translation (+ dx)
  • Preserves the hyperbolic structure of the complex plane
  • Creates non-linear geometric mappings
  1. Complex Parameter Dynamics
dx = self.afactor * th.sum(v * th.tanh(w), dim=-1)
dy = self.mfactor * th.tanh(data)
data = self.flow(dx, dy, data)

This creates the actual geometric transformations by:

  • Computing position-dependent scaling and translation
  • Creating curved decision boundaries in the complex plane
  • Establishing hyperbolic paths for information encoding

Mathematical Theorem

Theorem (AEG Hyperbolic Encoding): For complex-valued data z, the AEG normalization N(z) = tanh(|z|)e^(iθ) maps values onto a hyperbolic manifold where:

  1. Values with equal phase lie on radial lines through the origin
  2. Values with equal magnitude lie on concentric circles
  3. The tanh function compresses infinite magnitudes to the unit disc

The key property is that this mapping creates a hyperbolic space where:

  • Distance between points increases exponentially toward the boundary
  • Parallel lines diverge exponentially (unlike Euclidean geometry)
  • Information density increases toward the boundary of the unit disc

How AEG Creates Geometry

  1. The tanh operation maps the complex plane onto a bounded disc (hyperbolic geometry)
  2. The flow operation z ↦ z(1+dy) + dx creates Möbius-like transformations
  3. The combined operations allow the network to encode information along curved geodesics
  4. By learning optimal complex parameters, the network discovers the most efficient geometric encoding of data

This geometric approach differs fundamentally from traditional neural networks, which operate in Euclidean space with linear transformations followed by non-linear activations. AEG instead directly manipulates the geometric structure of the complex plane, enabling more efficient representations using hyperbolic rather than Euclidean geometry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment