0% found this document useful (0 votes)
18 views6 pages

Crime Classification Using Machine Learning

This document discusses using machine learning algorithms to analyze FBI crime data and classify criminal incidents by type and location/time. It tests various classification algorithms like decision trees, naive Bayes, logistic regression, k-nearest neighbors, and ensemble methods on crime data from San Francisco. The best performing model was able to classify crimes with 81% accuracy by using ensemble methods and undersampling to address imbalanced classes in the dataset.

Uploaded by

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

Crime Classification Using Machine Learning

This document discusses using machine learning algorithms to analyze FBI crime data and classify criminal incidents by type and location/time. It tests various classification algorithms like decision trees, naive Bayes, logistic regression, k-nearest neighbors, and ensemble methods on crime data from San Francisco. The best performing model was able to classify crimes with 81% accuracy by using ensemble methods and undersampling to address imbalanced classes in the dataset.

Uploaded by

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

FBI CRIME DATA

ABSTRACT
Recognizing the patterns of a criminal activity of a place is paramount in
order to prevent it. Law enforcement agencies can work effectively and
respond faster if they have better knowledge about crime patterns in
different geological points of a city. The aim is to use machine learning
with the help of python to classify a criminal incident by type,
depending on its occurrence at a given time and location. The survey is
done using crime records of Sanfrancisco.

INTRODUCTION
Criminal activities are present in every region of the world affecting
quality of life and socio-economical development. As such, it is a major
concern of many governments who are using different advanced
technology to tackle such issues. Crime Analysis, a sub branch of
criminology, studies the behavioral pattern of criminal activities and
tries to identify the indicators of such events. Machine learning agents
work with data and employ different techniques to find patterns in data
making it very useful for predictive analysis. Law enforcement agencies
use different patrolling strategies based on the information they get to
keep an area secure. A machine learning agent can learn and analyze the
pattern of occurrence of a crime based on the reports of previous
criminal activities and can find hotspots based on time, type or any other
factor. This technique is known as classification and it allows to predict
nominal class labels. Classification has been used on many different
domains such as financial market, business intelligence, healthcare,
weather forecasting etc. In this research, a dataset from San-Francisco
Open Data[8] is used which contains the reported criminal activities in
the neighborhoods of the city San Francisco for a duration of 12 years. I
used different classification techniques like Decision Tree, Naive
Bayesian, Logistic Regression, k-Nearest Neighbor, Ensemble Methods
to find hotspots of criminal activities based on the time of day. Results
of different algorithms have been compared and most the effective
approach has also been documented.

MODULES

1. Decision Tree Classifier: Decision tree classification model forms


a tree structure from dataset. Decision tree is built by dividing a
dataset into smaller pieces. At each step in the algorithm, a
decision tree node is splitted into two or more branches until it
reaches leaf nodes. Leaf nodes indicates the class labels or result.
At each step, decision tree chooses a feature that best splits the
data with the help of two functions: Gini Impurity and Information
Gain. Gini Impurity measures the probability of classifying a
random sample incorrectly if the label is picked randomly
according to the distribution in a branch.
2. Gaussian Naive Bayes: Gaussian Naive Bayes is a supervised
classifier that uses naive assumption that there is no dependency
between two features. This classifier is implemented by applying
Bayesian Theorem.
3. Logistic Regression: Logistic regression uses linear boundaries to
classify data into different categories. Logistic regression can work
on both binary and multiclass problems. For multiclass dataset, one
vs the rest scheme is used. In this method, logistic regression trains
separate binary classifiers for each class. Meaning, each class is
classified against all other classes, by assuming that all other
classes is one category.
4. K-Nearest Neighbor: Nearest Neighbors method is used in both
supervised and unsupervised learning. While testing with new data,
KNN looks at k data points in training dataset which are closest to
the test data point. k indicates the number of neighbors voting to
classify a datapoint. The distance can be measured with various
metrics. Euclidean distance is the most common choice.
5. Ensemble Methods: Ensemble learning is a method of combining
multiple learning algorithm together to achieve better performance
over a single algorithm. Ensemble methods can be divided into two
categories: averaging methods and boosting methods.
In this paper, two ensemble methods are used: Random Forest,
which follows the principle of averaging method and Adaboost
which is a boosting model.
a) Random Forest: In this ensemble model several decision trees
are built using samples drawn with replacement from the
training set. The splitting of each node of a tree is not based on
the best 19 split of all features, rather the best split among a
random set of features.
b) Adaboost: Adaboost or Adaptive Boosting is a boosting
algorithm. Adaboost combines several weak learners to produce
a stronger model. The final output is obtained from the weighted
sum of the weak models. As it is a sequential process, in each
step a weak learner is changed in favor of misclassified data
points in previous classifiers.

EXISTING SYSTEM

The dataset used for this is real and authentic. The dataset is acquired
from UCI machine learning repository website. The title of the dataset is
‘Crime and Communities’. It is prepared using real data from socio-
economic data from 1990 US Census, law enforcement data from the
1990 US LEMAS survey and crime data from the 1995 FBI UCR. This
dataset contains a total number of 147 attributes and 2216 instances.
PROPOSED SYSTEM
From a large list of attributes, only eighteen attributes are chosen for
Exploratory Data Analysis. The chosen attributes are namely state,
HousVacant, PctHouseOccup, PctHouseOwnCC, PctVacantBoarded,
PctVacMore6Mos, PctUnemployed, PctEmploy, murdperPop,
rapesperPop, robbperPop, assaultperPop, burglperPop, larcperPop,
autoTheftperPop, arsonsperPop, nonviolperpop and
violentcrimesperpop.

Regression Analysis is limited to the following predictor and response


