Question: Subset the data to include only the accidents that occurred in one city or during one month. Develop a decision tree model that predicts whether
Subset the data to include only the accidents that occurred in one city or during one month. Develop a decision tree model that predicts whether an automobile accident results in fatal or severe injuries using predictor variables, such as traffic violation category, weather condition, type of collision, location of the accident, and lighting condition.
| ID | County | City | Weekday | Severity | ViolCat | ClearWeather | Month | CrashType | Highway | Daylight |
| 1 | SAN DIEGO | SAN DIEGO | 7 | 1 | 8 | 0 | 1 | A | 0 | 1 |
| 2 | HUMBOLDT | UNINCORPORATED | 4 | 1 | 8 | 1 | 1 | A | 1 | 0 |
| 3 | VENTURA | OXNARD | 2 | 1 | 12 | 1 | 2 | A | 0 | 1 |
| 4 | STANISLAUS | UNINCORPORATED | 4 | 1 | 1 | 1 | 1 | A | 0 | 0 |
| 5 | MENDOCINO | UNINCORPORATED | 5 | 1 | 1 | 1 | 1 | A | 1 | 0 |
| 6 | LOS ANGELES | LONG BEACH | 7 | 1 | 3 | 1 | 3 | A | 0 | 0 |
| 7 | LOS ANGELES | LOS ANGELES | 4 | 1 | 3 | 0 | 3 | A | 0 | 1 |
| 8 | CALAVERAS | UNINCORPORATED | 1 | 1 | 1 | 1 | 2 | A | 1 | 1 |
| 9 | SAN BERNARDINO | HESPERIA | 2 | 1 | 1 | 1 | 1 | A | 0 | 0 |
| 10 | VENTURA | OXNARD | 5 | 0 | 8 | 1 | 1 | A | 0 | 0 |
| 11 | VENTURA | OXNARD | 6 | 0 | 8 | 0 | 1 | A | 0 | 0 |
| 12 | ORANGE | FULLERTON | 4 | 0 | 9 | 1 | 2 | A | 0 | 0 |
| 13 | SAN DIEGO | CHULA VISTA | 1 | 0 | 3 | 1 | 1 | A | 0 | 0 |
| 14 | ALAMEDA | OAKLAND | 6 | 0 | 1 | 1 | 1 | A | 0 | 0 |
| 15 | LOS ANGELES | LOS ANGELES | 5 | 0 | 9 | 1 | 3 | A | 0 | 0 |
| 16 | SANTA CLARA | MORGAN HILL | 4 | 0 | 8 | 1 | 3 | A | 0 | 0 |
| 17 | LOS ANGELES | LOS ANGELES | 3 | 0 | 9 | 1 | 3 | A | 0 | 1 |
| 18 | SAN JOAQUIN | UNINCORPORATED | 3 | 0 | 8 | 1 | 3 | A | 0 | 1 |
| 19 | LOS ANGELES | LOS ANGELES | 5 | 0 | 9 | 1 | 4 | A | 0 | 1 |
| 20 | ORANGE | FOUNTAIN VALLEY | 4 | 0 | 8 | 1 | 1 | A | 0 | 1 |
| 21 | RIVERSIDE | RIVERSIDE | 5 | 0 | 9 | 1 | 1 | A | 0 | 1 |
| 22 | ORANGE | ANAHEIM | 2 | 0 | 9 | 1 | 1 | A | 0 | 0 |
| 23 | CONTRA COSTA | WALNUT CREEK | 4 | 0 | 1 | 1 | 1 | A | 0 | 0 |
| 24 | SOLANO | FAIRFIELD | 7 | 0 | 1 | 1 | 1 | A | 0 | 0 |
| 25 | CONTRA COSTA | UNINCORPORATED | 7 | 0 | 9 | 1 | 1 | A | 0 | 1 |
| 26 | BUTTE | CHICO | 5 | 0 | 9 | 1 | 1 | A | 0 | 1 |
| 27 | EL DORADO | UNINCORPORATED | 7 | 0 | 3 | 1 | 1 | A | 0 | 1 |
| 28 | ORANGE | GARDEN GROVE | 6 | 0 | 9 | 1 | 1 | A | 0 | 1 |
| 29 | TUOLUMNE | UNINCORPORATED | 3 | 0 | 8 | 1 | 1 | A | 1 | 0 |
| 30 | SONOMA | UNINCORPORATED | 6 | 0 | 9 | 1 | 1 | A | 0 | 1 |
Step by Step Solution
3.33 Rating (153 Votes )
There are 3 Steps involved in it
Heres how to subset the data and build a decision tree model for predicting accident severity 1 Importing Libraries Python import pandas as pdfrom skl... View full answer
Get step-by-step solutions from verified subject matter experts
