Skip to content

Commit f6f11c2

Browse files
committed
segmentation
1 parent 743732e commit f6f11c2

File tree

1 file changed

+65
-3
lines changed

1 file changed

+65
-3
lines changed

Lecture20_Customer_Segmentation_Easy_version.ipynb

+65-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Customer segmentation using clustering an classification (Simple)\n",
8+
"\n",
9+
"https://archive.ics.uci.edu/ml/datasets/online+retail : \n",
10+
"\n",
11+
"이 데이터는 2010년 1월 20일 부터 2011년 9월 12일 까지의 기간동안 온라인 전자상거래 회사에서 발생한 transaction에 대한 내용입니다. 해당 회사는 UK-based non-store online 전자상거래 회사입니다.\n",
12+
"\n",
13+
"이 데이터를 이용하여, 사용자의 행동을 분석합니다. 사용자의 행동을 분석하여, 사용자의 행동을 예측하는 모델을 만들겠습니다."
14+
]
15+
},
16+
{
17+
"cell_type": "markdown",
18+
"metadata": {},
19+
"source": [
20+
"# 1. 데이터 로딩"
21+
]
22+
},
323
{
424
"cell_type": "code",
525
"execution_count": 2,
@@ -171,6 +191,13 @@
171191
"dataset.head()"
172192
]
173193
},
194+
{
195+
"cell_type": "markdown",
196+
"metadata": {},
197+
"source": [
198+
"# 2. 데이터 전처리"
199+
]
200+
},
174201
{
175202
"cell_type": "code",
176203
"execution_count": 4,
@@ -482,7 +509,14 @@
482509
"source": [
483510
"# 4339명의 transaction을 가지고 있다.\n",
484511
"df_customerid_groups=dataset.groupby(\"CustomerID\")\n",
485-
"print(len((df_customerid_groups.groups)))"
512+
"print(len(df_customerid_groups.groups))"
513+
]
514+
},
515+
{
516+
"cell_type": "markdown",
517+
"metadata": {},
518+
"source": [
519+
"# 3. Clustering"
486520
]
487521
},
488522
{
@@ -590,6 +624,14 @@
590624
"df_cluster.head()"
591625
]
592626
},
627+
{
628+
"cell_type": "markdown",
629+
"metadata": {},
630+
"source": [
631+
"- Quantity\n",
632+
"- UnitPrice"
633+
]
634+
},
593635
{
594636
"cell_type": "code",
595637
"execution_count": 26,
@@ -617,19 +659,32 @@
617659
"x"
618660
]
619661
},
662+
{
663+
"cell_type": "markdown",
664+
"metadata": {},
665+
"source": [
666+
"> Feature Scaling"
667+
]
668+
},
620669
{
621670
"cell_type": "code",
622671
"execution_count": 27,
623672
"metadata": {},
624673
"outputs": [],
625674
"source": [
626-
"# Feature Scaling\n",
627675
"from sklearn.preprocessing import StandardScaler\n",
628676
"\n",
629677
"sc_x = StandardScaler()\n",
630678
"x = sc_x.fit_transform(x)"
631679
]
632680
},
681+
{
682+
"cell_type": "markdown",
683+
"metadata": {},
684+
"source": [
685+
"> K-means"
686+
]
687+
},
633688
{
634689
"cell_type": "code",
635690
"execution_count": 28,
@@ -681,6 +736,13 @@
681736
"plt.ylabel('With in cluster sum of squers(WCSS)')"
682737
]
683738
},
739+
{
740+
"cell_type": "markdown",
741+
"metadata": {},
742+
"source": [
743+
"> 시각화"
744+
]
745+
},
684746
{
685747
"cell_type": "code",
686748
"execution_count": 30,
@@ -804,7 +866,7 @@
804866
"name": "python",
805867
"nbconvert_exporter": "python",
806868
"pygments_lexer": "ipython3",
807-
"version": "3.6.3"
869+
"version": "3.6.7"
808870
}
809871
},
810872
"nbformat": 4,

0 commit comments

Comments
 (0)