variable predictor variables: Housevacant, PctHouseOccup,
PctHouseownCC, PctVacantBoarded, PctVacmore6Mos,
PctUnemployed, PctEmploy Response variables: Violentcrimesperpop.

Solving the imbalanced class problem, the machine learning agent was
able to categorize crimes with 81% accuracy.

CONCLUSION
Throughout the research it has been evident that basic details of a
criminal activities in an area contains indicators that can be used by
machine learning agents to classify a criminal activity given a location
and date. Even though the learning agent suffers from imbalanced
categories of the dataset, it was able to overcome the difficulty by
oversampling and undersampling the dataset. Through the experiments,
it can be seen the imbalanced dataset was benefitted by using ENN
undersampling. Using the undersampled data, Adaboost decision tree
successfully classified criminal activities based on the time and location.
With a accuracy of 81.93%, it was able to outperform other machine
learning algorithms. Imbalanced classes are one of the main hurdles to
achieve a better result. Though the machine learning agent was able to
predictive model out of simply crime data, a demographic dataset would
probably help to further improve the result and solidify it.

BIBLIOGRAPHY
1. Beckmann, M., Ebecken, N. F., & de Lima, B. S. P. (2015). A KNN
undersampling approach for data balancing. Journal of Intelligent
Learning Systems and Applications, 7(4), 104.
2. Bogomolov, A., Lepri, B., Staiano, J., Oliver, N., Pianesi, F., &
Pentland, A. (2014, November). Once upon a crime: towards crime
prediction from demographics and mobile data. In Proceedings of the
16th international conference on multimodal interaction (pp. 427-434).
ACM.
3. Braithwaite J. Crime, Shame and Reintegration. Ambridge:
Cambridge University Press, 1989.

Common questions

Powered by AI

The study identified 18 key socio-economic factors for exploratory data analysis to predict crime rates. These include housing vacancy, percentage of homeowner occupation, unemployment rates, and others like murder, rape, and robbery incidents per population. These factors collectively enable a comprehensive analysis of the environment affecting crime rates. For instance, high unemployment and vacant housing might indicate economic challenges that correlate with higher crime rates, providing valuable insights for predictive modeling .

Machine learning enhances crime prediction by analyzing past crime data to identify patterns and predict the occurrence of different types of crimes based on their time and location in San Francisco. By employing classification techniques such as Decision Tree, Naive Bayesian, Logistic Regression, and k-Nearest Neighbor, the study aims to determine crime hotspots and improve law enforcement responses. This approach is particularly effective because it can handle diverse data types and uncover insights about crime patterns that may not be immediately apparent to human analysts .

Ensemble methods improve crime prediction by combining multiple learning algorithms to enhance accuracy and performance over single models. Random Forest, an averaging method, constructs multiple decision trees using bootstrapped datasets, thus increasing predictive stability and accuracy. Adaboost, a boosting method, sequentially trains weak learners and adjusts for misclassified instances, culminating in a strong predictive model. In this study, Adaboost demonstrated greater effectiveness in crime prediction by benefiting from balanced training data, leading to better classification outcomes .

To handle overfitting with Decision Trees in crime prediction, the study recommends pruning, which involves reducing tree complexity by eliminating nodes that provide little predictive power. Additionally, using ensemble methods like Random Forest can further address overfitting, as multiple trees are averaged, diluting individual tree's overfit tendencies. By setting depth limitations and employing cross-validation, overfitting can be managed, ensuring the model generalizes well to unseen data .

The study evaluated methods like Decision Tree, Naive Bayesian, Logistic Regression, k-Nearest Neighbor, and Ensemble Methods on their classification of criminal activities by time and location. Among these, the Adaboost algorithm, part of the Ensemble Methods, emerged as the most effective with an accuracy of 81.93%, outperforming the other models. Its success is attributed to its boosting mechanism that effectively handles misclassified data, thereby improving the model's predictive power in an imbalanced dataset context .

Gaussian Naive Bayes differs from other classifiers by assuming independence between predictors, applying Bayesian theorem to calculate the conditional probability of each possible class label. Unlike other models that might consider correlations between features, this classifier categorizes data points based solely on individual attribute probabilities, leading to simplicity in implementation. However, this independence assumption might not always align with real-world data complexities, posing a limitation compared to more complex classifiers like decision trees or logistic regression .

Integrating demographic data with crime records offers predictive advantages by providing a richer context for understanding crime patterns. Demographic factors such as age, income, and education levels can reveal underlying social dynamics that contribute to criminal behavior. The study suggests that this integration could improve model accuracy and robustness by accounting for socio-cultural factors influencing crime, leading to more nuanced and potentially preventive insights for law enforcement agencies .

Cross-validation is crucial in assessing classification models for crime prediction by providing a robust estimate of model performance on unseen data. Techniques like k-fold cross-validation split the data into subsets used for training and testing, ensuring that every data point is both a training and a test data at some point. This reduces bias and variance, offering a more accurate performance measure than a single train-test split. It helps in selecting models that generalize better to new data, avoiding overfitted solutions .

Imbalanced datasets pose significant challenges in crime classification as they result in biased models that favor the majority class, leading to poor sensitivity towards minority classes. This study addressed the imbalance issue by employing oversampling and undersampling techniques, specifically using ENN (Edited Nearest Neighbors) undersampling. These methods helped balance the class distribution, allowing the Adaboost algorithm to outperform others by successfully classifying crimes with an accuracy of 81.93% .

The Decision Tree classifier predicts crime occurrences by constructing a tree structure to split a dataset into smaller segments. It uses parameters such as Gini Impurity and Information Gain to select the feature that best splits the data at each node. This iterative process continues until the tree reaches the leaf nodes, which represent the final class labels or outcomes. The classifier efficiently determines how specific features contribute to predicting crimes, enabling better understanding and forecasting of crime patterns .

You might also like