# Integrating Machine Learning Techniques for Enhanced Safety and Crime Analysis in Maryland
## 3 Methodology
### Model Comparisons and Performances
were tuned with a learning rate of ~0.1 and moderate tree depths (3-6), with early stopping rounds or regularization applied to curb overfitting (see Table 6 for details). The SVR model required tuning of the kernel hyperparameters (e.g., using an RBF kernel with C ~10 and \(\gamma\) ~0.1 was found to be best). Each model's chosen hyperparameters, along with its resulting test performance, are detailed in Tables 5 and 6. By selecting model settings based on the cross-validation performance, we ensured that each algorithm's capacity was appropriately constrained. This is reflected in the relatively low variance of the test scores across different splits--the models tuned in this manner maintained a stable performance, which is a strong indication that overfitting was minimized. To further assess the generalizability and robustness of each model, we analyzed the variation in the root mean square error (RMSE) across different train-test split ratios (80-20, 75-25, 70-30, and 85-15). As shown in Figure 9, linear models such as linear regression and ridge regression exhibited relatively higher RMSE values across all splits, with noticeable increases at the 85-15 split, suggesting limited adaptability to the reduced training data. In contrast, tree-based ensemble models, particularly the extra trees model and CatBoost, consistently achieved the lowest RMSE values with minimal fluctuation across all splits, indicating strong resistance to overfitting and excellent predictive stability. The stacking regressor and gradient boosting also demonstrated robust performance, maintaining low RMSEs with limited sensitivity to changes in data partitioning. Lasso regression, on the other hand, performed poorly across all configurations, further supporting its unsuitability for modeling the non-linear, high-dimensional structure of the dataset. These results validate the finding that our top-performing models not only offer high predictive accuracy but also sustain performance across varied data availability conditions, reinforcing their reliability for real-world crime prediction tasks. In addition to the tree-based and ensemble methods, several neural network architectures were evaluated to gauge their performance and generalizability. For the implementation of a neural network model tailored to crime data analysis, we deployed a comprehensive approach that includes several sophisticated techniques to enhance its performance. Utilizing a multilayer architecture, each with dense layers paired with dropout regularization and batch normalization, we aimed to manage the complexity and potential overfitting effectively. Notably, the incorporation of EarlyStopping and ReduceLROnPlateau callbacks played a critical role in our training strategy. EarlyStopping halted training once the model ceased showing performance improvements, thereby preventing overtraining, while ReduceLROnPlateau dynamically adjusted the learning rate in response to training progress, optimizing the model's learning phase and leading to improved predictive accuracy and efficiency. Table 7 summarizes the results of the different neural network configurations. Based on these robust performance metrics and comprehensive validation checks, our study identifies the stacking regressor as the chosen model. Before diving into the comparative analysis of various predictive models, it is crucial to highlight the statistical reliability and robustness of the stacking regressor. We conducted several diagnostic tests to verify its adherence to key regression assumptions. The rainbow test showed no evidence of nonlinearity, as evidenced by a non-significant \(p\)-value of 0.298. Similarly, the Durbin-Watson statistic of approximately 2.07 indicated no significant autocorrelation among the residuals. Although the Breusch-Pagan test did reveal some heteroscedasticity, with a \(p\)-value of 0.005, this did not significantly detract from the model's validity, considering its strong cross-validated performance.