Supermercado Ventas

Importar la base de datos

#file.choose()

bd <- read.csv("/Users/joseramonvazquezguzman/Documents/Tecnológico de Monterrey/Septimo semestre/Analítica de datos /M3/datos_clientes.csv") 

Herramienta “El generador de valor de Datos”

Paso 1. Definir el área del negocio que buscamos impactar y mejorar su KPI.

Se desea impactar el área de ventas y como KPI la retención del cliente e incremento en ventas.

Paso 2. Seleccionar plantilla (-s) para crear valor a partir de los datos de los clientes

Segmentación

Paso 3. Generar ideas o conceptos específicos

Estrategia para retener al cliente y aumentar la venta de productos dentro del supermercado

Paso 4. Reunir los datos requeridos

Base de datos limpia sobre tickets de compra del cliente

Paso 5. Plan de ejecución:

Limpiar base de datos para poderla analizar, segmentar a los clusters de los clientes, interpretar los resultados y generar estrategias para obtener un beneficio en las ventas del negocio.

Agregar el CustomerID como nombre de los renglones

bd2 <- bd
rownames(bd2) <- bd2$CustomerID

Eliminar la columna de CustomerID

bd3 <- bd2
bd3 <- subset (bd3, select = -c(CustomerID))

Revisar presencia de datos anormales

summary(bd3)
##      Total             Visitas       
##  Min.   :    3.45   Min.   :  1.000  
##  1st Qu.:  178.30   1st Qu.:  1.000  
##  Median :  292.00   Median :  2.000  
##  Mean   :  415.62   Mean   :  4.227  
##  3rd Qu.:  426.63   3rd Qu.:  5.000  
##  Max.   :84236.25   Max.   :209.000
plot(bd3$Total, bd3$Visitas)

Notas

#Los datos fuera de lo normal están fuera de los siguientes límites
#Límite Inferior = Q1 - 1.5*IQR
#Límite Superior = Q3 + 1.5*IQR
#Q1: Cuartil 1, Q3: Cuartil 3, IQR: Rango Intercuartil = Q3 - Q1

Calcular el límite superior del Total

iqr_total <- IQR(bd3$Total)
limite_superior_total <- 426.63 + 1.5*iqr_total
limite_superior_total
## [1] 799.1277

Conservar sólo los tickets promedios menores a 800

bd4 <- bd3
bd4 <- bd4[bd4$Total < 800, ]
summary(bd4)
##      Total           Visitas       
##  Min.   :  3.45   Min.   :  1.000  
##  1st Qu.:172.96   1st Qu.:  1.000  
##  Median :272.23   Median :  2.000  
##  Mean   :298.21   Mean   :  4.125  
##  3rd Qu.:390.24   3rd Qu.:  5.000  
##  Max.   :799.62   Max.   :209.000

Calcular el límite superior de visites

iqr_Visitas <- IQR(bd3$Visitas)
limite_superior_visitas <- 5 + 1.5*iqr_Visitas
limite_superior_visitas
## [1] 11

Conservar sólo las visitas menores a 12

bd5 <- bd4
bd5 <- bd5[bd5$Visitas < 12, ]

summary(bd5)
##      Total           Visitas      
##  Min.   :  3.45   Min.   : 1.000  
##  1st Qu.:168.67   1st Qu.: 1.000  
##  Median :267.13   Median : 2.000  
##  Mean   :293.99   Mean   : 2.971  
##  3rd Qu.:384.80   3rd Qu.: 4.000  
##  Max.   :799.62   Max.   :11.000
plot(bd5$Total, bd5$Visitas)

k-means clustering

Normalizar variables

bd6 <- bd5
bd6 <- as.data.frame(scale(bd6))

plot(bd6$Total, bd6$Visitas)

Paso 2. k-means clustering

