Skip to content

Latest commit

Β 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Estimating Channel Coefficients for Complex Topologies in 3D Diffusion Channel using Artificial Neural Networks

This repository contains the implementation of the MCvD-Transformer model for estimating channel coefficients in 3D molecular communication diffusion channels with complex topologies.

πŸ“„ Paper

This code implements the methodology described in:

Ozdemir, H. U., Orhan, H. I., Turan, M., Büyüktaş, B., & Yilmaz, H. B. (2024). Estimating channel coefficients for complex topologies in 3D diffusion channel using artificial neural networks. Nano Communication Networks, 42, 100549.

πŸ”— Paper Link: https://www.sciencedirect.com/science/article/abs/pii/S1878778924000553

Abstract

The paper presents a novel approach using artificial neural networks (specifically, the MCvD-Transformer architecture) to estimate channel impulse responses in molecular communication systems with complex 3D topologies. This method significantly reduces computational complexity compared to traditional particle-based simulations while maintaining high accuracy.

πŸŽ“ Citation

If you use this code in your research, please cite:

BibTeX

@article{ozdemir2024estimating,
  title={Estimating channel coefficients for complex topologies in 3D diffusion channel using artificial neural networks},
  author={Ozdemir, Halil Umut and Orhan, Halil Ibrahim and Turan, Meric and B{\"u}y{\"u}kta{\c{s}}, Bari{\c{s}} and Yilmaz, H Birkan},
  journal={Nano Communication Networks},
  volume={42},
  pages={100549},
  year={2024},
  publisher={Elsevier}
}

APA Format

Ozdemir, H. U., Orhan, H. I., Turan, M., Büyüktaş, B., & Yilmaz, H. B. (2024). Estimating channel coefficients for complex topologies in 3D diffusion channel using artificial neural networks. Nano Communication Networks, 42, 100549.

πŸ› οΈ Installation

Environment Setup

This repository uses Conda for environment management. Follow these steps to set up the environment:

# Clone the repository
git clone [your-repository-url]
cd [repository-name]

# Create conda environment from environment.yml
conda env create -f environment.yml

# Activate the environment
conda activate mcvd_transformer

Requirements

  • Python 3.11+
  • TensorFlow 2.16.1+
  • See environment.yml for the complete list of dependencies

🎯 Training

Training the Model

The repository includes a Jupyter notebook (training.ipynb) that provides a complete pipeline for training the MCvD-Transformer model.

Training Pipeline Overview

The training notebook includes the following steps:

  1. Data Loading: Parse MCvD simulation data from the data directory
  2. Data Splitting: Split dataset into training (70%), validation (20%), and test (10%) sets
  3. Batch Generation: Create batch generators with data augmentation (rotation, shuffling)
  4. Model Creation: Initialize the MCvD-Transformer architecture
  5. Training: Train the model with adaptive loss weighting and learning rate scheduling
  6. Evaluation: Calculate performance metrics and visualize results

Running the Training Notebook

# Activate the conda environment
conda activate mcvd_transformer

# Launch Jupyter Notebook
jupyter notebook training.ipynb

Training Parameters

You can modify the following key parameters in the notebook:

batch_size = 64          # Batch size for training
num_epochs = 400         # Number of training epochs
data_seed = 1            # Random seed for data splitting
numpy_seed = 10          # Random seed for numpy operations
dataloader_seed = 50     # Random seed for data loading

Training Features

  • Data Augmentation: Random rotation and entity order shuffling
  • Coordinate Systems: Supports both Cartesian and spherical coordinate systems
  • Adaptive Loss Weighting: Dynamic adjustment of loss weights during training
  • Learning Rate Scheduling: Custom learning rate scheduler for optimal convergence
  • Model Checkpointing: Automatically saves the best model based on validation loss

Training Output

The training process creates an experiments/MCvD_Transformer/ directory containing:

  • model.keras: Best trained model weights
  • train_error.json: Training set performance metrics
  • val_error.json: Validation set performance metrics
  • test_error.json: Test set performance metrics

Visualization

The notebook includes cells for:

  • Plotting training/validation loss curves
  • Visualizing Channel Impulse Response (CIR) predictions vs ground truth
  • 3D visualization of molecular communication topologies

Data Requirements

Place your MCvD simulation data in the data directory. The data parser will automatically process simulation files and prepare them for training.

πŸš€ Inference

The inference.py script allows you to make predictions using a trained MCvD-Transformer model to estimate Channel Impulse Response (CIR) for molecular communication systems.

Prerequisites

  • Trained model (.keras file)
  • Topology configuration file (topology.json)
  • (Optional) Ground truth data (time_output.npy)

Basic Usage

# Basic prediction without ground truth
python inference.py --model model.keras --topology topology.json

# Prediction with ground truth comparison
python inference.py --model model.keras --topology topology.json --ground-truth time_output.npy

# Save plot instead of displaying
python inference.py --model model.keras --topology topology.json --output-dir results --visualize-topology

Arguments

  • --model: Path to the trained model file (required)
  • --topology: Path to the topology configuration file (required)
  • --ground-truth: Path to the ground truth time output file (optional)
  • --intended-index: Index of the intended absorber (default: 0)
  • --output-dir: Directory to save visualization results (default: 'results')
  • --visualize-topology: Show the visualization plot instead of displaying it

Output

The script will:

  1. Load the trained MCvD-Transformer model and topology configuration
  2. Generate predictions for the Channel Impulse Response (CIR)
  3. Display or save visualization of the predicted CIR
  4. If ground truth is provided, compute and display error metrics (MSE, RMSE, MAE)

Example

# Full example with all options
python inference.py \
    --model experiments/MCvD_Transformer/model.keras \
    --topology path/to/topology.json \
    --ground-truth path/to/time_output.npy \
    --intended-index 0 \
    --output-dir ./results \
    --save-plot

Error Handling

The script includes comprehensive error handling for:

  • Missing files
  • Invalid model format
  • Incorrect topology format
  • Shape mismatches
  • Invalid parameters

Error messages will provide clear information about what went wrong.

πŸ“Š Example Results

Below is an example of the Channel Impulse Response (CIR) prediction generated by the MCvD-Transformer model:

Inference Result

Figure: Comparison between ground truth CIR (from particle-based simulation) and MCvD-Transformer prediction for a complex 3D molecular communication topology. The model accurately estimates the channel coefficients with significantly reduced computational cost.

πŸ“š About Molecular Communication

Molecular communication is a bio-inspired communication paradigm where information is transmitted using molecules as carriers. This implementation focuses on 3D diffusion channels with complex topologies, which are relevant for:

  • Nano-scale communication networks
  • Drug delivery systems
  • Biosensing applications
  • Intra-body communication networks

The MCvD-Transformer model significantly reduces the computational cost of estimating channel coefficients compared to traditional particle-based simulations, making it practical for real-time applications and large-scale system design.

πŸ“ Repository Structure

.
β”œβ”€β”€ environment.yml              # Conda environment configuration
β”œβ”€β”€ training.ipynb              # Training pipeline notebook
β”œβ”€β”€ inference.py                # Inference script
β”œβ”€β”€ data/                       # MCvD simulation data directory
β”œβ”€β”€ experiments/                # Training outputs and saved models
β”‚   └── MCvD_Transformer/
β”‚       β”œβ”€β”€ model.keras        # Trained model
β”‚       β”œβ”€β”€ train_error.json   # Training metrics
β”‚       β”œβ”€β”€ val_error.json     # Validation metrics
β”‚       └── test_error.json    # Test metrics
└── mcvd_transformer/          # Source code package
    β”œβ”€β”€ dataset/               # Data loading and processing
    β”œβ”€β”€ model/                 # Model architecture and training
    └── utils/                 # Utility functions

πŸ“§ Contact

For questions or issues related to this implementation, please refer to the paper or contact the authors.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages