# AI-Driven Phishing Detection: Enhancing Cybersecurity with Reinforcement Learning
## 5 Model Ongoing Training  
### Training Dataset and Feature Processing  
Building on the methodology outlined in the previous section, the training phase was designed to optimize the DQN-based RL phishing detection system. Our approach focused on maximizing adaptability, minimizing false positives, and achieving high detection accuracy. The training process involved multiple stages, from dataset interaction to real-time parameter adjustments, ensuring that the model could effectively learn phishing detection patterns through trial-and-error reinforcement. TensorFlow v2.13.0, a widely used open-source ML framework, was employed to construct and optimize the neural network architecture supporting the DQN model. To create a realistic phishing detection scenario, the RL agent was trained using 4000 emails (2000 phishing and 2000 benign), sampled from the full dataset of 5000 emails (2500 phishing + 2500 benign), consisting of the following:  
* 2500 phishing emails (extracted from the PhishTank database and other public datasets [30]);
* 2500 benign emails (collected from real-world email traffic under controlled conditions). Each email underwent feature extraction (as described in the methodology section), producing structured input data that was then fed into the RL model. During training, the agent continuously interacted with the dataset and updated its decision-making policy based on reward-based learning, where correct classifications received positive reinforcement, while misclassifications (false positives/false negatives) were penalized. The training process was executed over 10,000 episodes, where the RL agent classified emails as phishing or benign while continuously refining its detection policy. At each step, the agent received rewards for correct classifications and penalties for false positives or false negatives. The training leveraged TensorFlow's dynamic optimization to fine-tune performance in real-time. The section and Table 4 below summarize the key parameters used during the model training:  
* Total Training Episodes: 10,000;
* Exploration Strategy: Epsilon-Greedy (balancing exploration of new decisions vs. exploiting known patterns);
* Discount Factor: 0.95 (controlling the influence of future rewards on current decisions);
* Learning Rate: 0.001 (adjusting how quickly the model updates based on new information);
* Batch Size: 64 (number of emails processed per learning step). * Target Network Update Frequency: Every 100 steps (stabilizing training to avoid policy divergence);
* Reward Function; (phishing or benign): Rewarded
* Correct Classification (phishing or benign): Rewarded;
* False Positives: Penalized;
* False Negatives: Heavily penalized to ensure phishing threats are prioritized. This adaptive reward mechanism improved detection accuracy while reducing false positives, a significant challenge in conventional phishing detection models. Through this setup, TensorFlow allowed us to iterate and fine-tune the model's behavior, ensuring that it adapted well to the phishing threats while minimizing false positives. The model achieved a final accuracy of 95% with a 2% false positive rate, significantly outperforming traditional models averaging 85-87% accuracy and higher false positive rates. The training process was executed over 10,000 episodes, where the RL agent classified emails as phishing or benign while continuously refining its detection policy. At each step, the agent received rewards for correct classifications and penalties for false positives or false negatives. The training leveraged TensorFlow's dynamic optimization to fine-tune performance in real-time. Through this setup, TensorFlow allowed us to iterate and fine-tune the model's behavior, ensuring that it adapted well to phishing threats while minimizing false positives. The model achieved a final 95% accuracy with a 2% false positive rate, significantly outperforming traditional models, which averaged as an 85-87% accuracy with higher false positive rates.