segmentos <- kmeans(bd6, 3)
segmentos
## K-means clustering with 3 clusters of sizes 2093, 999, 677
## 
## Cluster means:
##        Total    Visitas
## 1 -0.6143925 -0.4369737
## 2  1.2079890 -0.2822451
## 3  0.1169018  1.7674280
## 
## Clustering vector:
## 12347 12350 12352 12353 12355 12358 12361 12362 12363 12364 12370 12373 12374 
##     3     1     3     1     2     2     1     3     1     1     1     2     2 
## 12379 12380 12381 12383 12384 12386 12388 12390 12393 12394 12399 12401 12402 
##     2     2     3     3     1     1     3     2     2     2     1     1     1 
## 12407 12408 12410 12413 12414 12417 12418 12421 12422 12423 12425 12426 12427 
##     3     2     2     1     1     3     2     1     1     3     2     2     1 
## 12429 12430 12434 12436 12441 12442 12445 12447 12448 12450 12452 12453 12455 
##     2     1     2     2     1     1     1     2     2     1     1     2     1 
## 12457 12458 12461 12462 12463 12464 12465 12468 12473 12475 12476 12478 12479 
##     3     2     2     2     2     3     2     2     2     2     3     2     2 
## 12481 12483 12484 12488 12489 12490 12491 12492 12493 12494 12498 12500 12502 
##     3     3     2     2     1     3     2     1     1     3     1     3     2 
## 12504 12506 12507 12508 12509 12510 12512 12513 12515 12516 12517 12518 12519 
##     1     1     2     1     1     2     1     2     2     2     2     3     1 
## 12520 12521 12522 12523 12524 12526 12527 12528 12530 12531 12532 12535 12538 
##     2     2     1     3     3     2     1     3     2     1     2     2     2 
## 12541 12544 12545 12546 12547 12548 12551 12552 12553 12556 12558 12559 12560 
##     1     2     2     2     1     1     1     1     3     1     1     1     2 
## 12561 12562 12564 12565 12566 12571 12572 12573 12574 12576 12577 12579 12580 
##     1     3     2     1     2     1     2     1     1     3     1     2     2 
## 12581 12584 12586 12589 12591 12592 12593 12594 12596 12598 12599 12600 12601 
##     1     3     1     1     2     1     1     3     1     3     3     3     1 
## 12602 12603 12604 12609 12610 12612 12613 12614 12615 12616 12617 12618 12619 
##     1     2     1     2     3     2     2     1     2     2     2     1     3 
## 12620 12622 12623 12624 12626 12627 12628 12633 12637 12638 12639 12640 12641 
##     2     1     1     1     3     3     1     2     3     2     2     2     1 
## 12642 12643 12644 12645 12646 12648 12649 12650 12651 12654 12657 12658 12659 
##     2     3     2     2     2     1     1     1     1     1     2     2     1 
## 12660 12662 12665 12670 12672 12673 12674 12676 12679 12680 12684 12685 12686 
##     1     3     1     2     1     1     2     3     1     1     3     3     1 
## 12689 12690 12691 12693 12694 12695 12697 12701 12702 12703 12705 12707 12708 
##     2     2     3     1     2     1     1     2     1     1     3     2     3 
## 12710 12715 12716 12717 12718 12719 12721 12722 12723 12724 12725 12726 12727 
##     2     2     2     2     1     1     3     1     1     1     2     3     3 
## 12728 12729 12732 12733 12734 12735 12736 12738 12739 12740 12743 12747 12750 
##     1     2     1     2     1     2     1     1     2     2     1     3     1 
## 12756 12759 12763 12775 12778 12779 12782 12783 12784 12785 12787 12789 12790 
##     1     2     1     3     3     3     2     3     1     1     1     1     1 
## 12791 12792 12793 12794 12795 12797 12802 12808 12809 12811 12812 12814 12815 
##     1     2     1     2     2     1     2     1     2     1     1     1     2 
## 12816 12817 12820 12821 12822 12823 12824 12826 12827 12828 12829 12831 12832 
##     1     1     1     1     2     3     2     3     1     3     1     1     1 
## 12833 12834 12836 12837 12838 12840 12842 12843 12844 12845 12849 12851 12852 
##     2     1     2     1     1     2     2     3     1     1     2     1     1 
## 12853 12854 12855 12856 12857 12863 12864 12865 12866 12867 12868 12871 12872 
##     3     2     1     3     2     2     1     2     2     3     3     1     1 
## 12873 12875 12878 12879 12881 12882 12883 12884 12885 12886 12888 12890 12891 
##     2     1     2     1     1     2     1     1     2     2     1     2     1 
## 12893 12895 12897 12902 12904 12906 12908 12909 12910 12912 12913 12915 12916 
##     1     1     1     1     1     2     2     2     3     3     2     1     2 
## 12917 12919 12920 12922 12923 12924 12925 12928 12929 12930 12933 12935 12936 
##     2     3     1     2     1     1     2     3     1     1     1     3     1 
## 12937 12938 12940 12942 12944 12945 12947 12948 12949 12950 12951 12952 12953 
##     2     1     2     1     1     2     3     3     3     2     3     2     1 
## 12955 12956 12957 12962 12963 12965 12966 12968 12970 12974 12976 12977 12981 
##     3     1     3     1     3     2     1     1     1     1     2     1     1 
## 12982 12984 12985 12987 12988 12990 12991 12993 12994 12995 12997 12999 13000 
##     2     1     2     1     2     1     1     1     1     1     1     1     1 
## 13002 13003 13005 13006 13008 13011 13012 13014 13015 13016 13017 13021 13023 
##     1     1     1     1     1     1     3     3     2     1     1     3     2 
## 13026 13028 13029 13030 13032 13033 13034 13035 13037 13038 13040 13043 13044 
##     3     1     2     2     2     1     1     2     1     1     1     2     2 
## 13045 13046 13047 13048 13049 13052 13055 13058 13059 13060 13061 13062 13064 
##     1     1     3     2     1     1     2     1     1     1     1     1     1 
## 13065 13066 13067 13068 13070 13072 13077 13079 13080 13082 13083 13085 13091 
##     1     1     1     1     1     1     1     1     1     3     1     1     1 
## 13092 13095 13097 13099 13101 13103 13104 13106 13107 13108 13109 13110 13115 
##     1     1     3     1     1     1     3     1     2     2     2     3     2 
## 13116 13117 13118 13120 13121 13122 13126 13127 13130 13131 13132 13133 13134 
##     2     3     3     1     1     2     3     1     1     2     1     1     2 
## 13136 13137 13138 13139 13140 13141 13142 13144 13145 13146 13147 13149 13153 
##     2     3     3     2     1     2     1     1     1     1     1     2     2 
## 13155 13157 13158 13159 13160 13161 13162 13165 13166 13167 13168 13169 13170 
##     1     2     1     2     1     1     2     2     2     1     1     2     1 
## 13171 13173 13176 13177 13178 13182 13183 13184 13185 13186 13187 13188 13189 
##     1     1     2     1     3     1     3     3     1     2     1     1     1 
## 13192 13193 13194 13196 13198 13200 13203 13207 13208 13209 13210 13211 13212 
##     2     1     1     2     2     1     1     1     3     3     2     2     1 
## 13213 13216 13217 13218 13220 13221 13223 13226 13227 13228 13229 13232 13233 
##     3     1     1     1     1     2     1     1     1     2     1     3     1 
## 13236 13238 13239 13240 13242 13243 13244 13245 13246 13247 13248 13249 13253 
##     2     1     1     1     1     2     1     2     3     1     1     1     2 
## 13255 13258 13259 13260 13261 13262 13265 13268 13270 13271 13272 13273 13276 
##     1     1     1     2     2     1     3     3     2     1     1     1     1 
## 13277 13278 13279 13280 13282 13283 13284 13285 13291 13292 13294 13295 13296 
##     1     2     1     1     2     1     1     2     2     1     2     1     1 
## 13297 13298 13299 13300 13301 13302 13304 13305 13307 13308 13309 13310 13311 
##     2     2     1     2     1     1     1     3     1     2     3     2     1 
## 13313 13314 13317 13318 13320 13321 13322 13323 13324 13325 13327 13329 13330 
##     3     1     3     1     2     1     1     1     3     2     3     2     2 
## 13332 13336 13338 13341 13343 13345 13347 13348 13349 13350 13351 13352 13354 
##     2     2     2     2     2     2     1     1     1     2     2     2     2 
## 13355 13356 13357 13358 13359 13362 13363 13364 13366 13368 13369 13370 13372 
##     2     2     2     2     2     2     2     1     1     1     1     2     2 
## 13375 13376 13379 13381 13382 13384 13385 13388 13389 13390 13391 13394 13395 
##     2     2     1     2     1     3     2     1     1     2     1     3     1 
## 13396 13397 13398 13402 13403 13404 13405 13410 13411 13414 13416 13417 13419 
##     2     3     2     1     1     1     1     3     1     2     2     1     1 
## 13420 13425 13426 13427 13428 13429 13430 13431 13434 13435 13436 13437 13439 
##     1     2     3     1     1     1     1     2     1     3     1     3     1 
## 13441 13447 13448 13449 13450 13451 13452 13453 13455 13456 13460 13461 13462 
##     1     2     2     1     3     2     1     1     2     3     1     2     1 
## 13464 13466 13467 13470 13471 13473 13474 13475 13476 13477 13479 13481 13482 
##     2     1     2     1     2     1     1     2     2     3     1     3     1 
## 13483 13484 13485 13486 13487 13489 13491 13492 13493 13494 13495 13496 13497 
##     1     1     2     2     1     1     3     2     1     1     3     1     1 
## 13499 13500 13502 13503 13504 13506 13507 13508 13509 13510 13512 13513 13514 
##     3     2     1     1     1     1     2     1     3     2     1     1     1 
## 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13527 13529 
##     1     2     2     2     1     2     2     1     2     1     1     3     1 
## 13531 13532 13533 13536 13538 13539 13544 13546 13548 13549 13551 13557 13558 
##     1     1     1     3     3     1     1     1     1     3     1     1     1 
## 13560 13561 13562 13563 13564 13565 13566 13568 13569 13570 13573 13575 13577 
##     1     1     2     2     2     1     2     1     1     1     1     1     2 
## 13579 13581 13583 13584 13587 13588 13589 13590 13591 13592 13593 13594 13596 
##     1     1     2     1     2     3     1     3     2     1     3     2     2 
## 13598 13600 13601 13602 13603 13606 13607 13610 13611 13614 13615 13617 13618 
##     1     1     2     2     1     1     2     3     2     2     2     1     1 
## 13621 13623 13626 13627 13629 13630 13631 13632 13634 13636 13637 13638 13642 
##     1     1     1     3     3     3     3     3     3     3     1     1     2 
## 13643 13644 13645 13647 13649 13650 13651 13652 13654 13655 13656 13657 13658 
##     1     2     1     2     1     3     1     2     3     2     1     1     2 
## 13659 13662 13663 13666 13667 13669 13670 13672 13673 13675 13678 13681 13682 
##     2     1     1     1     1     1     2     1     1     1     1     1     1 
## 13684 13685 13686 13690 13692 13697 13699 13700 13703 13704 13705 13706 13707 
##     1     3     1     1     2     1     1     3     1     3     1     1     2 
## 13708 13710 13711 13712 13715 13716 13717 13718 13719 13720 13721 13722 13723 
##     1     1     1     1     3     1     3     1     3     1     2     2     1 
## 13725 13726 13727 13728 13730 13731 13732 13735 13736 13737 13739 13740 13741 
##     3     2     1     3     2     1     2     2     2     1     1     2     1 
## 13743 13744 13745 13747 13748 13750 13751 13752 13753 13754 13755 13758 13759 
##     3     2     1     1     3     3     1     3     2     1     3     3     1 
## 13760 13761 13762 13764 13769 13771 13772 13774 13778 13780 13781 13782 13784 
##     1     2     1     2     3     2     2     1     1     1     1     3     3 
## 13786 13787 13790 13791 13792 13799 13800 13801 13803 13804 13805 13806 13807 
##     1     1     2     2     1     2     2     1     1     3     2     1     1 
## 13808 13810 13811 13812 13813 13814 13816 13817 13819 13821 13822 13823 13824 
##     3     2     1     1     2     2     1     1     2     1     1     2     3 
## 13826 13827 13828 13831 13832 13833 13835 13837 13838 13841 13842 13844 13845 
##     1     1     1     3     1     2     1     1     1     1     3     2     1 
## 13846 13848 13849 13856 13858 13859 13860 13862 13863 13865 13866 13867 13869 
##     1     2     2     1     1     1     3     3     1     1     1     2     2 
## 13870 13873 13874 13875 13876 13877 13882 13883 13884 13885 13886 13887 13888 
##     3     1     2     3     1     1     3     2     1     1     1     2     1 
## 13889 13890 13892 13894 13895 13897 13898 13899 13900 13901 13904 13908 13911 
##     2     3     1     1     2     1     1     1     1     2     1     2     3 
## 13914 13917 13918 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 
##     1     1     2     1     2     3     1     1     2     1     2     1     2 
## 13932 13933 13936 13937 13938 13939 13940 13946 13947 13948 13949 13950 13951 
##     1     1     2     1     1     1     1     1     1     1     3     1     1 
## 13953 13954 13955 13956 13959 13960 13962 13963 13967 13971 13972 13973 13974 
##     3     1     1     3     1     1     1     1     1     3     1     1     2 
## 13975 13976 13978 13980 13982 13984 13986 13988 13989 13990 13991 13992 13993 
##     3     2     1     1     2     3     1     2     2     1     3     1     3 
## 13994 13995 14000 14001 14002 14004 14005 14006 14009 14012 14013 14014 14019 
##     3     3     2     2     1     3     2     1     2     1     1     2     2 
## 14020 14021 14022 14023 14024 14027 14029 14030 14032 14034 14035 14036 14037 
##     1     1     2     1     1     1     1     3     3     1     3     2     1 
## 14038 14039 14041 14044 14045 14046 14047 14048 14050 14052 14053 14054 14055 
##     2     1     1     1     2     1     3     2     2     1     1     1     2 
## 14059 14064 14066 14067 14068 14071 14073 14075 14076 14077 14078 14079 14080 
##     1     3     1     1     1     3     1     1     1     1     3     2     1 
## 14081 14082 14083 14087 14089 14090 14093 14098 14099 14100 14102 14104 14107 
##     2     1     3     1     1     1     2     1     3     1     3     1     3 
## 14108 14109 14111 14112 14113 14114 14116 14117 14121 14124 14126 14127 14128 
##     1     1     1     3     2     1     3     1     2     2     1     1     1 
## 14129 14130 14132 14133 14138 14139 14140 14141 14142 14143 14147 14148 14149 
##     3     2     3     1     2     2     2     1     1     1     1     1     2 
## 14150 14152 14154 14155 14157 14158 14159 14161 14162 14163 14165 14167 14171 
##     1     1     2     1     1     2     3     2     1     2     1     1     2 
## 14173 14174 14176 14177 14178 14179 14184 14185 14188 14193 14195 14196 14198 
##     1     1     1     1     3     2     2     1     3     2     2     1     1 
## 14199 14201 14204 14205 14206 14208 14209 14210 14211 14214 14215 14216 14218 
##     1     3     1     1     1     1     3     3     3     3     3     2     1 
## 14219 14220 14221 14222 14223 14224 14226 14227 14229 14231 14232 14233 14234 
##     1     1     3     2     1     1     2     3     2     1     3     2     1 
## 14235 14236 14237 14238 14239 14240 14241 14242 14243 14246 14247 14248 14250 
##     2     1     1     1     3     2     1     1     3     2     1     1     2 
## 14251 14256 14257 14259 14261 14262 14264 14265 14267 14270 14271 14272 14273 
##     2     2     2     1     2     3     1     1     2     2     1     1     1 
## 14276 14280 14284 14285 14287 14288 14289 14290 14291 14292 14293 14295 14297 
##     2     1     1     2     1     2     3     2     3     3     1     1     1 
## 14299 14300 14301 14304 14305 14307 14309 14311 14312 14314 14315 14317 14320 
##     3     1     2     2     2     3     3     1     3     1     3     2     1 
## 14321 14323 14326 14327 14329 14331 14332 14333 14334 14335 14336 14338 14339 
##     3     1     1     1     2     1     1     2     3     1     2     1     1 
## 14340 14341 14342 14344 14345 14346 14348 14349 14350 14351 14352 14353 14354 
##     1     3     1     3     1     2     2     1     1     1     1     1     1 
## 14355 14356 14357 14359 14360 14362 14364 14368 14371 14373 14375 14377 14379 
##     1     2     1     1     2     1     3     1     1     1     1     1     1 
## 14381 14382 14383 14385 14386 14387 14388 14389 14390 14393 14395 14396 14400 
##     1     2     2     1     1     2     3     2     3     1     3     1     2 
## 14403 14404 14406 14407 14408 14409 14410 14412 14413 14414 14416 14418 14419 
##     2     3     1     3     3     3     3     2     1     3     1     2     3 
## 14420 14421 14422 14423 14424 14426 14427 14428 14431 14432 14434 14436 14437 
##     2     2     2     1     1     3     1     3     2     3     3     1     1 
## 14438 14440 14441 14443 14446 14447 14448 14449 14450 14451 14452 14453 14456 
##     1     2     2     2     1     3     1     1     1     1     1     1     3 
## 14457 14460 14461 14462 14463 14465 14466 14467 14470 14472 14473 14474 14475 
##     1     1     2     3     1     2     3     1     1     3     1     2     1 
## 14476 14477 14479 14480 14481 14482 14483 14484 14485 14487 14489 14491 14493 
##     1     1     1     1     1     3     1     1     1     3     2     1     2 
## 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 
##     1     1     1     2     3     1     1     1     3     2     1     3     3 
## 14507 14508 14511 14512 14513 14514 14515 14517 14518 14520 14522 14523 14524 
##     3     1     3     1     1     2     3     1     1     1     1     1     3 
## 14525 14528 14529 14530 14532 14533 14536 14537 14538 14539 14540 14541 14542 
##     3     2     1     3     1     3     1     2     1     1     1     3     1 
## 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14557 14561 14565 
##     2     3     1     1     2     1     1     3     2     1     2     2     2 
## 14567 14569 14570 14572 14573 14576 14577 14578 14581 14582 14583 14584 14585 
##     2     1     1     3     3     1     1     1     1     1     3     1     1 
## 14586 14587 14589 14591 14592 14593 14594 14595 14597 14598 14600 14601 14603 
##     1     3     1     2     1     1     1     3     2     1     2     1     2 
## 14608 14609 14616 14618 14619 14620 14621 14622 14623 14624 14625 14626 14628 
##     2     1     1     1     2     1     3     1     3     1     2     2     1 
## 14629 14631 14632 14633 14636 14638 14639 14640 14641 14642 14643 14644 14645 
##     2     1     1     1     1     2     3     3     1     1     2     2     1 
## 14647 14649 14651 14652 14653 14655 14656 14657 14658 14659 14660 14661 14662 
##     1     2     1     1     3     2     1     1     1     3     1     1     1 
## 14664 14665 14666 14669 14670 14672 14673 14675 14676 14681 14682 14684 14687 
##     1     3     1     2     1     2     3     2     3     1     1     3     2 
## 14689 14690 14691 14692 14693 14696 14697 14698 14699 14700 14701 14703 14704 
##     1     1     3     1     1     3     1     3     1     2     3     1     3 
## 14705 14708 14710 14711 14712 14713 14714 14715 14716 14719 14720 14722 14723 
##     1     2     1     3     1     3     1     1     1     3     1     1     3 
## 14725 14727 14729 14730 14731 14732 14737 14738 14739 14740 14741 14744 14745 
##     2     1     1     3     1     3     2     3     3     2     3     3     3 
## 14747 14748 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 
##     1     3     2     2     1     3     2     2     2     2     1     1     1 
## 14764 14765 14766 14768 14770 14772 14775 14776 14778 14779 14780 14782 14784 
##     1     1     3     1     2     1     2     3     2     1     1     1     1 
## 14785 14788 14789 14790 14792 14793 14794 14795 14798 14799 14801 14803 14804 
##     1     1     1     1     1     1     3     1     1     1     1     1     2 
## 14805 14806 14808 14810 14813 14815 14816 14817 14818 14819 14820 14821 14823 
##     1     1     3     3     1     2     1     2     1     1     1     1     1 
## 14824 14828 14829 14830 14834 14836 14837 14840 14841 14842 14844 14847 14850 
##     1     2     1     1     3     1     2     1     3     2     2     1     1 
## 14851 14852 14853 14854 14855 14856 14857 14859 14860 14861 14862 14863 14865 
##     1     3     1     3     1     2     2     2     1     1     2     1     1 
## 14867 14868 14869 14870 14871 14873 14875 14878 14880 14881 14882 14883 14885 
##     1     3     2     1     1     2     2     3     1     1     1     3     2 
## 14886 14888 14889 14890 14891 14893 14894 14896 14897 14898 14901 14902 14903 
##     2     2     1     1     1     2     2     1     2     3     3     1     2 
## 14904 14905 14907 14908 14910 14912 14913 14915 14916 14920 14921 14923 14924 
##     2     1     3     1     1     2     1     1     1     2     2     2     1 
## 14929 14946 14947 14948 14950 14951 14952 14953 14954 14957 14958 14959 14960 
##     1     1     1     3     2     1     3     1     1     1     1     1     1 
## 14961 14962 14963 14964 14965 14966 14967 14968 14970 14971 14972 14973 14974 
##     3     1     3     1     1     1     2     1     2     2     1     2     1 
## 14975 14976 14978 14981 14984 14985 14987 14988 14995 14997 14998 15000 15002 
##     1     3     3     1     1     1     1     1     1     1     1     2     2 
## 15006 15007 15009 15010 15012 15014 15016 15017 15018 15019 15021 15022 15023 
##     2     1     2     1     1     1     1     1     1     1     3     1     3 
## 15024 15025 15026 15027 15028 15030 15031 15033 15034 15035 15036 15038 15041 
##     3     2     1     1     1     1     1     3     3     1     1     3     1 
## 15042 15043 15045 15047 15048 15049 15050 15051 15052 15053 15054 15057 15058 
##     1     2     2     1     1     1     2     2     1     1     1     2     3 
## 15059 15060 15062 15063 15065 15067 15068 15070 15071 15073 15074 15075 15079 
##     3     1     1     2     2     2     1     1     2     2     2     2     1 
## 15081 15083 15087 15088 15089 15090 15091 15092 15093 15095 15096 15097 15099 
##     1     1     1     2     3     2     2     1     2     2     1     1     2 
## 15100 15101 15103 15104 15105 15106 15107 15109 15110 15111 15114 15115 15116 
##     1     1     2     2     3     3     3     2     1     2     3     1     2 
## 15117 15118 15119 15120 15121 15122 15124 15127 15128 15129 15130 15132 15133 
##     3     1     1     2     1     2     1     2     2     3     1     3     1 
## 15134 15135 15136 15139 15140 15142 15143 15145 15146 15147 15148 15149 15150 
##     3     1     1     1     3     2     1     1     2     2     1     2     3 
## 15153 15154 15156 15157 15158 15160 15163 15164 15165 15167 15168 15172 15174 
##     1     1     1     2     2     1     1     1     2     1     1     3     1 
## 15175 15178 15179 15180 15181 15182 15184 15185 15186 15192 15193 15197 15198 
##     1     1     2     1     1     1     1     1     1     2     2     2     1 
## 15199 15201 15203 15204 15205 15206 15208 15210 15211 15212 15213 15214 15215 
##     1     3     3     1     1     1     3     1     2     1     1     3     1 
## 15216 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15230 15232 
##     1     3     1     3     2     2     2     1     2     1     3     1     1 
## 15234 15236 15237 15238 15239 15240 15241 15243 15244 15246 15247 15252 15253 
##     1     1     2     2     2     3     3     1     1     1     2     2     3 
## 15254 15256 15257 15258 15260 15261 15262 15263 15264 15265 15266 15267 15269 
##     1     1     1     1     3     1     1     1     2     2     1     3     2 
## 15270 15272 15274 15275 15276 15277 15279 15280 15281 15286 15287 15288 15289 
##     3     2     2     2     1     1     1     1     3     1     1     2     1 
## 15292 15296 15297 15299 15300 15303 15304 15306 15307 15308 15312 15313 15314 
##     1     2     1     3     2     2     3     2     1     1     1     1     1 
## 15315 15316 15318 15319 15320 15322 15325 15326 15327 15329 15330 15332 15334 
##     1     1     1     1     1     2     1     1     1     2     2     2     1 
## 15335 15339 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15353 
##     1     1     2     2     1     2     1     1     1     1     1     3     2 
## 15355 15356 15360 15361 15363 15364 15365 15366 15367 15368 15370 15374 15376 
##     1     3     2     2     1     2     3     1     2     2     3     1     2 
## 15379 15380 15381 15384 15385 15386 15389 15392 15393 15394 15395 15396 15397 
##     3     3     1     1     1     2     2     2     1     2     1     1     1 
## 15398 15399 15400 15402 15405 15406 15407 15408 15410 15411 15412 15414 15415 
##     2     1     1     1     2     1     1     1     3     2     1     1     2 
## 15417 15419 15421 15422 15423 15424 15426 15427 15428 15429 15432 15433 15434 
##     2     1     1     1     1     1     3     2     1     1     1     1     3 
## 15435 15436 15437 15438 15440 15442 15443 15444 15445 15447 15448 15449 15450 
##     1     2     1     1     1     2     3     2     1     1     2     1     2 
## 15452 15453 15454 15456 15457 15458 15460 15462 15463 15466 15467 15468 15469 
##     1     3     1     1     1     1     1     1     1     1     1     1     1 
## 15471 15472 15473 15475 15478 15483 15488 15489 15491 15492 15493 15494 15497 
##     2     2     3     2     2     1     1     2     3     1     3     2     2 
## 15500 15503 15504 15505 15506 15507 15508 15510 15511 15512 15514 15516 15517 
##     1     1     1     2     1     2     3     1     3     1     3     1     1 
## 15518 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15532 
##     3     1     3     1     2     2     1     1     3     1     3     2     2 
## 15533 15535 15537 15539 15540 15541 15543 15544 15545 15549 15550 15551 15552 
##     1     1     1     2     1     1     1     3     1     2     1     2     1 
## 15553 15554 15556 15557 15561 15562 15563 15565 15567 15568 15569 15571 15572 
##     2     1     1     2     1     1     2     1     1     1     3     1     3 
## 15573 15574 15577 15578 15579 15582 15584 15585 15587 15589 15592 15593 15594 
##     1     1     1     1     1     1     1     2     1     1     2     1     3 
## 15596 15597 15598 15599 15602 15603 15604 15605 15606 15607 15608 15609 15610 
##     3     1     1     2     3     1     1     3     3     1     1     1     1 
## 15612 15618 15619 15620 15621 15622 15623 15624 15625 15626 15628 15630 15632 
##     1     1     1     2     1     3     1     1     2     1     3     2     3 
## 15634 15636 15637 15639 15641 15643 15644 15645 15646 15648 15649 15651 15652 
##     1     2     1     2     2     1     1     2     1     1     2     1     1 
## 15653 15654 15655 15656 15657 15658 15659 15660 15661 15663 15664 15667 15668 
##     2     2     2     1     1     3     1     3     1     1     2     1     1 
## 15669 15670 15671 15673 15674 15675 15677 15678 15679 15680 15681 15683 15687 
##     1     1     3     2     2     1     2     2     1     2     3     1     3 
## 15689 15690 15691 15692 15695 15696 15699 15700 15701 15703 15704 15705 15706 
##     1     1     1     1     1     3     1     2     2     1     2     1     1 
## 15707 15708 15709 15712 15713 15714 15716 15717 15720 15721 15722 15723 15724 
##     1     3     1     3     1     1     1     1     2     2     2     1     1 
## 15725 15727 15729 15730 15732 15733 15734 15737 15739 15740 15743 15744 15745 
##     2     2     1     2     1     1     2     3     2     1     1     1     1 
## 15746 15747 15748 15750 15752 15753 15754 15755 15756 15757 15758 15759 15762 
##     1     1     1     3     3     1     1     3     1     2     1     1     1 
## 15763 15764 15766 15768 15773 15774 15775 15776 15777 15780 15781 15783 15785 
##     2     3     1     1     2     1     1     1     1     1     1     1     2 
## 15787 15789 15790 15793 15795 15796 15797 15799 15800 15801 15802 15803 15806 
##     1     2     1     1     2     3     2     1     2     2     2     2     1 
## 15807 15809 15810 15811 15812 15813 15814 15815 15819 15820 15821 15822 15823 
##     1     1     2     3     3     2     2     3     2     1     1     2     1 
## 15825 15826 15829 15830 15831 15834 15835 15836 15837 15839 15840 15841 15843 
##     2     2     1     2     1     2     1     1     2     2     1     1     1 
## 15844 15845 15847 15850 15852 15853 15855 15857 15858 15860 15861 15862 15863 
##     1     3     1     1     1     1     1     1     3     3     3     1     1 
## 15864 15865 15866 15869 15870 15872 15874 15877 15880 15881 15882 15883 15885 
##     3     1     1     1     2     1     3     1     1     1     1     1     1 
## 15886 15888 15889 15891 15894 15895 15897 15898 15899 15900 15901 15903 15904 
##     1     1     1     2     1     1     1     3     1     2     1     2     1 
## 15906 15907 15909 15910 15912 15916 15917 15918 15919 15920 15921 15922 15923 
##     3     1     1     3     1     3     1     1     1     1     1     2     1 
## 15925 15930 15932 15933 15935 15937 15938 15940 15942 15944 15945 15948 15949 
##     1     2     3     2     1     1     1     1     1     1     1     2     1 
## 15950 15951 15952 15953 15957 15958 15963 15965 15967 15969 15970 15973 15974 
##     2     2     1     3     2     1     1     1     1     1     1     1     3 
## 15975 15976 15977 15980 15981 15983 15984 15985 15986 15987 15988 15990 15992 
##     2     1     2     2     3     2     3     2     1     3     1     2     1 
## 15993 15994 15996 15998 16003 16005 16006 16007 16008 16009 16010 16012 16014 
##     3     2     3     2     2     1     1     2     1     1     1     2     1 
## 16015 16016 16017 16018 16019 16020 16022 16023 16024 16025 16026 16027 16030 
##     1     3     1     1     3     1     2     1     1     2     1     3     1 
## 16031 16034 16036 16037 16038 16040 16042 16043 16045 16048 16049 16050 16052 
##     1     1     2     1     1     2     3     1     2     1     2     1     2 
## 16053 16054 16055 16056 16057 16059 16062 16063 16065 16066 16070 16071 16072 
##     2     2     1     2     3     3     1     1     2     3     2     1     2 
## 16073 16076 16078 16079 16080 16081 16083 16084 16085 16086 16091 16092 16093 
##     1     3     1     2     1     2     2     2     3     3     1     1     1 
## 16094 16096 16097 16098 16099 16102 16103 16104 16105 16106 16107 16109 16110 
##     1     1     1     3     1     2     3     1     1     1     3     1     2 
## 16112 16113 16114 16115 16116 16117 16119 16120 16121 16122 16123 16124 16125 
##     1     1     1     3     2     1     1     1     2     1     1     1     1 
## 16127 16128 16131 16134 16135 16136 16139 16140 16141 16142 16143 16144 16145 
##     2     3     2     1     2     1     1     2     2     2     3     1     3 
## 16146 16147 16148 16149 16150 16153 16156 16157 16159 16160 16162 16163 16164 
##     1     2     1     1     3     3     3     1     1     2     1     2     1 
## 16169 16170 16171 16172 16173 16174 16175 16177 16178 16179 16181 16183 16184 
##     2     3     1     3     3     1     1     1     1     1     1     1     3 
## 16185 16188 16189 16190 16193 16198 16200 16201 16202 16203 16204 16205 16206 
##     1     1     1     1     1     2     2     2     2     1     2     1     1 
## 16207 16208 16209 16211 16212 16213 16214 16215 16217 16218 16221 16224 16225 
##     2     1     2     2     2     1     2     1     1     3     1     1     3 
## 16226 16227 16229 16230 16232 16233 16235 16236 16239 16242 16243 16244 16245 
##     1     1     2     1     1     1     3     2     1     3     1     2     2 
## 16247 16248 16249 16250 16255 16256 16257 16261 16265 16266 16268 16271 16272 
##     1     1     3     1     3     2     1     1     3     3     1     3     2 
## 16274 16275 16278 16279 16282 16283 16284 16287 16292 16293 16295 16297 16298 
##     2     2     2     2     1     3     2     1     1     3     2     1     1 
## 16302 16305 16306 16308 16309 16311 16313 16315 16316 16317 16318 16319 16320 
##     1     2     3     2     2     1     1     1     3     2     1     2     2 
## 16321 16322 16323 16324 16325 16327 16330 16332 16337 16338 16339 16340 16341 
##     1     1     1     1     1     2     1     3     1     1     1     2     2 
## 16342 16343 16344 16345 16347 16348 16349 16350 16351 16352 16354 16356 16357 
##     1     1     1     2     2     3     1     1     1     1     1     1     1 
## 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 
##     2     3     2     1     1     1     2     3     1     2     1     2     1 
## 16372 16374 16376 16377 16378 16379 16383 16384 16385 16386 16387 16389 16392 
##     1     1     2     2     1     2     1     1     1     1     1     2     1 
## 16394 16395 16399 16400 16402 16403 16404 16405 16406 16407 16409 16411 16412 
##     3     3     1     1     1     1     2     1     1     3     3     1     1 
## 16413 16414 16415 16416 16418 16419 16423 16424 16425 16426 16427 16429 16430 
##     1     1     1     2     1     3     1     1     1     3     1     1     1 
## 16431 16432 16433 16434 16438 16440 16441 16442 16444 16445 16447 16448 16449 
##     1     1     1     3     1     2     1     1     1     1     1     1     2 
## 16450 16451 16454 16455 16456 16457 16460 16461 16462 16463 16464 16466 16468 
##     1     1     1     3     3     1     1     1     1     2     2     3     1 
## 16469 16470 16471 16473 16474 16475 16477 16478 16479 16480 16482 16483 16484 
##     1     1     1     1     3     1     3     1     1     2     1     1     1 
## 16485 16488 16491 16493 16495 16496 16497 16498 16499 16500 16503 16504 16505 
##     2     1     2     2     1     2     3     1     1     3     2     2     2 
## 16506 16509 16510 16511 16513 16515 16516 16517 16518 16519 16520 16526 16527 
##     1     2     1     1     1     3     1     1     1     1     2     1     1 
## 16528 16529 16531 16533 16535 16536 16539 16542 16545 16546 16549 16550 16551 
##     1     2     3     2     2     2     2     1     1     2     3     2     1 
## 16552 16554 16555 16556 16557 16560 16561 16565 16566 16567 16569 16570 16571 
##     1     1     1     3     1     2     1     1     1     2     1     3     2 
## 16572 16573 16574 16581 16582 16583 16584 16586 16587 16589 16591 16593 16594 
##     1     1     2     1     1     1     2     2     1     1     1     1     1 
## 16595 16596 16597 16598 16600 16601 16602 16603 16609 16610 16611 16612 16613 
##     2     1     1     1     3     1     2     1     2     1     1     1     2 
## 16614 16616 16617 16618 16619 16620 16621 16623 16624 16625 16627 16628 16629 
##     2     1     1     2     1     1     1     1     2     1     1     2     1 
## 16633 16634 16637 16638 16639 16641 16642 16643 16644 16647 16648 16650 16653 
##     3     1     1     3     2     1     2     2     2     1     1     2     2 
## 16654 16655 16657 16658 16659 16660 16665 16666 16667 16668 16669 16670 16671 
##     1     2     1     1     1     1     1     1     1     3     2     3     2 
## 16674 16676 16679 16680 16681 16682 16685 16686 16688 16689 16690 16692 16693 
##     1     2     1     1     3     3     1     3     1     1     1     2     1 
## 16696 16697 16706 16708 16709 16710 16711 16712 16714 16715 16716 16717 16718 
##     1     1     1     2     2     3     3     3     2     1     2     2     2 
## 16719 16720 16721 16723 16725 16726 16727 16728 16730 16732 16734 16735 16737 
##     3     1     1     1     3     3     1     1     1     2     1     2     2 
## 16738 16739 16742 16743 16744 16747 16748 16750 16752 16753 16755 16756 16757 
##     1     1     2     3     3     2     3     1     1     1     2     1     1 
## 16758 16759 16761 16762 16763 16765 16766 16767 16768 16769 16770 16771 16773 
##     2     1     1     2     2     1     2     3     1     2     1     2     1 
## 16774 16775 16776 16777 16778 16780 16781 16784 16788 16789 16790 16791 16792 
##     1     3     2     1     1     1     1     1     1     1     3     3     1 
## 16793 16794 16795 16796 16801 16803 16804 16805 16806 16807 16808 16809 16810 
##     1     3     2     1     2     1     1     1     1     2     1     3     1 
## 16811 16812 16813 16816 16817 16818 16820 16823 16824 16825 16826 16828 16829 
##     1     2     3     1     3     3     2     2     1     2     1     1     1 
## 16830 16832 16833 16834 16835 16836 16837 16838 16841 16842 16846 16847 16848 
##     1     1     1     2     1     1     3     1     3     2     1     1     1 
## 16849 16850 16851 16852 16855 16856 16858 16859 16861 16863 16866 16869 16871 
##     1     1     1     1     1     1     2     2     1     1     1     1     3 
## 16872 16875 16877 16878 16880 16881 16882 16883 16884 16885 16887 16889 16891 
##     1     3     3     1     3     2     1     1     1     1     1     2     1 
## 16892 16893 16895 16897 16898 16899 16900 16903 16905 16906 16907 16909 16910 
##     1     1     1     1     1     3     1     2     3     1     3     2     3 
## 16912 16913 16914 16915 16916 16917 16918 16919 16921 16924 16926 16927 16929 
##     3     1     1     3     1     2     3     3     1     1     1     1     3 
## 16930 16932 16933 16934 16936 16938 16942 16943 16947 16948 16949 16950 16951 
##     1     1     1     2     1     2     3     1     2     1     3     2     2 
## 16952 16953 16954 16955 16956 16957 16959 16960 16961 16963 16965 16966 16967 
##     1     1     3     1     1     1     1     1     1     1     1     3     1 
## 16968 16969 16971 16976 16978 16979 16980 16982 16983 16985 16987 16988 16989 
##     1     1     2     1     1     3     2     2     3     3     3     1     3 
## 16990 16992 16996 16997 16998 16999 17001 17002 17004 17006 17007 17010 17011 
##     1     3     3     1     1     1     3     2     2     1     3     1     1 
## 17014 17015 17018 17019 17022 17024 17025 17026 17027 17029 17030 17031 17033 
##     1     2     2     1     1     1     1     1     3     2     1     1     2 
## 17034 17035 17038 17040 17041 17042 17043 17045 17046 17047 17048 17049 17050 
##     1     1     1     2     2     3     2     1     2     2     1     3     3 
## 17051 17052 17053 17054 17058 17059 17060 17061 17062 17063 17064 17069 17070 
##     1     2     2     3     2     2     1     3     1     3     1     3     1 
## 17071 17073 17075 17076 17078 17079 17080 17081 17083 17085 17086 17088 17090 
##     3     2     1     1     1     1     1     1     2     3     3     2     3 
## 17091 17092 17094 17095 17096 17097 17100 17101 17102 17105 17109 17110 17111 
##     3     2     1     2     1     3     2     2     1     1     3     1     1 
## 17114 17115 17117 17118 17119 17120 17122 17123 17124 17125 17126 17128 17131 
##     3     1     1     1     1     1     1     1     1     1     3     1     2 
## 17133 17134 17135 17138 17140 17142 17144 17146 17147 17148 17152 17153 17154 
##     2     1     3     2     2     2     2     1     2     1     2     1     1 
## 17155 17157 17158 17159 17160 17162 17163 17164 17165 17166 17169 17171 17172 
##     1     1     2     2     2     3     1     3     1     1     2     1     1 
## 17173 17174 17175 17176 17179 17180 17181 17183 17186 17187 17188 17189 17190 
##     3     1     2     1     1     1     1     3     1     1     3     1     1 
## 17191 17193 17194 17198 17201 17203 17204 17205 17206 17211 17212 17213 17214 
##     3     3     1     1     1     2     2     2     1     3     1     3     3 
## 17217 17218 17219 17221 17222 17223 17226 17227 17228 17229 17230 17231 17232 
##     1     3     1     1     2     1     2     3     3     1     3     3     1 
## 17233 17234 17235 17236 17237 17239 17242 17245 17247 17248 17250 17251 17252 
##     1     1     1     3     1     2     2     1     1     1     1     1     1 
## 17253 17254 17255 17256 17259 17262 17263 17265 17266 17267 17268 17272 17274 
##     1     1     1     1     1     3     1     1     1     1     1     2     1 
## 17277 17278 17279 17282 17284 17286 17287 17288 17289 17290 17291 17293 17295 
##     2     1     1     2     3     1     3     3     1     1     2     3     1 
## 17297 17298 17299 17301 17302 17303 17309 17311 17312 17314 17320 17321 17323 
##     1     1     1     1     3     1     1     2     1     3     2     2     3 
## 17324 17325 17329 17330 17331 17333 17334 17337 17339 17341 17343 17344 17345 
##     1     1     1     1     1     2     1     2     1     1     1     1     1 
## 17347 17348 17349 17350 17351 17356 17357 17358 17359 17360 17361 17362 17364 
##     1     3     1     1     1     1     1     1     1     1     1     1     3 
## 17365 17367 17368 17370 17371 17372 17373 17374 17375 17376 17379 17382 17383 
##     3     1     3     1     1     3     1     1     1     1     2     1     1 
## 17384 17385 17386 17387 17388 17391 17392 17394 17397 17398 17400 17403 17405 
##     1     1     3     2     1     1     1     1     2     1     3     1     2 
## 17406 17408 17409 17410 17411 17412 17414 17415 17418 17420 17422 17423 17425 
##     2     1     2     3     1     3     2     2     1     1     3     2     2 
## 17427 17429 17430 17431 17432 17433 17434 17436 17438 17440 17442 17446 17447 
##     1     1     1     2     1     1     3     1     2     1     3     1     1 
## 17449 17451 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 
##     3     3     1     1     1     1     3     1     1     3     1     1     3 
## 17464 17466 17468 17469 17470 17472 17475 17480 17481 17483 17486 17489 17490 
##     1     2     1     3     3     1     1     2     1     1     2     1     3 
## 17491 17492 17495 17496 17498 17499 17500 17501 17502 17503 17504 17505 17506 
##     3     2     1     1     1     2     2     1     1     1     3     2     1 
## 17507 17508 17509 17510 17512 17513 17514 17515 17516 17517 17519 17520 17521 
##     1     2     3     1     3     2     1     1     1     1     3     2     1 
## 17522 17523 17524 17525 17526 17527 17528 17530 17531 17534 17535 17536 17537 
##     3     1     1     2     1     1     3     3     1     1     1     1     2 
## 17538 17540 17542 17545 17548 17549 17550 17551 17552 17554 17555 17556 17557 
##     1     1     1     1     1     1     1     1     1     3     1     1     1 
## 17560 17561 17562 17564 17566 17567 17569 17571 17572 17573 17574 17578 17579 
##     1     1     3     1     2     3     1     2     1     1     1     1     1 
## 17580 17582 17584 17585 17588 17589 17590 17591 17593 17594 17595 17596 17600 
##     1     1     2     1     2     2     2     3     2     2     1     3     1 
## 17601 17603 17604 17608 17609 17612 17614 17615 17616 17618 17619 17620 17621 
##     1     2     1     1     3     3     2     1     1     1     1     1     2 
## 17623 17624 17625 17628 17629 17630 17631 17633 17634 17636 17637 17639 17640 
##     2     2     2     1     3     1     1     2     3     1     1     1     2 
## 17642 17643 17644 17646 17647 17648 17650 17651 17653 17654 17655 17656 17658 
##     2     1     3     1     1     2     1     3     1     1     3     3     1 
## 17660 17663 17664 17666 17667 17668 17669 17670 17671 17673 17674 17676 17678 
##     1     3     1     2     3     1     3     1     2     3     1     3     1 
## 17680 17682 17684 17685 17691 17692 17693 17694 17695 17696 17697 17698 17700 
##     1     3     1     3     1     1     1     1     2     3     1     1     2 
## 17701 17702 17703 17704 17705 17707 17708 17709 17711 17712 17714 17715 17716 
##     2     2     1     2     3     1     1     1     1     2     1     1     3 
## 17718 17720 17722 17723 17724 17725 17731 17732 17733 17734 17736 17737 17738 
##     1     1     2     3     2     3     1     1     2     1     1     1     2 
## 17739 17742 17744 17746 17747 17749 17750 17752 17754 17758 17759 17760 17761 
##     3     1     3     1     1     1     3     1     3     3     1     1     2 
## 17763 17764 17765 17767 17768 17769 17770 17771 17772 17774 17775 17777 17779 
##     1     2     1     1     2     3     3     1     1     1     1     1     1 
## 17781 17783 17785 17786 17787 17788 17789 17791 17793 17795 17796 17797 17799 
##     1     1     1     1     2     2     1     1     1     1     1     1     3 
## 17800 17802 17805 17806 17812 17813 17816 17817 17819 17824 17827 17828 17830 
##     3     2     2     2     1     3     1     1     3     1     3     2     1 
## 17831 17832 17835 17836 17837 17838 17839 17843 17848 17849 17852 17854 17855 
##     1     1     1     1     3     2     1     1     3     1     1     1     1 
## 17856 17859 17860 17861 17862 17863 17864 17866 17867 17869 17871 17873 17874 
##     2     1     1     3     1     3     1     1     3     1     1     3     3 
## 17877 17878 17879 17880 17881 17883 17884 17885 17886 17887 17888 17889 17890 
##     1     2     1     2     1     1     1     1     1     1     3     1     1 
## 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17904 17905 
##     1     1     1     3     1     1     1     1     1     1     1     1     1 
## 17906 17908 17911 17912 17913 17914 17917 17921 17923 17924 17925 17926 17928 
##     1     1     2     1     1     1     1     1     1     3     1     1     1 
## 17929 17930 17931 17932 17934 17935 17936 17937 17939 17940 17941 17942 17946 
##     1     3     1     2     2     1     2     3     1     3     1     1     1 
## 17947 17948 17950 17951 17955 17956 17957 17958 17960 17962 17964 17966 17967 
##     1     2     1     1     1     1     1     2     1     1     1     3     1 
## 17968 17969 17970 17972 17973 17974 17976 17977 17978 17979 17980 17984 17985 
##     1     1     2     1     1     1     2     1     1     1     1     1     2 
## 17986 17987 17988 17990 17991 17994 17995 17997 17999 18001 18004 18005 18006 
##     1     1     3     1     1     1     1     3     1     1     1     1     2 
## 18008 18009 18010 18011 18013 18014 18015 18016 18017 18018 18019 18022 18024 
##     3     1     1     1     1     1     1     3     1     1     1     2     1 
## 18027 18030 18032 18033 18034 18035 18036 18037 18040 18042 18043 18044 18045 
##     1     1     1     1     1     1     1     3     1     1     1     3     1 
## 18048 18050 18053 18055 18056 18058 18059 18061 18062 18064 18066 18067 18068 
##     1     1     1     3     2     1     1     3     1     2     1     2     1 
## 18069 18071 18072 18074 18075 18077 18078 18080 18081 18082 18084 18085 18086 
##     3     1     1     2     3     3     1     2     1     2     1     2     1 
## 18088 18093 18094 18095 18096 18097 18099 18101 18104 18105 18106 18108 18110 
##     1     2     3     1     1     3     1     1     2     1     2     1     1 
## 18112 18113 18114 18116 18117 18119 18120 18121 18122 18123 18125 18126 18127 
##     1     1     1     3     1     1     1     1     3     1     1     1     1 
## 18129 18130 18135 18136 18138 18142 18143 18145 18146 18147 18149 18150 18151 
##     1     2     1     1     1     2     2     2     1     1     1     1     1 
## 18154 18155 18156 18158 18159 18160 18161 18164 18165 18167 18168 18169 18170 
##     1     1     2     1     2     1     3     2     1     2     3     1     1 
## 18171 18173 18174 18176 18177 18178 18179 18180 18181 18183 18184 18185 18188 
##     3     2     1     2     3     2     3     3     2     1     1     1     2 
## 18189 18190 18191 18193 18196 18200 18202 18203 18204 18205 18209 18210 18211 
##     2     1     1     1     2     1     2     1     2     1     1     3     1 
## 18212 18213 18215 18216 18217 18218 18219 18220 18221 18222 18224 18226 18227 
##     1     1     1     2     1     1     3     1     3     2     1     3     1 
## 18228 18230 18231 18232 18233 18235 18236 18237 18239 18240 18242 18245 18246 
##     2     3     3     1     2     2     3     3     3     2     2     3     1 
## 18248 18249 18250 18252 18255 18257 18259 18260 18261 18262 18263 18265 18268 
##     2     1     2     1     1     3     2     3     1     1     2     2     1 
## 18269 18270 18272 18273 18274 18276 18277 18278 18280 18281 18282 18287 
##     1     1     3     1     1     1     1     1     1     1     1     2 
## 
## Within cluster sum of squares by cluster:
## [1] 957.5353 884.2098 843.1167
##  (between_SS / total_SS =  64.4 %)
## 
## Available components:
## 
## [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
## [6] "betweenss"    "size"         "iter"         "ifault"
asignacion <- cbind(bd5, cluster = segmentos$cluster)
head(asignacion,10)
##          Total Visitas cluster
## 12347 615.7143       7       3
## 12350 334.4000       1       1
## 12352 313.2550       8       3
## 12353  89.0000       1       1
## 12355 459.4000       1       2
## 12358 584.0300       2       2
## 12361 189.9000       1       1
## 12362 522.6230      10       3
## 12363 276.0000       2       1
## 12364 328.2750       4       1

