Data Analysis From Scratch With Python: Step By Step Guide


shrimp,almonds,avocado,vegetables



Download 2,79 Mb.
Pdf ko'rish
bet50/60
Sana30.05.2022
Hajmi2,79 Mb.
#620990
1   ...   46   47   48   49   50   51   52   53   ...   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)

shrimp,almonds,avocado,vegetables 
mix,green 
grapes,whole 
weat
flour,yams,cottage cheese,energy drink,tomato juice,low fat yogurt,green
tea,honey,salad,mineral 
water,salmon,antioxydant 
juice,frozen
smoothie,spinach,olive oil
burgers,meatballs,eggs
chutney
turkey,avocado
mineral water,milk,energy bar,whole wheat rice,green tea
low fat yogurt
whole wheat pasta,french fries
soup,light cream,shallot
frozen vegetables,spaghetti,green tea
french fries
Those are listed according to the transactions where they appear.
For example, in the first transaction the customer bought different things (from
shrimp to olive oil). In the second transaction the customer bought burgers,
meatballs, and eggs.
As before, let’s import the necessary library/libraries so that we can work on the
data: 
import pandas as pd
dataset = pd.read_csv('Market_Basket_Optimisation.csv', header = None)
Next is we add the items in a list so that we can work on them much easier. We
can accomplish this by initializing an empty list and then running a for loop (still
remember how to do all these?): 
transactions = []
for i in range(0, 7501):
transactions.append([str(dataset.values[i,j]) for j in range(0, 20)])
After
we’ve done that, we should then generate a list of “related products” with their
corresponding level of support or relatedness. One way to accomplish this is by
the implementation of the Apriori algorithm (for association rule learning).
Thankfully, we don’t have to write anything from scratch.
We can use Apyori which is a simple implementation of the Apriori algorithm.
You 
can 
find 
it 
here 
for 
your 
reference:
https://pypi.org/project/apyori/#description
It’s prebuilt for us and almost ready for our own usage. It’s similar to how we
use scikit-learn, pandas, and numpy. Instead of starting from scratch, we already


have blocks of code we can simply implement. Take note that coding everything
from scratch is time consuming and technically challenging.
To implement Apyori, we can import it similarly as how we import other
libraries: 

Download 2,79 Mb.

Do'stlaringiz bilan baham:
1   ...   46   47   48   49   50   51   52   53   ...   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