Skip to content

Built with ❤️ for the AI community

License

Notifications You must be signed in to change notification settings

iVGeek/neurovision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python License Build Status Version

🧠 NeuroVision

NeuroVision is a comprehensive neural network library built from scratch with a focus on clean code, educational value, and real-time visualization. Whether you're learning deep learning fundamentals or prototyping complex architectures, NeuroVision provides intuitive tools to see exactly how your networks learn.


From zero to neural network in 5 lines of code

from neurovision import NeuralNetwork, NeuralNetworkVisualizer
nn = NeuralNetwork([2, 16, 8, 1], learning_rate=0.1)
history = nn.train(X_train, y_train, epochs=1000)
visualizer = NeuralNetworkVisualizer()
visualizer.create_dashboard(nn, X_test, y_test, history)

✨ Key Features

🧠 Advanced Neural Networks

  1. From-scratch implementation with pure NumPy
  2. Multiple architectures: Feedforward, Deep, Wide networks
  3. Smart optimization: Adam, SGD with momentum, Learning rate scheduling
  4. Advanced activations: ReLU, Sigmoid, Tanh, Leaky ReLU
  5. Regularization: L2, Early stopping, Gradient clipping

📊 Real-Time Visualization

  1. Live training dashboard with 7+ interactive plots
  2. Decision boundary animations that evolve during training
  3. Weight distribution and gradient flow analysis
  4. Performance metrics tracking with professional charts

⚡Production Ready

  1. Comprehensive testing with 95%+ code coverage
  2. Modular architecture for easy extension
  3. Type hints and documentation throughout
  4. Benchmarking suite for performance analysis

🎓 Educational Focus

  1. Clear, readable code perfect for learning
  2. Multiple dataset types for experimentation
  3. Step-by-step examples from basic to advanced
  4. Visual debugging of training dynamics

🚀 Installation

  1. Basic Installation
pip install neurovision
  1. Development Installation

Clone the repository

git clone https://github.com/iVGeek/neurovision.git
cd neurovision

###  Install in development mode
pip install -e .

###  Install with all optional dependencies
pip install -e ".[full]"

###  Run tests to verify installation
pytest tests/
Requirements
Python 3.8+
NumPy
Matplotlib
Scikit-learn

💡 Quick Start

Basic Classification Example

import numpy as np
from neurovision import NeuralNetwork, NeuralNetworkVisualizer
from neurovision.utils.data_loader import generate_complex_dataset

1. Generate a complex dataset

X_train, X_test, y_train, y_test = generate_complex_dataset(
    n_samples=1000, 
    dataset_type='moons'
)

2. Create a neural network

nn = NeuralNetwork(
    layers=[2, 16, 8, 1],           # Input: 2 features, Hidden: 16→8, Output: 1
    learning_rate=0.1,              # Adaptive learning rate
    activation='relu',              # ReLU activation for hidden layers
    regularization=0.001,           # L2 regularization
    optimizer='adam'                # Adam optimizer for faster convergence
)

3. Train the network

history = nn.train(
    X_train, 
    y_train.reshape(-1, 1), 
    epochs=1000,
    batch_size=32,
    validation_data=(X_test, y_test),
    early_stopping=True,
    patience=50
)

4. Evaluate performance

test_metrics = nn.evaluate(X_test, y_test.reshape(-1, 1))
print(f"🎯 Test Accuracy: {test_metrics['accuracy']:.4f}")
print(f"📉 Test Loss: {test_metrics['loss']:.4f}")

5. Create comprehensive visualizations

visualizer = NeuralNetworkVisualizer()
dashboard = visualizer.create_dashboard(nn, X_test, y_test, history)
Command Line Interface

# Run the basic demo
neurovision-demo

# Run comprehensive benchmarks
neurovision-benchmark

Start Jupyter with examples

jupyter notebook
📸 Visualization Gallery
NeuroVision provides stunning visualizations to understand your model's behavior:
Live Training Dashboard
https://via.placeholder.com/800x400/37474f/ffffff?text=Live+Training+Dashboard
Decision Boundary Evolution
https://via.placeholder.com/600x300/37474f/ffffff?text=Decision+Boundary+Evolution
Performance Analytics
https://via.placeholder.com/700x350/37474f/ffffff?text=Performance+Analytics

🔬 Advanced Usage

Custom Architectures

Deep network for complex patterns

deep_nn = NeuralNetwork(
    layers=[2, 64, 32, 16, 8, 4, 1],
    learning_rate=0.01,
    activation='leaky_relu'
)

Wide network for feature learning

wide_nn = NeuralNetwork( layers=[2, 128, 64, 1], learning_rate=0.1, regularization=0.01 )

Live Training Visualization

from neurovision.visualization.animator import LiveTrainingVisualizer

#### Create live visualizer

