Association Rule Mining

A sophisticated intuition of Association Rule Mining and Apriori Algorithm

Association rule mining is a type of data mining that helps find patterns or links between different things in a set of data. It is used a lot in marketing, retail, and e-commerce, among other places, to find interesting connections between different products or services. The goal of association rule mining is to find groups of items in a transactional dataset that are often found together. These groups of items are called "itemsets," and they can be used to make "association rules" that describe how different items are related to each other.

Association rule mining has been done for a long time with the Apriori algorithm. It is a two-step algorithm that starts by finding all of the frequently occurring itemsets in a dataset. These itemsets are then used to make association rules. The algorithm is based on the idea that any subset of a set of frequently occurring items must also be a set of frequently occurring items. This lets the algorithm narrow down the search space and avoid making sets of items that don't come up very often. The Apriori algorithm is a recursive algorithm that starts with 1-itemsets and makes bigger ones until there are no more frequent 1-itemsets.

Support is the number of times an itemset shows up in a dataset. It is worked out by looking at the number of transactions that include the itemset. For example, if a dataset has 1,000 transactions and 200 of them have both items A and B, then the support for the itemset "A, B" is 0.2, or 20%.

Confidence is the chance that an item B will be bought if an item A is bought. It is found by dividing the number of votes for the set of items "A, B" by the number of votes for the set of items "A." For example, if the support for the set "A, B" is 0.2 and the support for the set "A" is 0.5, then the confidence for the rule "A > B" is 0.4, or 40%.

Lift is a measure of how strongly the occurrence of item A is linked to the occurrence of item B, beyond what you would expect by chance. It is worked out by comparing the support for the itemset "A, B" to the support for the itemsets "A" and "B" together. For instance, if the support for the itemset "A, B" is 0.2, the support for the itemset "A" is 0.5, and the support for the itemset "B" is 0.4, then the lift for the rule "A B" is 1.0 (or 100%).

In ARM, a rule is a statement of the form A B, where A and B are both sets of items. When a rule has a high support, a high confidence, and a high lift, it is said to be interesting. People often use the Apriori algorithm to find association rules. It works by first finding groups of items that are used together often, and then using those groups to come up with possible rules.

The steps of the Apriori algorithm are called "iterations." In the first iteration, it looks through the dataset to find all of the individual items that show up at least a certain number of times. These are called "frequent one-item sets." The algorithm uses the frequent itemsets from the previous iteration to make candidate itemsets of length k+1 in the next iteration. The algorithm then goes through the dataset again to find out which candidate itemsets have the most support. If a candidate itemset doesn't get at least the minimum number of votes, it is thrown out. If not, it is added to the list of often-used items.

Once all of the frequent item sets have been found, the algorithm combines them to make candidate rules. Then, it looks at how each candidate rule does in terms of support, confidence, and lift. The final output of the algorithm is the set of interesting rules that meet the minimum thresholds for each of these measures.

Apriori Illustration by Loginom

Association Rule Mining - Chicago Crime

The above transactional data on crime in Chicago is a useful example for using the Apriori algorithm, which may be used to make predictions about the relationship between various sorts of crimes that occur in a given area and time period. With transactional data, association rules may be used to illustrate the connections between objects, in this example, the many criminal categories.

An example/anticipated rule set is described as follows. 

Theft => Assualt (confidence = 0.85, support = 0.40)

This rule means that 75% of the transactions where a burglary occurred also included a theft. The support of 0.20 indicates that this association occurs in 20% of all transactions in the dataset.

These association rules can be used to make predictions about future crime patterns and help inform crime prevention strategies. For example, the above association rule suggests that if a burglary occurs, there is a high likelihood that a theft will also occur, which could be useful information for law enforcement to keep in mind when patrolling an area.

Here's a tutorialised description of Association Rule Mining on Crime dataset.

The following set of visualisations are the resultant of the above process described graphically. 

Data Set Formatting

Before Transactional Formmatting

After Transactional Formmating

The following dropboxes hold the top15 rules generated by the variations in parameters like  

