This directory contains a batch script to run all models automatically.
Simply double-click run_all_models.bat or run_all_models.cmd, or run from command line:
run_all_models.batThe script will:
- Create logs directory (if it doesn't exist)
- Run data preprocessing (
data_preprocessing.R) - Run all 8 models sequentially:
- Model 01: GLM Lasso (lambda.min)
- Model 02: GLM Lasso (lambda.1se)
- Model 03: Random Forest
- Model 04: Ranger
- Model 05: XGBoost
- Model 06: Simple GLM
- Model 07: Neural Network (REVIEW_TEXT only)
- Model 08: Neural Network (REVIEW_TEXT + REVIEW_TITLE)
All console output is saved to the logs/ directory with timestamped filenames:
01_data_preprocessing_YYYYMMDD_HHMMSS.log02_model_01_glm_lasso_min_YYYYMMDD_HHMMSS.log03_model_02_glm_lasso_1se_YYYYMMDD_HHMMSS.log04_model_03_random_forest_YYYYMMDD_HHMMSS.log05_model_04_ranger_YYYYMMDD_HHMMSS.log06_model_05_xgboost_YYYYMMDD_HHMMSS.log07_model_06_simple_glm_YYYYMMDD_HHMMSS.log08_model_07_neural_network_YYYYMMDD_HHMMSS.log09_model_08_neural_network_titles_YYYYMMDD_HHMMSS.log
All model visualizations are automatically saved to the figures/ directory.
Trained models are saved to the root directory:
reviews.train.RData(training data)rf.mtry.RData(Random Forest model)reviews.rf.RData(Ranger model)fakereview.keras(Neural Network model 07)fakereview_titles.keras(Neural Network model 08)
- If data preprocessing fails, the script will stop and show an error message
- If individual models fail, the script will continue with remaining models and show warnings
- Check the corresponding log files for detailed error messages
- Neural Network Models: Models 07 and 08 require
keras3package. If not installed, they will fail gracefully. SeeINSTALL_NEURAL_NETWORK.mdfor installation instructions. - Execution Time: The full batch run may take 30-60 minutes depending on your system:
- Models 01-06: ~5-15 minutes total
- Model 07: ~10-20 minutes
- Model 08: ~15-30 minutes
- Memory: Ensure you have sufficient RAM (recommended: 8GB+)
If you only want to run specific models, you can run them individually:
Rscript model_01_glm_lasso_min.R > logs\model_01.log 2>&1Or in R:
source('model_01_glm_lasso_min.R')- Make sure R is installed and
Rscriptis in your PATH - Check that all R script files exist in the current directory
- Check the corresponding log file in
logs/directory - Ensure all required R packages are installed (see
README_MODELS.md) - For neural network models, ensure
keras3is installed (seeINSTALL_NEURAL_NETWORK.md)
- Check if Rscript is working:
Rscript --version - Check file permissions in the logs directory