Exportar csv

write.csv(asignacion,"act_clientes_segmentados_a01177017")

Visualizar segmentos

#install.packages("factoextra")
library(factoextra)
## Loading required package: ggplot2
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
fviz_cluster(segmentos, data = bd6,
             palette = c("red", "blue", "black", "darkgreen"),
             ellipse.type = "euclid",
             star.plot = T,
             repel = T,
             ggtheme = theme())
## Warning: ggrepel: 3734 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

Optimizar k

#install.packages("cluster")
library(cluster)
set.seed(123)
optimizacion <- clusGap(bd6, FUN = kmeans, nstart = 25, K.max = 10, B = 50)
## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations

## Warning: did not converge in 10 iterations
plot(optimizacion, xlab = "Numero de clusters k")

Conclusiones

Se logran ver 3 clusters, el primero de color negro que esta en el tercer cuadrante, nos indica cuales son los clientes que visitan pocas veces el supermercado y consumen poco al ir; para este cluster se propone integrar un sistema de cupones que incentive que estas personas se sientan más atraídas por ir a este supermercado, y que cuando vayan se puedan enganchar con más cosas que se pongan en zonas estratégicas para incentivar la compra de más productos.

En el cuadrante cuatro, se tiene el color azul, que nos indica los clientes que van pocas veces pero que cuando van compran un ticket elevado, aquí lo que se propone es tener generar un sistema de puntos en tarjeta para que estos clientes que van pocas veces pero consumen mucho cuando van, sientan la necesidad de ir con ´más frecuencia al tener puntos acumulados, lo que les genere algún tipo de presión.