→ conf, minlen, maxlen.

rules <- apriori(transactions, parameter = list(supp=0.2, conf=0.6, maxlen=3, minlen=3, target= "rules"))

Top15 rules on Lift

       lhs                                     rhs                                  support confidence  coverage      lift count

[1]    {OFFENSE INVOLVING CHILDREN,                                                                                             

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2011963  0.6813996 0.2952692 1.7236505   370

[2]    {NARCOTICS,                                                                                                              

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[3]    {PROSTITUTION,                                                                                                           

        THEFT}                              => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[4]    {PROSTITUTION,                                                                                                           

        WEAPONS VIOLATION}                  => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[5]    {ASSAULT,                                                                                                                

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[6]    {PROSTITUTION,                                                                                                           

        ROBBERY}                            => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[7]    {BATTERY,                                                                                                                

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[8]    {BURGLARY,                                                                                                               

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[9]    {CRIMINAL DAMAGE,                                                                                                        

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[10]   {CRIMINAL TRESPASS,                                                                                                      

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[11]   {DECEPTIVE PRACTICE,                                                                                                     

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[12]   {MOTOR VEHICLE THEFT,                                                                                                    

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[13]   {OTHER OFFENSE,                                                                                                          

        PROSTITUTION}                       => {CRIM SEXUAL ASSAULT}              0.2022838  0.6788321 0.2979880 1.7171558   372

[14]   {ARSON,                                                                                                                  

        CRIM SEXUAL ASSAULT}                => {INTERFERENCE WITH PUBLIC OFFICER} 0.2463295  0.9826464 0.2506797 1.2497142   453

[15]   {CRIM SEXUAL ASSAULT,                                                                                                    

        HOMICIDE}                           => {INTERFERENCE WITH PUBLIC OFFICER} 0.2930941  0.9817851 0.2985318 1.2486188   539

Top15 rules on Support

       lhs                                     rhs                                  support confidence  coverage      lift count

[1]    {THEFT,                                                                                                                  

        WEAPONS VIOLATION}                  => {ASSAULT}                          1.0000000  1.0000000 1.0000000 1.0000000  1839

[2]    {ASSAULT,                                                                                                                

        THEFT}                              => {WEAPONS VIOLATION}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[3]    {ASSAULT,                                                                                                                

        WEAPONS VIOLATION}                  => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[4]    {THEFT,                                                                                                                  

        WEAPONS VIOLATION}                  => {ROBBERY}                          1.0000000  1.0000000 1.0000000 1.0000000  1839

[5]    {ROBBERY,                                                                                                                

        THEFT}                              => {WEAPONS VIOLATION}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[6]    {ROBBERY,                                                                                                                

        WEAPONS VIOLATION}                  => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[7]    {THEFT,                                                                                                                  

        WEAPONS VIOLATION}                  => {BATTERY}                          1.0000000  1.0000000 1.0000000 1.0000000  1839

[8]    {BATTERY,                                                                                                                

        THEFT}                              => {WEAPONS VIOLATION}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[9]    {BATTERY,                                                                                                                

        WEAPONS VIOLATION}                  => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[10]   {THEFT,                                                                                                                  

        WEAPONS VIOLATION}                  => {BURGLARY}                         1.0000000  1.0000000 1.0000000 1.0000000  1839

[11]   {BURGLARY,                                                                                                               

        THEFT}                              => {WEAPONS VIOLATION}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[12]   {BURGLARY,                                                                                                               

        WEAPONS VIOLATION}                  => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[13]   {THEFT,                                                                                                                  

        WEAPONS VIOLATION}                  => {CRIMINAL DAMAGE}                  1.0000000  1.0000000 1.0000000 1.0000000  1839

[14]   {CRIMINAL DAMAGE,                                                                                                        

        THEFT}                              => {WEAPONS VIOLATION}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[15]   {CRIMINAL DAMAGE,                                                                                                        

        WEAPONS VIOLATION}                  => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

Top15 rules on Confidence

      lhs                                     rhs                                  support confidence  coverage      lift count

[1]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {THEFT}                            0.2403480  1.0000000 0.2403480 1.0000000   442

[2]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {WEAPONS VIOLATION}                0.2403480  1.0000000 0.2403480 1.0000000   442

[3]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {ASSAULT}                          0.2403480  1.0000000 0.2403480 1.0000000   442

[4]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {ROBBERY}                          0.2403480  1.0000000 0.2403480 1.0000000   442

[5]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {BATTERY}                          0.2403480  1.0000000 0.2403480 1.0000000   442

[6]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {BURGLARY}                         0.2403480  1.0000000 0.2403480 1.0000000   442

[7]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {CRIMINAL DAMAGE}                  0.2403480  1.0000000 0.2403480 1.0000000   442

[8]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {CRIMINAL TRESPASS}                0.2403480  1.0000000 0.2403480 1.0000000   442

[9]    {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {DECEPTIVE PRACTICE}               0.2403480  1.0000000 0.2403480 1.0000000   442

[10]   {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {MOTOR VEHICLE THEFT}              0.2403480  1.0000000 0.2403480 1.0000000   442

[11]   {INTERFERENCE WITH PUBLIC OFFICER,                                                                                       

        KIDNAPPING}                         => {OTHER OFFENSE}                    0.2403480  1.0000000 0.2403480 1.0000000   442

[12]   {HOMICIDE,                                                                                                               

        KIDNAPPING}                         => {THEFT}                            0.2278412  1.0000000 0.2278412 1.0000000   419

[13]   {HOMICIDE,                                                                                                               

        KIDNAPPING}                         => {WEAPONS VIOLATION}                0.2278412  1.0000000 0.2278412 1.0000000   419

[14]   {HOMICIDE,                                                                                                               

        KIDNAPPING}                         => {ASSAULT}                          0.2278412  1.0000000 0.2278412 1.0000000   419

[15]   {HOMICIDE,                                                                                                               

        KIDNAPPING}                         => {ROBBERY}                          0.2278412  1.0000000 0.2278412 1.0000000   419

[16]   {HOMICIDE,                                                                                                               

        KIDNAPPING}                         => {BATTERY}                          0.2278412  1.0000000 0.2278412 1.0000000   419


Visualisation of the above condition

Interactive Graph ( top50 rules )

A Connected graph using Lift Measure

rules <- apriori(transactions, parameter = list(supp=0.2, conf=0.9, maxlen=2, minlen=2, target= "rules"))

Top15 rules on Lift

      lhs                                    rhs                                  support confidence  coverage      lift count

[1]   {CRIM SEXUAL ASSAULT}               => {INTERFERENCE WITH PUBLIC OFFICER} 0.3871669  0.9793673 0.3953235 1.2455438   712

[2]   {CRIM SEXUAL ASSAULT}               => {PUBLIC PEACE VIOLATION}           0.3817292  0.9656121 0.3953235 1.1022723   702

[3]   {PROSTITUTION}                      => {PUBLIC PEACE VIOLATION}           0.2762371  0.9270073 0.2979880 1.0582039   508

[4]   {KIDNAPPING}                        => {PUBLIC PEACE VIOLATION}           0.2659054  0.9055556 0.2936378 1.0337161   489

[5]   {LIQUOR LAW VIOLATION}              => {PUBLIC PEACE VIOLATION}           0.3273518  0.9025487 0.3626971 1.0302837   602

[6]   {PROSTITUTION}                      => {SEX OFFENSE}                      0.2833061  0.9507299 0.2979880 1.0296775   521

[7]   {LIQUOR LAW VIOLATION}              => {SEX OFFENSE}                      0.3420337  0.9430285 0.3626971 1.0213365   629

[8]   {CONCEALED CARRY LICENSE VIOLATION} => {SEX OFFENSE}                      0.3491028  0.9427313 0.3703100 1.0210146   642

[9]   {CRIM SEXUAL ASSAULT}               => {SEX OFFENSE}                      0.3719413  0.9408528 0.3953235 1.0189802   684

[10]  {KIDNAPPING}                        => {SEX OFFENSE}                      0.2756933  0.9388889 0.2936378 1.0168532   507

[11]  {INTIMIDATION}                      => {SEX OFFENSE}                      0.3251767  0.9329173 0.3485590 1.0103857   598

[12]  {HOMICIDE}                          => {SEX OFFENSE}                      0.7487765  0.9310345 0.8042414 1.0083465  1377

[13]  {CRIMINAL SEXUAL ASSAULT}           => {SEX OFFENSE}                      0.7645459  0.9286658 0.8232735 1.0057811  1406

[14]  {CRIM SEXUAL ASSAULT}               => {OFFENSE INVOLVING CHILDREN}       0.3931485  0.9944979 0.3953235 1.0054325   723

[15]  {INTERFERENCE WITH PUBLIC OFFICER}  => {SEX OFFENSE}                      0.7297444  0.9280775 0.7862969 1.0051440  1342


Top15 rules on Support

      lhs                                    rhs                                  support confidence  coverage      lift count

[1]   {THEFT}                             => {WEAPONS VIOLATION}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[2]   {WEAPONS VIOLATION}                 => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[3]   {THEFT}                             => {ASSAULT}                          1.0000000  1.0000000 1.0000000 1.0000000  1839

[4]   {ASSAULT}                           => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[5]   {THEFT}                             => {ROBBERY}                          1.0000000  1.0000000 1.0000000 1.0000000  1839

[6]   {ROBBERY}                           => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[7]   {THEFT}                             => {BATTERY}                          1.0000000  1.0000000 1.0000000 1.0000000  1839

[8]   {BATTERY}                           => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[9]   {THEFT}                             => {BURGLARY}                         1.0000000  1.0000000 1.0000000 1.0000000  1839

[10]  {BURGLARY}                          => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[11]  {THEFT}                             => {CRIMINAL DAMAGE}                  1.0000000  1.0000000 1.0000000 1.0000000  1839

[12]  {CRIMINAL DAMAGE}                   => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[13]  {THEFT}                             => {CRIMINAL TRESPASS}                1.0000000  1.0000000 1.0000000 1.0000000  1839

[14]  {CRIMINAL TRESPASS}                 => {THEFT}                            1.0000000  1.0000000 1.0000000 1.0000000  1839

[15]  {THEFT}                             => {DECEPTIVE PRACTICE}               1.0000000  1.0000000 1.0000000 1.0000000  1839


Top15 rules on Confidence

      lhs                                    rhs                                  support confidence  coverage      lift count

[1]   {KIDNAPPING}                        => {THEFT}                            0.2936378  1.0000000 0.2936378 1.0000000   540

[2]   {KIDNAPPING}                        => {WEAPONS VIOLATION}                0.2936378  1.0000000 0.2936378 1.0000000   540

[3]   {KIDNAPPING}                        => {ASSAULT}                          0.2936378  1.0000000 0.2936378 1.0000000   540

[4]   {KIDNAPPING}                        => {ROBBERY}                          0.2936378  1.0000000 0.2936378 1.0000000   540

[5]   {KIDNAPPING}                        => {BATTERY}                          0.2936378  1.0000000 0.2936378 1.0000000   540

[6]   {KIDNAPPING}                        => {BURGLARY}                         0.2936378  1.0000000 0.2936378 1.0000000   540

[7]   {KIDNAPPING}                        => {CRIMINAL DAMAGE}                  0.2936378  1.0000000 0.2936378 1.0000000   540

[8]   {KIDNAPPING}                        => {CRIMINAL TRESPASS}                0.2936378  1.0000000 0.2936378 1.0000000   540

[9]   {KIDNAPPING}                        => {DECEPTIVE PRACTICE}               0.2936378  1.0000000 0.2936378 1.0000000   540

[10]  {KIDNAPPING}                        => {MOTOR VEHICLE THEFT}              0.2936378  1.0000000 0.2936378 1.0000000   540

[11]  {KIDNAPPING}                        => {OTHER OFFENSE}                    0.2936378  1.0000000 0.2936378 1.0000000   540

[12]  {PROSTITUTION}                      => {NARCOTICS}                        0.2979880  1.0000000 0.2979880 1.0010887   548

[13]  {PROSTITUTION}                      => {THEFT}                            0.2979880  1.0000000 0.2979880 1.0000000   548

[14]  {PROSTITUTION}                      => {WEAPONS VIOLATION}                0.2979880  1.0000000 0.2979880 1.0000000   548

[15]  {PROSTITUTION}                      => {ASSAULT}                          0.2979880  1.0000000 0.2979880 1.0000000   548


Interactive Graph ( top50 rules )

A Connected graph using Lift Measure

Inference on the above  - Upon generating these rules, the highest lift measure obtained was 1.72 for the first condition and 1.20 for the second condition; it is evident that there's a decent amount of association with the itemsets present in the dataset. The lift measure is an indication of the strength of the association between the antecedent and consequent in a rule, and a value of 1 indicates no association between the two. Therefore, a lift measure of 1.72 suggests that the antecedent and consequent are positively associated, with a higher likelihood of the consequent occurring given the antecedent. This low association might also because of the abundance of information/itemsets, in a prior-experimentation done using apriori in python with a subset of data led to resulting in Association Rules which have more lift measures showing a higher association. The prior experimentation results can be seen in the Appendix Section on this page.

For Instance, {NARCOTICS,PROSTITUTION} => {CRIM SEXUAL ASSAULT} [ support = 0.202, confidence = 0.679, lift = 1.72, count = 372 ]  inferring from a rule like this states that if a congregational event consisting of Narcotics and Prostitution  occurs, then there's 60 percent chance that it also involves Non Aggravated Sexual Assualt. 

  

A Second hypothesis - Community Area-wise Descretion 

Are there different patterns for different Community Areas in Chicago?

The community area of Austin, IL has consistently been identified as having one of the highest rates of crime activity in Chicago. Using association rule mining on the crime dataset, interesting relationships and patterns between the different types of crimes that occur in Austin can be identified. For example, association rule mining may reveal that theft and burglary are more likely to occur during the night time, while assault and battery are more likely to occur during the daytime. This information can be used to inform law enforcement strategies, such as increasing patrols during certain times of the day or increasing surveillance in areas where theft and burglary are more likely to occur.

Similarly, the community area of Near North Side, IL, has also been identified as having a high rate of crime activity. Using association rule mining on the crime dataset, patterns between the types of crimes that occur in this area can be identified. For instance, association rule mining may reveal that theft is more likely to occur in crowded areas such as shopping centers or during the holiday season, while drug-related crimes are more likely to occur in certain parts of the community area. This information can be used to inform law enforcement strategies, such as increasing patrols in crowded areas or targeting certain parts of the community for drug-related crime prevention efforts.

Austin, IL

Top 5 Rules 


       lhs                       rhs                     support confidence  coverage      lift count

[1]    {CRIMINAL TRESPASS,                                                                           

        OTHER OFFENSE,                                                                               

        THEFT}                => {NARCOTICS}           0.3268080  0.8452883 0.3866232 1.0610821   601

[2]    {CRIMINAL TRESPASS,                                                                           

        OTHER OFFENSE}        => {NARCOTICS}           0.3273518  0.8443198 0.3877107 1.0598663   602

[3]    {BATTERY,                                                                                     

        CRIMINAL TRESPASS,                                                                           

        OTHER OFFENSE}        => {NARCOTICS}           0.3273518  0.8443198 0.3877107 1.0598663   602

[4]    {CRIMINAL DAMAGE,                                                                             

        CRIMINAL TRESPASS,                                                                           

        OTHER OFFENSE}        => {NARCOTICS}           0.3181077  0.8429395 0.3773790 1.0581336  585

[5]    {ASSAULT,                                                                                     

        CRIMINAL TRESPASS,                                                                           

        OTHER OFFENSE}        => {NARCOTICS}           0.3126699  0.8406433 0.3719413 1.0552512   575


Interactive Graph ( top50 rules )

A Connected graph using Lift Measure

Near North Side, IL

Top 5 Rules 


    lhs                      rhs                 support confidence  coverage     lift count

[1] {ASSAULT,                                                                               

     ROBBERY}             => {CRIMINAL DAMAGE} 0.3409462  0.7779156 0.4382817 1.062843   627

[2] {CRIMINAL DAMAGE,                                                                       

     OTHER OFFENSE}       => {ASSAULT}         0.3295269  0.8005284 0.4116368 1.053056   606

[3] {ASSAULT,                                                                               

     OTHER OFFENSE}       => {CRIMINAL DAMAGE} 0.3295269  0.7690355 0.4284937 1.050711   606

[4] {ASSAULT,                                                                               

     MOTOR VEHICLE THEFT} => {CRIMINAL DAMAGE} 0.3773790  0.7685493 0.4910277 1.050046   694

[5] {CRIMINAL DAMAGE,                                                                       

     ROBBERY}             => {ASSAULT}         0.3409462  0.7946768 0.4290375 1.045358   627

Interactive Graph ( top50 rules )

A Connected graph using Lift Measure

Inference on the above ( Community Area-Wise Descretion )  - Although it is not possible to draw any firm conclusions about the significance of the rules mined by comparing the lift measures in the two situations, it is instructive to note significant disparities in the Crime Type Records of the two communities. In Austin, IL, it seems that Narcotics make up the most of crime item sets, whereas on Near North Side, IL, it's Assault and Criminal Damage. Our gut tells us that there are similar criminal dynamics at play in each of these neighborhoods.

Conclusions

In conclusion, the use of association rule mining on the Chicago crime dataset has the potential to provide priceless insights into the patterns and trends of criminal activity, therefore assisting law enforcement authorities in arriving at judgments that are more well-informed. Association rule mining can assist law enforcement agencies in more efficiently allocating their resources and developing more targeted strategies for preventing and reducing crime. This is accomplished by determining the relationships that exist between the various categories of criminal activity, the locations in which they take place, and the times of day in which they occur. In addition, the insights that are obtained via association rule mining may be utilized to guide both the choices that are made about public policy as well as the development of public awareness campaigns that promote both safety and the prevention of criminal activity. In general, the implementation of association rule mining on the Chicago crime dataset has the potential to make a major contribution to the improvement of public safety and the reduction of crime in metropolitan contexts.

Source Code

Appendix 

Comprehensive Network Graph Including all the Association Rules of Chicago Crime Dataset

Apriori Algorithm in Python on a Sample of Data

=> apriori(transactions, min_support=0.0045, min_confidence=0.2, min_lift=3, min_length=4) 

Rule: CRIM SEXUAL ASSAULT => ASSAULT

Support: 0.0051813471502590676

Confidence: 1.0

Lift: 5.848484848484849

=====================================

Rule: INTERFERENCE WITH PUBLIC OFFICER => BURGLARY

Support: 0.0051813471502590676

Confidence: 0.25

Lift: 4.386363636363637

=====================================

Rule: OFFENSE INVOLVING CHILDREN => DECEPTIVE PRACTICE

Support: 0.010362694300518135

Confidence: 1.0

Lift: 5.848484848484849

=====================================

Rule: NARCOTICS => HOMICIDE

Support: 0.0051813471502590676

Confidence: 1.0

Lift: 12.866666666666667

=====================================


Rule: ROBBERY => KIDNAPPING

Support: 0.0051813471502590676

Confidence: 1.0

Lift: 14.846153846153845

=====================================

Rule: NARCOTICS => CRIMINAL DAMAGE

Support: 0.0051813471502590676

Confidence: 0.25

Lift: 3.216666666666667

=====================================

Rule: CRIMINAL DAMAGE => ASSAULT

Support: 0.0051813471502590676

Confidence: 0.25

Lift: 3.7115384615384612

=====================================

Rule: OTHER OFFENSE => BURGLARY

Support: 0.0051813471502590676

Confidence: 0.2

Lift: 3.5090909090909093

=====================================