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.
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
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.
If you use this code in your research, please cite:
@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}
}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.
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- Python 3.11+
- TensorFlow 2.16.1+
- See
environment.ymlfor the complete list of dependencies
The repository includes a Jupyter notebook (training.ipynb) that provides a complete pipeline for training the MCvD-Transformer model.
The training notebook includes the following steps:
- Data Loading: Parse MCvD simulation data from the
datadirectory - Data Splitting: Split dataset into training (70%), validation (20%), and test (10%) sets
- Batch Generation: Create batch generators with data augmentation (rotation, shuffling)
- Model Creation: Initialize the MCvD-Transformer architecture
- Training: Train the model with adaptive loss weighting and learning rate scheduling
- Evaluation: Calculate performance metrics and visualize results
# Activate the conda environment
conda activate mcvd_transformer
# Launch Jupyter Notebook
jupyter notebook training.ipynbYou 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- 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
The training process creates an experiments/MCvD_Transformer/ directory containing:
model.keras: Best trained model weightstrain_error.json: Training set performance metricsval_error.json: Validation set performance metricstest_error.json: Test set performance metrics
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
Place your MCvD simulation data in the data directory. The data parser will automatically process simulation files and prepare them for training.
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.
- Trained model (
.kerasfile) - Topology configuration file (
topology.json) - (Optional) Ground truth data (
time_output.npy)
# 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--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
The script will:
- Load the trained MCvD-Transformer model and topology configuration
- Generate predictions for the Channel Impulse Response (CIR)
- Display or save visualization of the predicted CIR
- If ground truth is provided, compute and display error metrics (MSE, RMSE, MAE)
# 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-plotThe 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.
Below is an example of the Channel Impulse Response (CIR) prediction generated by the MCvD-Transformer model:
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.
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.
.
βββ 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
For questions or issues related to this implementation, please refer to the paper or contact the authors.
