Skip to content

Neural Network Inside Viewer with 3D Visualization#1045

Open
konard wants to merge 3 commits into
masterfrom
issue-618-856ffeb9
Open

Neural Network Inside Viewer with 3D Visualization#1045
konard wants to merge 3 commits into
masterfrom
issue-618-856ffeb9

Conversation

@konard

@konard konard commented Oct 26, 2025

Copy link
Copy Markdown
Owner

Neural Network Inside Viewer

This PR implements a complete solution for issue #618: loading neural network topologies with weights into a Doublets database and visualizing how they look from inside.

Features

1. Neural Network to Doublets Converter

  • Python-based loader (neural-network-loader.py) that:
    • Parses neural networks from JSON format
    • Converts network structure to Doublets representation
    • Creates links for networks, layers, neurons, connections, weights, and biases
    • Exports visualization-ready data

2. Interactive 3D Visualization

  • Web-based viewer (neural-network-viewer.html) featuring:
    • Three.js-powered 3D graphics with smooth camera controls
    • Color-coded layers: Input (green), Hidden (blue), Output (magenta)
    • Connection visualization: Weight magnitude shown via line opacity
    • Interactive controls: Rotate, zoom, pan, adjust spacing
    • Real-time statistics: Network info, link counts, layer/neuron counts
    • Optional animation: Pulsing effect to show network activity

3. Sample Networks

Three example networks demonstrating different complexities:

  • XOR Network (2-3-1): Simple logic function
  • Simple Classifier (4-6-4-3): Multi-layer classifier
  • Deep Network (3-8-6-4-3-2): Deep architecture with 5 hidden layers

Doublets Representation Design

The system encodes neural networks in Doublets as follows:

Network (root link)
  ├─ Layer links (connected to network root)
  │    ├─ Neuron links (within each layer)
  │    │    ├─ Bias links (neuron properties)
  │    │    └─ Connection links (to neurons in previous layer)
  │    │         └─ Weight values (connection properties)

Each component type uses semantic markers:

  • NetworkType, LayerType, NeuronType
  • ConnectionType, WeightType, BiasType

This allows querying patterns like:

  • "Find all neurons with bias > 0"
  • "Find all connections with negative weights"
  • "Count total parameters in the network"

Usage

# Convert a network to Doublets
cd examples/neural-network-viewer
python3 neural-network-loader.py sample-networks/xor-network.json

# Open neural-network-viewer.html in a browser
# Click "Load Network" and select the generated *-doublets.json file

Test Results

All sample networks successfully convert and visualize:

  • XOR Network: 27 total links (2 input, 3 hidden, 1 output, 7 connections)
  • Simple Classifier: 93 total links (4 input, 6+4 hidden, 3 output, 52 connections)
  • Deep Network: 161 total links (3 input, 8+6+4+3 hidden, 2 output, 99 connections)

Future Enhancements

The foundation supports future additions:

  • ONNX format import
  • PyTorch/TensorFlow model import
  • Training history visualization
  • Gradient flow animation
  • Network diff comparison
  • Interactive editing
  • Export to other formats

Files Added

  • examples/neural-network-viewer/README.md - Comprehensive documentation
  • examples/neural-network-viewer/neural-network-loader.py - Converter script
  • examples/neural-network-viewer/neural-network-viewer.html - 3D viewer
  • examples/neural-network-viewer/sample-networks/*.json - Example networks

Screenshots

The viewer provides an immersive 3D experience showing the internal structure of neural networks stored as Doublets links, making it easy to understand and explore how neural networks are represented in associative memory.


Fixes #618

Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 26, 2025
This implementation addresses issue #618 by providing a complete system
to load neural network topologies with weights into a Doublets database
and visualize them from inside.

Features:
- Neural network to Doublets converter (Python)
- Interactive 3D web-based viewer (Three.js)
- Sample networks (XOR, classifier, deep network)
- Comprehensive documentation

The system represents neural networks in Doublets as:
- Network root link
- Layer links connected to network
- Neuron links within each layer
- Connection links with weights between neurons
- Bias links for each neuron

The 3D viewer allows:
- Interactive rotation, zoom, and pan
- Layer-based coloring (input=green, hidden=blue, output=magenta)
- Connection visualization with weight-based opacity
- Real-time statistics display
- Adjustable spacing controls
- Optional pulsing animation

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Artificial neural network inside viewer Neural Network Inside Viewer with 3D Visualization Oct 26, 2025
@konard konard marked this pull request as ready for review October 26, 2025 11:15
@konard

konard commented Oct 26, 2025

Copy link
Copy Markdown
Owner Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

📎 Log file uploaded as GitHub Gist (344KB)
🔗 View complete solution draft log


Now working session is ended, feel free to review and add any feedback on the solution draft.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Artificial neural network inside viewer

1 participant