0% found this document useful (0 votes)
16 views4 pages

Accident Survival Prediction Model Analysis

A classification model was built to predict accident survival based on factors like age, gender, speed, and safety gear usage, using a dataset of 200 cases. The Random Forest model outperformed others with a balanced F1 score of 55%, while Logistic Regression had the highest precision but lower recall. Key insights indicated that helmet and seatbelt use significantly affect survival rates, and recommendations for model improvement include adding more variables and exploring different algorithms.

Uploaded by

elliptiicclips
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

Accident Survival Prediction Model Analysis

A classification model was built to predict accident survival based on factors like age, gender, speed, and safety gear usage, using a dataset of 200 cases. The Random Forest model outperformed others with a balanced F1 score of 55%, while Logistic Regression had the highest precision but lower recall. Key insights indicated that helmet and seatbelt use significantly affect survival rates, and recommendations for model improvement include adding more variables and exploring different algorithms.

Uploaded by

elliptiicclips
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

I chose to build a classification model to predict whether a person involved in an accident

survives based on age, gender, speed, helmet and seatbelt use. This prediction could be used
to help stakeholders improve safety regulations.

There were 200 accident cases in a csv file I downloaded from Kaggle. I cleaned the data
changing it to binary values, filled in missing info, and created a training testing split 80% to
20%.

I trained it using logistic regression, decision tree, and random forest. The
accuracy/Precision/Recall/F1 score are as follows:

Model 1: Logistic Regression

●​ Accuracy: 57.5%
●​ Precision: 60%
●​ Recall: 45%
●​ F1 Score: 51.4%

Model 2: Decision Tree

●​ Accuracy: 47.5%
●​ Precision: 47.4%
●​ Recall: 45%
●​ F1 Score: 46.1%

Model 3: Random Forest

●​ Accuracy: 55%
●​ Precision: 55%
●​ Recall: 55%
●​ F1 Score: 55%

The Random Forest model performed the best overall, with a balanced precision and recall
(55%), making it the most reliable predictor. While Logistic Regression had higher precision
(60%), it suffered from lower recall (45%), meaning it failed to correctly identify some survival
cases. The Decision Tree performed the worst, likely due to overfitting.

Some key findings and insights were that helmet and seatbelt significantly impacted the survival
rates, higher speed is correlated with lower survival, age plays a moderate role, younger people
survive more, and gender did not really have much of an impact.

Some recommendations were adding more conditions such as weather conditions or time of
day, adjusting the model's hyperparameters, and trying other models like gradient boosting or
neural networks. Using SMOTE. And eventually deploy the model to help people.
This analysis provides valuable insights into factors affecting road accident survival. The
Random Forest model proved to be the best predictor, but further improvements can be made
with additional data and tuning. These insights can be used to inform public safety policies,
vehicle safety features, and accident response strategies.


My python code:​
from sklearn.linear_model import LogisticRegression

from [Link] import DecisionTreeClassifier

from [Link] import RandomForestClassifier

from [Link] import accuracy_score, precision_score, recall_score,


f1_score

from sklearn.model_selection import train_test_split

# Load your dataset

import pandas as pd

df = pd.read_csv("C:\\Users\sigle\OneDrive\Desktop\\[Link]") # Replace
with your file path

# Preprocess the data

df["Gender"].fillna(df["Gender"].mode()[0], inplace=True)

df["Speed_of_Impact"].fillna(df["Speed_of_Impact"].median(), inplace=True)

df["Gender"] = df["Gender"].map({"Male": 0, "Female": 1})

df["Helmet_Used"] = df["Helmet_Used"].map({"No": 0, "Yes": 1})

df["Seatbelt_Used"] = df["Seatbelt_Used"].map({"No": 0, "Yes": 1})


# Define features and target variable

X = [Link](columns=["Survived"])

y = df["Survived"]

# Split dataset into training and testing sets

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,


random_state=42, stratify=y)

# Initialize models

log_reg = LogisticRegression()

decision_tree = DecisionTreeClassifier(random_state=42)

random_forest = RandomForestClassifier(random_state=42)

# Train models

log_reg.fit(X_train, y_train)

decision_tree.fit(X_train, y_train)

random_forest.fit(X_train, y_train)

# Make predictions

log_reg_preds = log_reg.predict(X_test)

decision_tree_preds = decision_tree.predict(X_test)

random_forest_preds = random_forest.predict(X_test)

# Function to evaluate models

def evaluate_model(y_true, y_pred):

