Nazariy ma’lumot. Foydalanilgan kodlar tahlili


Download 175.23 Kb.
Sana23.01.2023
Hajmi175.23 Kb.
#1110930

O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI


“KOMPYUTER TIZIMLARI” kafedrasi Ma’lumotlarni intellektual tahlili fanidan tayyorlagan


“Do’konda mavjud mahsulotlarni xarid qilish darajasini bashoratlovchi model qurish (Algoritm sifatida NB foydalaning)” mavzusidagi


AMALIY MASHG‘ULOT ISHI

Toshkent – 2022




Mashg’ultoning maqsadi: Do’konda mavjud mahsulotlarni xarid qilish darajasini bashoratlovchi model qurish (Algoritm sifatida NB foydalaning). Qurilgan model yordamida mahsulot buyurma qilish jarayonini yaxshilash.

Nazariy ma’lumot. Foydalanilgan kodlar tahlili.





Code

Ta’rif

%matplotlib inline
from sqlalchemy import create_engine
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_absolute_error

sqlEngine = create_engine('mysql+pymysql://thomas:@127.0.0.1', pool_recycle=3600)


dbConnection = sqlEngine.connect()
dbConnection.execute("use purchases;")

Import bu python dasturlash tilida mavjud bo‘lgan kutubxonalarni yuklanadi bizning masalada pandas, seaborn, matplotlib kutubxonalaridan foydaandim.



pd.read_sql_query("SELECT id, orddate, ordnum, category, price FROM orders LIMIT 10", dbConnection)
dbConnection.execute("""CREATE OR REPLACE VIEW customerDailySpend AS SELECT id,
orddate,
Sum(price) AS dailySpend
FROM orders
GROUP BY id, orddate
ORDER BY id, orddate;
""")

Sql ni o’qib olish uchun kerakli bo’lgan qism

pd.read_sql_query("""SELECT * FROM customerDailySpend;""", dbConnection)



Datasetni online ravishda uladim.

df_features_and_spends = pd.read_sql_query("""SELECT id,
orddate,
DAYOFWEEK(orddate) as weekday,
Sum(dailySpend)
OVER (
partition BY id
ORDER BY id, orddate rows BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as TotalPrecedingSpend,
Avg(dailySpend)
OVER (
partition BY id
ORDER BY id, orddate rows BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as AvgPrecedingSpend,
Sum(dailySpend)
OVER (
partition BY id
ORDER BY id, orddate rows BETWEEN 1 PRECEDING AND 1 PRECEDING) as PreviousSpend,
Count(dailySpend)
OVER (
partition BY id
ORDER BY id, orddate rows BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) as NumPrecedingVisits,
dailySpend
FROM customerDailySpend
GROUP BY id, orddate
ORDER BY id, orddate """, dbConnection)
df_features_and_spends



Asosiy hisob kitoblarni olib boruvchi kod.





Dasturning natijasi.


Mijozlarning yillar davomida sarflagan pullarning yilga nisbatan ko’rinishi.




Hafta kunlari bo’yicha ma’lumot.






XULOSA



Ushbu amaliy mashg’ulot davomida mijozlaning ehtiyojlarini qanday qilib to’g’ri uslubda qondirishni bilib oldim. Ba’zida shunday do’konlarga ham duch kelaman ularda bunday model yo’lga qo’yilmagan. Agar bu modeldan foydalanadigan bo’lsak anchagina o’zgarishni sezishimiz mumkin.


Foydalanilgan adabiyotlar ro‘yxati



  1. https://www.youtube.com/watch?v=Cc8a_cMzyUk&ab_channel=FastDataScienceLtd

  2. https://github.com/woodthom2/predict_customer_spend

Download 175.23 Kb.

Do'stlaringiz bilan baham:




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