Finalmente en el cuadrante uno, tenemos el color rojo, donde están los clientes que compran mucho y van constantemente al supermercado, la estrategia que se recomienda implementar aquí para que estos sigan consumiendo con esa frecuencia es mantener promociones visibles en toda la tienda, que logren llamar la atención de estos clientes, bajar estratégicamente los precios de los productos más vendidos y subirlos en otros que quizá no sean tan frecuentes pero que si sean vendidos a cierto sector económico para mantener a dichos clientes.

LS0tCnRpdGxlOiA8c3BhbiBzdHlsZT0iY29sb3I6Z3JlZW4iPlNlZ21lbnRhY2lvbiBNZXJjYWRvIEstbWVhbnNDbHVzIFNWPC9zcGFuPgphdXRob3I6ICJKb3PDqSBSYW3Ds24gQTAxNjI1MjAzIgpkYXRlOiAiMjAtMDktMjAyMiIKb3V0cHV0OiAKICBodG1sX2RvY3VtZW50OgogICB0b2M6IHRydWUKICAgdG9jX2Zsb2F0OiB0cnVlCiAgIGNvZGVfZG93bmxvYWQ6IHRydWUKLS0tCgoKPGltZyBzcmM9ICIvVXNlcnMvam9zZXJhbW9udmF6cXVlemd1em1hbi9EZXNrdG9wL21tbW1tLmpwZWciID4KCiMgKipTdXBlcm1lcmNhZG8gVmVudGFzKioKCiMjIEltcG9ydGFyIGxhIGJhc2UgZGUgZGF0b3MKYGBge3J9CgojZmlsZS5jaG9vc2UoKQoKYmQgPC0gcmVhZC5jc3YoIi9Vc2Vycy9qb3NlcmFtb252YXpxdWV6Z3V6bWFuL0RvY3VtZW50cy9UZWNub2xvzIFnaWNvIGRlIE1vbnRlcnJleS9TZXB0aW1vIHNlbWVzdHJlL0FuYWxpzIF0aWNhIGRlIGRhdG9zIC9NMy9kYXRvc19jbGllbnRlcy5jc3YiKSAKYGBgCgoKCiMjIyAgSGVycmFtaWVudGEgIkVsIGdlbmVyYWRvciBkZSB2YWxvciBkZSBEYXRvcyIgCgojIyMjICA8c3BhbiBzdHlsZT0iY29sb3I6cmVkIj5QYXNvIDEuPC9zcGFuPiBEZWZpbmlyIGVsIMOhcmVhIGRlbCBuZWdvY2lvIHF1ZSBidXNjYW1vcyBpbXBhY3RhciB5IG1lam9yYXIgc3UgS1BJLgoKIyMjIyAgU2UgZGVzZWEgaW1wYWN0YXIgZWwgw6FyZWEgZGUgdmVudGFzIHkgY29tbyBLUEkgbGEgcmV0ZW5jac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