Data Analysis From Scratch With Python: Step By Step Guide


from apyori import apriori



Download 2,79 Mb.
Pdf ko'rish
bet51/60
Sana30.05.2022
Hajmi2,79 Mb.
#620990
1   ...   47   48   49   50   51   52   53   54   ...   60
Bog'liq
Data Analysis From Scratch With Python Beginner Guide using Python, Pandas, NumPy, Scikit-Learn, IPython, TensorFlow and... (Peters Morgan) (z-lib.org)

from apyori import apriori
Next is we set up the rules (the levels of
minimum relatedness) so we can somehow generate a useful list of related items.
That’s because almost any two items might have some level of relatedness. The
objective here is to include only the list that could be useful for us.
rules = apriori(transactions, min_support = 0.003, min_confidence = 0.2,
min_lift = 3, min_length = 2) Well that’s the implementation of Apriori using
Apyori. The next step is to generate and view the results. We can accomplish this
using the following block of code: 
results = list(rules)
results_list = []
for i in range(0, len(results)):
results_list.append('RULE:\t' + str(results[i][0]) + '\nSUPPORT:\t' +
str(results[i][1]))
print (results_list)
When you run all the code in Jupyter Notebook, you’ll see
something 
like 
this: 
It’s messy and almost incomprehensible. But if you run it in Spyder (another
useful data science package included in Anaconda installation), the result will


look a bit neater: 
Notice that there are different itemsets with their corresponding “Support.” The
higher the Support, we can somehow say that the higher the relatedness. For
instance, light cream and chicken often go together because people might be
using the two to cook something. Another example is in the itemset with an
index of 5 (tomato sauce and ground beef). These two items might always go
together in the grocery bag because they’re also used to prepare a meal or a
recipe.
This is only an introduction of Association Rule Learning. The goal here was to
explore the potential applications of it to real-world scenarios such as market
basket optimization. There are other more sophisticated ways to do this. But in
general, it’s about determining the level of relatedness among the items and then
evaluating that if it’s useful or good enough.



Download 2,79 Mb.

Do'stlaringiz bilan baham:
1   ...   47   48   49   50   51   52   53   54   ...   60




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish