I have a data frame

Client_id  1STCUS  20MICRONS   21STCENM  3MINDIA                    
A127        5        0         1            0   
A174        0        0         0            3   
A177        1        2         0            0
A188        0        0         8            0   
A191        8        5         0            0

I am doing market basket analysis based on the dataset similar to the above. Theses are the clients which viewed different stock market scrips and i am trying to build recommendation system for this. For my first trial I came across association rules. In this we can get answer to questions like, People who viewed this also viewed and with how much confidence. However through my research I came across libraries like mlextend and in there we create frequent itemsets with:

frequent_itemsets = apriori(df_matrix, min_support= 0.001, use_colnames=True)

But it requires boolean columns

Client_id  1STCUS  20MICRONS   21STCENM   3MINDIA                   
A127        True     False      True       False    
A174        False    False      False      True 
A177        True     True       False      False
A188        False    False      True       False    
A191        True     False      True       False

However by doing this aren't we loosing an important information like number of times scrips viewed by the user.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.