
๐๏ธ 1126 ~ nํธ ๊ธฐ๋ก
โ๏ธ ๋๋ ์ด์ Colab Pro ์์ ์ ๊ณตํ๋ ์ปดํจํ ๋จ์๋ฅผ ๋ค ์จ๋ฒ๋ ธ๋ค. ํ๋ฆฌ๋ฏธ์ GPU ๋๋ ธ๋๋, ์์ผ ๋น ๋ฅผ๊น ์ถ์๋๋ฐ ์ด์ ๊ฐ ์์๊ตฌ๋. ๊ทธ๋์ ๊ฐ๋งํ๋ค. ์ผ๋ฐ GPU ์ฐ๋๊น ๋ชจ์๋ฅด๋ค๊ณ ๋์จ๋ค.
๐๏ธ 1126
๐ 0ํธ(base) : 0.5646211434906451
๐ 1ํธ : 0.5627
weights์์ logspace ๊ฐ np.flip() ์ ์ฉ
๐ 2ํธ : 0.5647 (base + 0.000091 )
"Buy2Buy" Co-visitation Matrix์์ ๊ธฐ๊ฐ 14์ผ->10์ผ
๐ 3ํธ : 0.5647 ( base + 0.000094 )
"Buy2Buy" Co-visitation Matrix์์ ๊ธฐ๊ฐ 14์ผ->7์ผ
๐ 4ํธ : 0.5647 ( base + 0.000110)
"Buy2Buy" Co-visitation Matrix์์ ๊ธฐ๊ฐ 14์ผ->7์ผ
"Clicks" Co-visitation Matrix - Time Weighted ๊ธฐ๊ฐ ํ๋ฃจ -> 12์๊ฐ
๐ 5ํธ : 0.5646 -> ์๊ฐ์ ์ค์ด๋ ๊ฒ์ด ์ข๋ค๋ ๊ฒ์ ๋ํ Validation Test
"Buy2Buy" Co-visitation Matrix์์ ๊ธฐ๊ฐ 14์ผ->7์ผ
"Clicks" Co-visitation Matrix - Time Weighted ๊ธฐ๊ฐ ํ๋ฃจ -> 48์๊ฐ
์๋ฒฝ 5์ ๋ฐ๊น์ง 5ํธ ๋๋ ธ๋ค..^^.. ํ๋ณตํด
๐๏ธ 1127
๐ 6ํธ : 0.5647
cart recall ์ฌ๋ฆฌ๋ ค๊ณ ์ด๊ฒ์ ๊ฒ ๊ณ ์ณ๋ดค๋๋ฐ ๋งํ๋ค.
๐ 7ํธ : 0.5646
6ํธ์์ ๋ฐ๊ฟจ๋ type weight๋ฅผ ๊ทธ๋ฅ ์๋๋๋ก ํ๋ค. ๋ ๋งํ๋ค.
๐ 8ํธ : 0.5646
type weight๋ ๊ทธ๋ฅ ๊ฑด๋ค์ง ๋ง์์ผ ํ๋. ๋ ๋งํ๋ค.
ํ๋ฃจ์ข ์ผ ๋งํ๊ธฐ๋ง ํ๊ณ ๋๋ฌ๋ค. ์ค๋์ ๊ตํ type weight๋ ๊ฑด๋ค์ง ๋ง์์ผ๊ฒ ๋ค
๐๏ธ 1128
๐ 9ํธ : 0.5649
๊ฐ์ฅ ์ฑ๋ฅ์ด ์ข์๋ 4๋ฒ์งธ ๊ธ์ชฝ์ด๋ฅผ ๋ฐ๋ ค์จ ๋ค์ ์กฐ๊ธ ๋ ๊ณ ์ณ๋ดค๋ค. ์ค๋์ ๊ธ์ชฝ์ด ์ถ๋ฐ~!
"Buy2Buy" Co-visitation Matrix์์ ๊ธฐ๊ฐ 14์ผ->7์ผ
"Clicks" Co-visitation Matrix - Time Weighted ๊ธฐ๊ฐ ํ๋ฃจ -> 12์๊ฐ
"Cart-Orders" Co-visitation Matrix - ๊ธฐ๊ฐ ํ๋ฃจ -> 12์๊ฐ
์ ๋ฏธ์น ๊ธ์ชฝ์!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ์ ๋ฏธ์น ์ฐ๋ฆฌ 9์จฐ ๊ธ์ชฝ์ด ๋๋ฌด ์ํ๋คใ ใ ใ ใ
๐ 10ํธ : 0.5650
9๋ฒ์งธ ๊ธ์ชฝ์ด์์ ์๊ฐ ๊ฐ์ค์น ๋ฐฉ์์ ๋ฐ๊ฟ๋ดค๋ค. ์ต๊ทผ ๋ฐ์ดํฐ ๋ฐ์ํ ์๋ก ์ข์ ๊ฒ ๊ฐ์์ ์ต๊ทผ์ผ์๋ก ๊ฐ์ค์น๊ฐ ๋๊ฒ ์ค์ ํด์คฌ๋ค. ์์ฃผ ์กฐ๊ธ ๋๋ํด์ก๋ค.
df['wgt'] = 1 + 5*(df.ts_x - 1659304800)/(1662328791-1659304800)
๐ 11ํธ : 0.5649
์ต๊ทผ ๊ฐ์ค์น๋ฅผ ๋ ๋๊ฒ ์ค๋ดค๋ค. ๋จ์ด์ง ๊ฑฐ ์์ํ๊ณ ๋๋ฆฐ๋ค. ์ญ์ ๋จ์ด์ก๋ค.
๐ 12ํธ : 0.5648
cart recall์ ๋์ด๊ธฐ ์ํด (2) Buy2Buy matrix์ type weighting์ ์ค๋ณด์.
order recall์ ๋จ์ด์ ธ๋ ์๊ด์๋ค. cart recall์ด ์ฌ๋ผ๊ฐ๋์ง๋ง ํ์ธํด๋ณด์.
์คํ๋ ค click์ด ์ฌ๋ผ๊ฐ๊ณ cart์ order๋ ๋ ๋ค ๋จ์ด์ก๋ค. ์ ๋ง ์๋ค๊ฐ๋ ๋ชจ๋ฅด๊ฒ ๋ค.
โ๏ธ 6ํธ ์ ์ Kaggle Comments ์ ๋ฆฌ ๋ฐ ๋ฑ๋ฑ
โ
ํ์ฌ ์ฌ์ฉํ๋ co-visitation matrix
Reference์์ ์ฌ์ฉํ๋ 3์ข
๋ฅ์ co-visitation matrix๋ ๋ค์๊ณผ ๊ฐ๋ค.
๋ฐ๋ผ์ ์์ธก์ด ํฌ๊ฒ ๋ ๊ฐ์ง๋ก ๋๋ ์ง๊ฒ ๋๋ค. Clikck ์์ธก๊ณผ Buy ์์ธก.
์ฆ Cart์ Order๋ ์์ธกํ aid ์ข ๋ฅ๊ฐ ๋์ผํ์ง๋ง, Click์ ๋ค๋ฅธ ๊ฒ์ด๋ค.
โ ์๊ฐ ๊ฐ์ค์น ๋งค๊ธฐ๋ ๋ฐฉ์
df['wgt'] = 1 + 3*(df.ts_x - 1659304800)/(1662328791-1659304800)
๋ชจ๋ ๋ฐ์ดํฐ์์ timestamp ์ต์๊ฐ 1659304800
๋ชจ๋ ๋ฐ์ดํฐ์์ timestamp ์ต๋๊ฐA 1662328791
์ค์ ํ๊ณ ์ ํ๋ ์ต๋ ๊ฐ์ค์น 4, ์ต์ ๊ฐ์ค์น 1
point-slope equationd์ ํผ๋ค.
x2 = 1662328791
x1 = 1659304800
y2 = 4
y1 = 1