visualizer = LiveTrainingVisualizer(nn, X_train, y_train) visualizer.start()

Train with real-time updates

history = nn.train(X_train, y_train, epochs=500)

visualizer.stop()
Hyperparameter Optimization
python
from neurovision.utils.metrics import benchmark_performance

Test multiple configurations

architectures = [[2, 16, 1], [2, 32, 16, 1], [2, 64, 32, 16, 1]]
learning_rates = [0.1, 0.01, 0.001]

results = benchmark_performance(
    architectures, 
    datasets, 
    learning_rate=learning_rates,
    epochs=300
)
Ensemble Methods
python
# Create ensemble of networks
n_models = 5
predictions = []

for i in range(n_models):
    model = NeuralNetwork([2, 16, 8, 1])
    model.train(X_train, y_train, epochs=200)
    pred = model.predict(X_test)
    predictions.append(pred)

Majority voting

ensemble_pred = (np.mean(predictions, axis=0) > 0.5).astype(int)
ensemble_accuracy = np.mean(ensemble_pred == y_test.T)

🏗️ Architecture

Code Structure

neurovision/
├── core/                 # Neural network implementation
│   ├── neural_network.py  # Main network class
│   └── activations.py     # Activation functions
├── visualization/        # Visualization tools
│   ├── plotter.py        # Static plots
│   └── animator.py       # Live animations
├── utils/               # Utilities
│   ├── data_loader.py    # Dataset generation
│   └── metrics.py        # Performance metrics
└── examples/            # Usage examples
    ├── basic_demo.py     # Getting started
    ├── advanced_demo.py  # Advanced features
    └── benchmark_demo.py # Performance tests

Neural Network Architecture

Input Layer (Features)
         ↓
Hidden Layer 1 (ReLU) → Batch Normalization → Dropout
         ↓
Hidden Layer 2 (ReLU) → Batch Normalization → Dropout
         ↓
Output Layer (Sigmoid/Tanh)
         ↓
Loss Calculation + Backpropagation

📊 Performance

Benchmark Results
Architecture	Moons Dataset	Circles Dataset	Spiral Dataset	Training Time
[2, 16, 1]	97.3%	96.8%	95.2%	12.4s
[2, 32, 16, 1]	98.1%	97.5%	96.8%	18.7s
[2, 64, 32, 16, 1]	98.5%	98.2%	97.9%	25.3s

###Optimization Features

  1. Vectorized operations for maximum performance
  2. Mini-batch training with configurable sizes
  3. Smart initialization (Xavier/Glorot)
  4. Gradient checking for numerical stability

🤝 Contributing

We love contributions! Here's how you can help:


Reporting Issues

  1. Bug reports
  2. Feature requests
  3. Documentation improvements

Code Contributions

Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request

Development Setup

Set up development environment

git clone https://github.com/yourusername/neurovision.git
cd neurovision
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

Install development dependencies

pip install -e ".[dev]"

Run tests

pytest tests/ --cov=neurovision --cov-report=html

Code formatting

black neurovision/ tests/ flake8 neurovision/ tests/ Areas Needing Contribution Additional activation functions

More optimization algorithms

GPU acceleration support

Additional visualization types

More dataset loaders


📚 Documentation

For detailed documentation, check out:

Getting Started - Installation and basic usage

API Reference - Complete class and method documentation

Examples Gallery - Code examples from basic to advanced

Theory Guide - Mathematical foundations and algorithms


Quick Links

Tutorials: Step-by-step learning guides

API Docs: Complete reference documentation

Examples: Ready-to-run code samples

Benchmarks: Performance comparisons


🏆 Citation

If you use NeuroVision in your research or projects, please cite:

bibtex @software{neurovision2024, title = {NeuroVision: An Intelligent Neural Network Library with Real-Time Visualization}, author = {NeuroVision Team}, year = {2024}, url ={https://github.com/iVGeek/neurovision}, version = {1.0.0} }


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

Inspired by Andrew Ng's Machine Learning course

Visualization techniques from matplotlib and seaborn communities

Optimization methods from deep learning research papers

Testing infrastructure from the Python open-source ecosystem


🔮 Future Roadmap

  1. Version 1.1.0 (Upcoming)
  2. Convolutional Neural Networks
  3. Recurrent Neural Networks (LSTM/GRU)
  4. Autoencoder support
  5. Transfer learning utilities

Version 1.2.0 (Planned)

  1. GPU acceleration with CuPy
  2. Distributed training support
  3. Model deployment tools
  4. Web-based visualization dashboard

Version 2.0.0 (Future)

  1. Reinforcement learning modules
  2. Generative Adversarial Networks
  3. Transformer architectures
  4. Production deployment pipeline

Built with ❤️ for the AI community "The beautiful thing about learning is that nobody can take it away from you." - B.B. King

About

Built with ❤️ for the AI community

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Languages