Metaheuristic hyperparameter optimization for CNN-based Twitter sentiment analysis. This project provides a modular Python package to preprocess tweet data, build and evaluate CNN models, and optimize both model and optimizer hyperparameters using multiple metaheuristic algorithms.
- Two-phase optimization:
- Phase 1: Optimize CNN hyperparameters (HC, PSO, SA, Tabu)
- Phase 2: Optimize metaheuristic hyperparameters (ACO, Bat Algorithm, internal tuning)
- Tokenization and preprocessing pipeline (NLTK)
- Modular optimizers (each algorithm in its own module)
- CLI with configurable hyperparameter ranges and algorithm settings
- Unit tests (pytest) and CI workflow (GitHub Actions)
- Docker support for reproducible runs
- JSON logging for experiment tracking and analysis tools
- Clone the repo: git clone https://github.com/aadhamashraf/MetaOpt-CNN-for-Twitter-Sentiment-Classification.git
- Install dependencies: pip install -r requirements.txt
- Run Phase 1 (example): python main.py --phase 1 --csv path/to/twitter_training.csv
- Run Phase 2 (example): python main.py --phase 2 --csv path/to/twitter_training.csv
- --phase [1|2] : Choose optimization phase
- --csv PATH : Path to dataset CSV (defaults to twitter_training.csv)
- --search-space-file PATH : JSON file with hyperparameter ranges
- --pso-particles N
- --pso-iters N
- --hc-iters N
- --sa-iters N
- --ts-iters N
- --aco-ants N
- --aco-iters N
- --ba-bats N
- --ba-iters N
(See main.py --help for full list)
- src/
- config.py
- logger.py
- data.py
- cnn.py
- optimizers/
- init.py
- aco.py
- bat.py
- pso.py
- hill_climb.py
- simulated_annealing.py
- tabu.py
- tuner.py
- run_phase1.py
- run_phase2.py
- analyze.py
- tests/
- Dockerfile
- requirements.txt
- README.md
Logs are written to optimization_log.json by default.