์ต๋๊ฐ์ ์ฐ๋ฆฌ๊ฐ ์ต๊ทผ ๋ฐ์ดํฐ์ ์ผ๋ง๋ ์ค์์ฑ์ ๋ ์ง๋ฅผ ๊ฒฐ์ ํ๋ค.
์ฌ๋๋ค์ด ๋ฌด์์ ํด๋ฆญํ๊ณ ์นดํธ์ ๋ด๊ณ ์ฃผ๋ฌธํ ์ง๋ ํ์ฌ ํธ๋ ๋์ ๋ฐ๋ผ ๋ณํ๊ฒ ๋ ๊ฒ์ด๋ค. ๋ฐ๋ผ์ ์ต๊ทผ์ ๊ฐ๊น์ธ์๋ก ๊ฐ์ค์น๋ฅผ ๋๋ ๋ฐฉ์์ ์ฌ์ฉํ๋ค.
โ
tail 30๊ฐ๋ง ์ฌ์ฉํ๋ ์ด์
์ฃผ์ํ ์ด์ ๋ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ ์ฌ์ฉํ๊ธฐ ์ํด. ๊ทธ๋ฌ๋ tail์ ๊ฐ๊น์ธ์๋ก ๋ฏธ๋๋ฅผ ์์ธกํ๋ ๋ฐ ๋์์ด ๋๊ณ ์ต๊ทผ์ ํธ๋ ๋๋ฅผ ๋ฐ์ํ๋ ์๋ฏธ์๋ ๋ฐ์ดํฐ๊ฐ ๋๋ค.
โ ๊ฐ๋ฅํ User/Item Feature
- ์ฌ์ฉ์ Feature
์ฌ์ฉ์๊ฐ ์ผ๋ง๋ ๋ง์ ์์ดํ ์ ํด๋ฆญํ์๋์ง
์ฌ์ฉ์๊ฐ ์ผ๋ง๋ ๋ง์ ์์ดํ ์ ๊ตฌ๋งคํ์๋์ง
์ฌ์ฉ์๊ฐ ํด๋ฆญํ ํ๊ท ์๊ฐ
์ฌ์ฉ์๊ฐ ์ฃผ๋ฌธํ ํ๊ท ์๊ฐ
์ฌ์ฉ์๊ฐ ์ค์ ์ธ์ ์ ๋ช ๊ฐ ๊ฐ์ง๊ณ ์๋์ง(์ค์ ์ธ์ ์ ํ๋ ๊ฐ์ ์๊ฐ ๊ฐ๊ฒฉ์ผ๋ก ์ ์๋จ)
๊ฐ ์ฌ์ฉ์ ์ค์ ์ธ์ ์ ํ๊ท ์์ดํ ์
์ฌ์ฉ์๊ฐ ๋ง๋ ํ๋์ ๋ง์ง๋ง ์์ผ(์: ์์์ผ, ํ์์ผ)
์ฌ์ฉ์๊ฐ ๋ง๋ ํ๋์ ์ฒซ ๋ฒ์งธ ์์ผ์ ๋ฌด์์ธ์ง
ํด๋ฆญ ์ฌ์ด ํ๊ท ์๊ฐ
- ์์ดํ Feature
has this item already been clicked by user
has this item already been added to cart by user
if already clicked, what is its relative order? 1 means last clicked, 2 means second to last clicked etc
has user clicked this item multiple times already? how many
how many items (that user has already clicked) have recommended this item with their co-visitation matrix
when was date that this item was first seen in train
how many times what this item clicked in train
what is the average hour of day that this item is clicked
what is the average hour of day that this item is ordered
how popular is this item on monday (i.e. what percentage of monday clicks are this item)
how popular is this item on tuesday
what is the most common day of week this item is clicked
count up all unique items that were clicked immediately before and after. How many unique items have been clicked immediately before and after. (For example, maybe item only has 10 unique items that get clicked before and after. Whereas another item has 1000 unique items clicked before and after)
what percentage of users click this item more than once
has this item ever been bought in train data
โ
์ click:cart:order ๊ฐ์ค์น๊ฐ 1:6:3์ธ์ง
1) click vs cart ๋น๊ตํ์ ๋ cart๊ฐ ๋ ์ค์ํ๋ค. (์ด๊ฑด ๋น์ฐ)
The basic idea is this. We want to predict future behavior, so the question is what is more important "someone previously clicked an item OR someone previously put an item in their cart". I would say the second is more important. That means the user will most likely click this item again or order this item. So we give lots of weight to previous behavior of "cart".
2) cart vs order ๋น๊ตํ์ ๋ cart๊ฐ ๋ ์ค์ํ ์ด์
Next, we wonder what is more important "someone previously put an item in their cart OR someone previously ordered an item". In both cases, the user might buy the item. But it is more likely that a user will buy an item if they put it in their cart versus buy an item if they have already bought the item. People do buy items multiple times so previously buying an item is more important than previously clicking an item (when predicting a future purchase).
= ์ด์ ์ cart์ ๋ด์๋ ๋ฐ์ดํฐ์ ์ด์ ์ orderํ๋ ์์ดํ
๋ชจ๋ ๊ตฌ๋งคํ ๊ฐ๋ฅ์ฑ์ด ๋๋ค. ๊ทธ๋ฌ๋, ์ด๋ฏธ ์๋ ์์ดํ
์ ์ฌ๋ ๊ฒ๋ณด๋ค๋ ์นดํธ์ ๋ด์๋ ๋ฐ์ดํฐ๋ฅผ ์ด ๊ฐ๋ฅ์ฑ์ด ๋ ๋๋ค. order๊ฐ click๋ณด๋ค ์ค์ํ ๊ฑด ๋น์ฐํ๋ค.