return {
"Accuracy": accuracy_score(y_true, y_pred),

"Precision": precision_score(y_true, y_pred),

"Recall": recall_score(y_true, y_pred),

"F1 Score": f1_score(y_true, y_pred),

# Evaluate models

log_reg_results = evaluate_model(y_test, log_reg_preds)

decision_tree_results = evaluate_model(y_test, decision_tree_preds)

random_forest_results = evaluate_model(y_test, random_forest_preds)

# Print results

print("Logistic Regression:", log_reg_results)

print("Decision Tree:", decision_tree_results)

print("Random Forest:", random_forest_results)

Common questions

Powered by AI

Potential improvements include adding additional conditions such as weather and time of day, adjusting model hyperparameters, exploring other models like gradient boosting or neural networks, and implementing SMOTE (Synthetic Minority Over-sampling Technique). These improvements may lead to greater accuracy and robustness of the models. New variables could capture more dynamics affecting survival, enhancing pattern recognition. Hyperparameter tuning can optimize model performance. Advanced models like gradient boosting may offer more nuanced predictions, while SMOTE can address class imbalances, ensuring the model makes better predictions for minority classes .

The Decision Tree model likely underperformed due to overfitting, which occurs when a model learns the training data too well, including noise, and fails to generalize to unseen data. Decision Trees can create overly complex structures that are not representative of the general population's patterns. Unlike Random Forest, which uses multiple decision trees to average their predictions and avoid individual tree biases, a single Decision Tree does not have internal mechanisms to balance out such biases, resulting in poorer performance metrics .

Deploying the trained model in real-world applications faces several challenges, including data privacy concerns, ensuring consistent data quality across different environments, and the need for continuous updates to accommodate new data and evolving patterns. Maintaining model accuracy while addressing regulatory and ethical implications of data use in predictive analytics is crucial. There is also the complexity of integrating predictive models with existing systems and handling potential inaccuracies during dynamic and unforeseen events. Lastly, fostering user trust and acceptance of machine learning recommendations in life-critical applications poses significant cultural and operational barriers .

SMOTE contributes to improving model reliability by addressing class imbalance issues. In survival predictions, negative outcomes (e.g., fatalities) might be less common than positive ones. SMOTE generates synthetic examples for the minority class, enhancing classifier balance. This prevents models from being biased towards the majority class, improving predictive performance. By increasing data diversity and preventing the model from ignoring minority outcomes, SMOTE enhances the classifier's capability to identify and predict survival accurately .

Logistic regression is useful for survival prediction due to its simplicity and interpretability, effectively determining the relationship between probabilities of survival and input variables. However, its main limitations are its lower recall rate (45%), indicating failure in correctly predicting some survival cases. This limitation suggests logistic regression might not fully capture complex patterns in data compared to more sophisticated models like random forests. Its inability to model non-linear relationships reduces its predictive power in scenarios where factors' interactions are complex .

The predictive model for accident survival could influence public safety policies by providing data-driven insights into factors most affecting survival, like helmet and seatbelt use, and speed limits. Policies could emphasize stricter enforcement of safety gear usage and speed regulations to improve survival rates. Additionally, the model's use of data could encourage more evidence-based approaches in designing road safety programs and resource allocation during accident response planning. By highlighting critical areas that affect survivability, stakeholders can create more effective interventions .

The primary factors considered in the survival prediction model were age, gender, speed, helmet and seatbelt use. Helmet and seatbelt use significantly impacted the survival rates, with their absence leading to lower survival chances. Higher speed correlated with lower survival, while younger people had higher survival rates. Gender did not have a significant impact on the outcomes. These findings suggest that protective measures and speed control are critical in enhancing survival chances in accidents .

The preprocessing steps included filling in missing information for 'Gender' with the mode and for 'Speed_of_Impact' with the median, converting categorical values of 'Gender', 'Helmet_Used', and 'Seatbelt_Used' to binary. These steps are crucial to ensure data integrity, allowing models to learn effectively from complete datasets without bias or skew. Filling missing values prevents data loss that could result from dropping incomplete cases. Binary conversion standardizes categorical variables, making them suitable for input to algorithms. These steps help achieve more reliable and valid predictive model outcomes .

The performance metrics across the three models were as follows: Logistic Regression had an Accuracy of 57.5%, Precision of 60%, Recall of 45%, and F1 Score of 51.4%. The Decision Tree had an Accuracy of 47.5%, Precision of 47.4%, Recall of 45%, and F1 Score of 46.1%. The Random Forest had an Accuracy, Precision, and Recall of 55%, and F1 Score of 55%. The Random Forest model performed the best overall due to its balanced precision and recall, making it the most reliable predictor. Although Logistic Regression had higher precision, it lacked in recall, indicating failure in identifying all survival cases correctly. The Decision Tree was the least effective, likely due to overfitting issues .

Inclusion of additional variables like weather conditions and time of day could enhance the model's predictive accuracy by capturing external environmental factors that impact road safety. Bad weather conditions (e.g., rain, fog) and nighttime can increase accident risk and affect survival outcomes. These variables could provide more context to the accident scenarios, enabling the model to identify patterns overlooked when only considering internal factors like age and speed. This increased complexity could help stakeholders develop more targeted safety regulations and response strategies .

You might also like