DogGo Customer Segmentation Project

Introduction

DogGo is an application whose goal is to match dog owners and dog walkers. DogGO trains its dog walkers and matches them to the most appropriate dog and its owner. Associates of DogGo would like to be very good at matching and customer satisfaction. One of the steps of improving customer satisfaction is defining the different customer segmentations. For example, if it is known that which customer belongs to which cluster, a campaign can be organized directly to related customers. In order to reach the right customer in the right cluster, customer segmentation must be applied quite accurately.RFM analysis is one of the most common approach for customer segmentation. Values of recency, monetary and frequency that belong to customers are used for clustering. Tenure, which means lifetime of customer, can be used as fourth criteria as in this project. Clustering is carried out K-means and GMM algorithms in this project and clusters are labeled according to outputs

Approach

DogGo collects the different types of data related to owners, dogs, walkers, etc. Walks Customer Segment and Owner datasets are the most proper two to cluster the customer. The Walks Customer Segment and the Owners datasets are merged, and it consists of 49 columns and 61,275 transactions.

Firstly, the dataset is investigated to understand it, and data wrangling processes are carried out to get the dataset ready to model. As a next step, exploratory data analysis is completed to get some insights from the dataset.

The standard deviation of the amount is so high when it compares with mean. The most spending customer affects the standard deviation, and this customer will not be taken into account because it is an outlier. The numbers less than 16.48 can be misleading amounts, and they affect the mean, and they will be replaced with the median of the amount. Then, two walk statuses are finished and canceled. Finished walks are used to calculate RFM because canceled walks are not proper transactions.

RFM and tenure columns are generated using the part from the last year. However, the analysis will be repeated for each six months period and using whole data. The results and migration between clusters will be compared.

Frequency and monetary are highly correlated, so frequency is excluded from RFM analysis. The analyses are completed using Recency, Monetary and Tenure features. Next, Recency, Monetary and Tenure features are tried to normalize using four different transformation methods: square root, reciprocal, log, and boxcox. All process failed, but the nearest values to normal distribution are obtained thanks to boxcox method. As a next step, Minmax scaler and Robust scaler are used to scale the data, and Minmax scaler gives better results.

Clustering is carried out using K-means and GMM algorithms, and their results are plotted on two dimensions. PCA is used to convert from 3 to 2 dimensions. Different pairs are plotted to understand the differences of clusters such as tenure with recency or recency with monetary. The clusters are labelled according to descriptive values and visualizations such as plots mentioned above and snake plots.

Pre-processing

In [ ]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import statistics
In [ ]:
from google.colab import drive
drive.mount('/content/drive')
Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).
In [ ]:
df_owners = pd.read_excel("/content/drive/MyDrive/DogGo/owners.xlsx")
In [ ]:
df = pd.read_excel("/content/drive/MyDrive/DogGo/walksCustomerSegment.xlsx")
In [ ]:
df = pd.merge(df, df_owners, left_on="ownerid", right_on="id", how='left')
In [ ]:
df.head()
Out[ ]:
Unnamed: 0_x Unnamed: 0.1_x Unnamed: 0.1.1 Unnamed: 0.1.1.1 Unnamed: 0.1.1.1.1 ownerid walkingid walkid walkerid dogid paymentid walkingtype walkstatus duration ordercreatedtime checkintime confirmtime matchtime starttime endtime cancelledby cancelreason heat walkgroup distance district neighborhood walkerF_commWithPeople walkerF_commWithPariahDog walkerF_commWithStreetCat walkerF_goodPath walkerF_walkWithDogAgain walkerF_note ownerF_commWithMe ownerF_commWithDog ownerF_timeAccuracy ownerF_appPerformance ownerF_note paymentstatus paymenttype amount discount walkerincome promocodeid finishtime Unnamed: 0_y Unnamed: 0.1_y id mgapplytime signuptime firstdogaddedtime
0 0 0 0 0 61000 00d2941f-7e9f-4422-a662-2d9012607d35 810c2b91-3962-4a46-9d2c-0b8d2466476c 810c2b91-3962-4a46-9d2c-0b8d2466476c 5b15dbef-554c-4e9d-8e78-29b034cdcb25 436db8e3-981c-4c74-97b8-a2ecbbed07a2 b0095c6f-e810-4d53-94ba-4edd1e852bb4 Boarding Finished NaN 2021-02-09 21:24:14.228 2021-02-12 03:00:00 2021-02-12 05:50:24.404 2021-02-10 09:48:06.177 2021-02-12 12:07:05.207 NaT NaN NaN NaN NaN NaN Kağıthane Çeliktepe NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Approved Paid 89.900000 0.0 120.46 NaN 2021-02-14 17:20:28.268 27378.0 27378.0 00d2941f-7e9f-4422-a662-2d9012607d35 2021-01-13 13:25:43.583 2020-11-22 19:05:28.360 2020-11-22 19:11:03.686
1 1 1 1 1 61001 00d2941f-7e9f-4422-a662-2d9012607d35 810c2b91-3962-4a46-9d2c-0b8d2466476c 810c2b91-3962-4a46-9d2c-0b8d2466476c 5b15dbef-554c-4e9d-8e78-29b034cdcb25 436db8e3-981c-4c74-97b8-a2ecbbed07a2 b0095c6f-e810-4d53-94ba-4edd1e852bb4 Boarding Finished NaN 2021-02-09 21:24:14.228 2021-02-13 03:00:00 2021-02-12 05:50:24.404 2021-02-10 09:48:06.177 2021-02-12 12:07:05.207 NaT NaN NaN NaN NaN NaN Kağıthane Çeliktepe NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Approved Paid 89.900000 0.0 120.46 NaN 2021-02-14 17:20:28.268 27378.0 27378.0 00d2941f-7e9f-4422-a662-2d9012607d35 2021-01-13 13:25:43.583 2020-11-22 19:05:28.360 2020-11-22 19:11:03.686
2 2 2 2 2 61002 016038b4-2391-44d7-9391-7d622f537ac5 437d9524-c3b9-4491-adae-6e5d21a4d1cd 437d9524-c3b9-4491-adae-6e5d21a4d1cd b71ffc33-0dab-4c92-bb6e-8e16e2b3d980 576a59c0-fc12-427c-ab02-c1b2b4c6ede1 fcf25ec2-0153-49c1-ad88-43464b1a4a58 Boarding Finished NaN 2020-11-02 13:36:46.512 2020-11-15 03:00:00 2020-11-12 12:51:06.849 2020-11-10 12:23:38.922 2020-11-13 14:20:16.152 NaT NaN NaN NaN NaN NaN Kadıköy Fenerbahçe NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Approved Paid 154.285714 0.0 800.00 NaN 2020-11-20 14:41:09.625 9818.0 9818.0 016038b4-2391-44d7-9391-7d622f537ac5 NaT 2020-11-02 12:42:20.316 2020-11-02 12:52:48.225
3 3 3 3 3 61003 016038b4-2391-44d7-9391-7d622f537ac5 437d9524-c3b9-4491-adae-6e5d21a4d1cd 437d9524-c3b9-4491-adae-6e5d21a4d1cd b71ffc33-0dab-4c92-bb6e-8e16e2b3d980 576a59c0-fc12-427c-ab02-c1b2b4c6ede1 fcf25ec2-0153-49c1-ad88-43464b1a4a58 Boarding Finished NaN 2020-11-02 13:36:46.512 2020-11-16 03:00:00 2020-11-12 12:51:06.849 2020-11-10 12:23:38.922 2020-11-13 14:20:16.152 NaT NaN NaN NaN NaN NaN Kadıköy Fenerbahçe NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Approved Paid 154.285714 0.0 800.00 NaN 2020-11-20 14:41:09.625 9818.0 9818.0 016038b4-2391-44d7-9391-7d622f537ac5 NaT 2020-11-02 12:42:20.316 2020-11-02 12:52:48.225
4 4 4 4 4 61004 016038b4-2391-44d7-9391-7d622f537ac5 437d9524-c3b9-4491-adae-6e5d21a4d1cd 437d9524-c3b9-4491-adae-6e5d21a4d1cd b71ffc33-0dab-4c92-bb6e-8e16e2b3d980 576a59c0-fc12-427c-ab02-c1b2b4c6ede1 fcf25ec2-0153-49c1-ad88-43464b1a4a58 Boarding Finished NaN 2020-11-02 13:36:46.512 2020-11-17 03:00:00 2020-11-12 12:51:06.849 2020-11-10 12:23:38.922 2020-11-13 14:20:16.152 NaT NaN NaN NaN NaN NaN Kadıköy Fenerbahçe NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Approved Paid 154.285714 0.0 800.00 NaN 2020-11-20 14:41:09.625 9818.0 9818.0 016038b4-2391-44d7-9391-7d622f537ac5 NaT 2020-11-02 12:42:20.316 2020-11-02 12:52:48.225
In [ ]:
df.shape
Out[ ]:
(64565, 51)

Missing Values

Detecting missing values is important because missing values can be effect the RFM creating proceses and customer segmentation. Each variable is not necessary to create RFM. The most important columns are ownerid, walkingid, checkintime and amount. They will be used to crate recency, frequency and monetary columns. There is no missing value in those variables.

In [ ]:
#checking the missing values

df.isna().sum()
Out[ ]:
Unnamed: 0_x                     0
Unnamed: 0.1_x                   0
Unnamed: 0.1.1                   0
Unnamed: 0.1.1.1                 0
Unnamed: 0.1.1.1.1               0
ownerid                          0
walkingid                        0
walkid                           0
walkerid                      1121
dogid                            0
paymentid                        0
walkingtype                      0
walkstatus                       0
duration                       275
ordercreatedtime                 0
checkintime                      0
confirmtime                  13429
matchtime                    59753
starttime                     1143
endtime                       1418
cancelledby                  63419
cancelreason                 63421
heat                          1418
walkgroup                    19875
distance                      1367
district                         0
neighborhood                 43809
walkerF_commWithPeople       56791
walkerF_commWithPariahDog    56791
walkerF_commWithStreetCat    56791
walkerF_goodPath             56791
walkerF_walkWithDogAgain     56791
walkerF_note                 63392
ownerF_commWithMe            60087
ownerF_commWithDog           60087
ownerF_timeAccuracy          60087
ownerF_appPerformance        60087
ownerF_note                  64035
paymentstatus                 1852
paymenttype                   1852
amount                           0
discount                      1852
walkerincome                  1852
promocodeid                  59124
finishtime                   64290
Unnamed: 0_y                   358
Unnamed: 0.1_y                 358
id                             358
mgapplytime                  48969
signuptime                     386
firstdogaddedtime              465
dtype: int64
In [ ]:
df.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 64565 entries, 0 to 64564
Data columns (total 51 columns):
 #   Column                     Non-Null Count  Dtype         
---  ------                     --------------  -----         
 0   Unnamed: 0_x               64565 non-null  int64         
 1   Unnamed: 0.1_x             64565 non-null  int64         
 2   Unnamed: 0.1.1             64565 non-null  int64         
 3   Unnamed: 0.1.1.1           64565 non-null  int64         
 4   Unnamed: 0.1.1.1.1         64565 non-null  int64         
 5   ownerid                    64565 non-null  object        
 6   walkingid                  64565 non-null  object        
 7   walkid                     64565 non-null  object        
 8   walkerid                   63444 non-null  object        
 9   dogid                      64565 non-null  object        
 10  paymentid                  64565 non-null  object        
 11  walkingtype                64565 non-null  object        
 12  walkstatus                 64565 non-null  object        
 13  duration                   64290 non-null  float64       
 14  ordercreatedtime           64565 non-null  datetime64[ns]
 15  checkintime                64565 non-null  datetime64[ns]
 16  confirmtime                51136 non-null  datetime64[ns]
 17  matchtime                  4812 non-null   datetime64[ns]
 18  starttime                  63422 non-null  datetime64[ns]
 19  endtime                    63147 non-null  datetime64[ns]
 20  cancelledby                1146 non-null   object        
 21  cancelreason               1144 non-null   object        
 22  heat                       63147 non-null  object        
 23  walkgroup                  44690 non-null  object        
 24  distance                   63198 non-null  float64       
 25  district                   64565 non-null  object        
 26  neighborhood               20756 non-null  object        
 27  walkerF_commWithPeople     7774 non-null   float64       
 28  walkerF_commWithPariahDog  7774 non-null   float64       
 29  walkerF_commWithStreetCat  7774 non-null   float64       
 30  walkerF_goodPath           7774 non-null   float64       
 31  walkerF_walkWithDogAgain   7774 non-null   float64       
 32  walkerF_note               1173 non-null   object        
 33  ownerF_commWithMe          4478 non-null   float64       
 34  ownerF_commWithDog         4478 non-null   float64       
 35  ownerF_timeAccuracy        4478 non-null   float64       
 36  ownerF_appPerformance      4478 non-null   float64       
 37  ownerF_note                530 non-null    object        
 38  paymentstatus              62713 non-null  object        
 39  paymenttype                62713 non-null  object        
 40  amount                     64565 non-null  float64       
 41  discount                   62713 non-null  float64       
 42  walkerincome               62713 non-null  float64       
 43  promocodeid                5441 non-null   object        
 44  finishtime                 275 non-null    datetime64[ns]
 45  Unnamed: 0_y               64207 non-null  float64       
 46  Unnamed: 0.1_y             64207 non-null  float64       
 47  id                         64207 non-null  object        
 48  mgapplytime                15596 non-null  datetime64[ns]
 49  signuptime                 64179 non-null  datetime64[ns]
 50  firstdogaddedtime          64100 non-null  datetime64[ns]
dtypes: datetime64[ns](10), float64(16), int64(5), object(20)
memory usage: 25.6+ MB
In [ ]:
unnamed_cols = [col for col in df.columns if 'Unnamed: ' in col]
print(unnamed_cols)
['Unnamed: 0_x', 'Unnamed: 0.1_x', 'Unnamed: 0.1.1', 'Unnamed: 0.1.1.1', 'Unnamed: 0.1.1.1.1', 'Unnamed: 0_y', 'Unnamed: 0.1_y']
In [ ]:
df = df.drop(unnamed_cols, axis=1)
In [ ]:
df.describe()
Out[ ]:
duration distance walkerF_commWithPeople walkerF_commWithPariahDog walkerF_commWithStreetCat walkerF_goodPath walkerF_walkWithDogAgain ownerF_commWithMe ownerF_commWithDog ownerF_timeAccuracy ownerF_appPerformance amount discount walkerincome
count 64290.0 63198.000000 7774.000000 7774.000000 7774.000000 7774.000000 7774.000000 4478.000000 4478.000000 4478.000000 4478.000000 64565.000000 62713.000000 62713.000000
mean 45.0 5.418176 0.978647 0.852843 0.845897 0.953692 0.974273 0.991961 0.989058 0.987271 0.980348 26.251791 14.773813 17.658943
std 0.0 166.602915 0.144568 0.354285 0.361071 0.210165 0.158329 0.089311 0.104044 0.112115 0.138816 6.793103 101.021468 21.483709
min 45.0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000
25% 45.0 0.864714 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 20.000000 0.000000 15.000000
50% 45.0 1.744401 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 25.000000 0.000000 15.250000
75% 45.0 2.599516 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 29.900000 0.000000 17.100000
max 45.0 10239.525872 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 168.750000 1120.000000 1050.000000

Exploratory Data Analysis

In this part, data visualization will be carried out to understand datasets deeply. According to insights extracted from graphs, necessary corrections can be made. If there is a correction or change, it will be explained below the related graph or code.

In [ ]:
owner_first10 = df["ownerid"].value_counts(sort= True).head(10)
owner_first10 = pd.DataFrame(owner_first10)
owner_first10 = owner_first10.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "index", y= "ownerid", data= owner_first10, color='#253B8E')
plt.xlabel("\nowner")
plt.ylabel("\nNumber of Walks")
plt.title("Top 10 Owners\n", fontsize = 15)
plt.xticks(rotation=90)
plt.show()

Top ten owners according to number of walks represents frequency in other word the f column and the graph above shows that there is a customer that has many transaction and there is a significant difference between first customer and second customer. The other ones are similar to each other.

In [ ]:
amount_owner = df.groupby("ownerid")["amount"].sum().sort_values(ascending=False)
amount_owner20 = amount_owner.head(20)

amount_owner20 = pd.DataFrame(amount_owner20)
amount_owner20 = amount_owner20.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "ownerid", y= "amount", data= amount_owner20, color='#253B8E')
plt.xlabel("\nOwner")
plt.ylabel("\nAmount")
plt.title("Top 10 owners\n", fontsize = 15)
plt.xticks(rotation=90)
plt.show()

This graph is similar to previous graph, the difference is this graph repsesent monetary it means it is based on amount. there is also another similarity that a customer spent money distictly. Mean and standard deviation will be investigated below as a next step of the effect of this difference.

In [ ]:
amount_owner = df.groupby("ownerid")["amount"].sum().sort_values()
amount_owner20 = amount_owner.head(20)

amount_owner20 = pd.DataFrame(amount_owner20)
amount_owner20 = amount_owner20.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "ownerid", y= "amount", data= amount_owner20, color='#253B8E')
plt.xlabel("\nOwner")
plt.ylabel("\nAmount")
plt.title("Last 10 owners\n", fontsize = 15)
plt.xticks(rotation=90)
plt.show()
In [ ]:
plt.figure(figsize=(8, 6))
sns.distplot(df["amount"])
plt.show()
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)

The amount distribution is not like normal distribution.

In [ ]:
gby_ownerid = df.groupby("ownerid")["amount"].sum().sort_values(ascending=False)
gby_ownerid
Out[ ]:
ownerid
b6ed3bef-0f78-4749-98e9-a6f1cc6ae177    31350.840000
eea120c4-6c99-4c83-8251-1ea3d1e89dd3    23992.080000
f82cb910-9213-49f4-98ec-ce3347328c9a    21524.990000
ea27cea2-0876-41bc-b8e8-5af5402b34a7    20674.215037
7ebb85b5-8d08-40b5-a334-0d32fd9b7be2    19432.000000
                                            ...     
e8b91196-9134-47b0-8785-abad1817f024       25.000000
fde60302-0033-4e69-ac93-80cc1fd2fda4       23.920000
a4966af8-31c3-4b80-92b5-eee0613a9241       23.920000
605d3444-bb0d-4711-965b-a1f152ff4680       20.000000
105c946a-64b5-4e6e-adcd-c17543df6f48       19.790000
Name: amount, Length: 1558, dtype: float64
In [ ]:
gby_ownerid.describe()
Out[ ]:
count     1558.000000
mean      1087.899177
std       2482.511568
min         19.790000
25%         59.900000
50%        274.500000
75%        934.370000
max      31350.840000
Name: amount, dtype: float64

The standard deviation of the amount is so high when it compares with mean. The most spending customer affects the standard deviation, and this customer will not be taken into account because it is an outlier.

In [ ]:
df = df[df["ownerid"] != "b6ed3bef-0f78-4749-98e9-a6f1cc6ae177"]
#df = df[df["ownerid"] != "8988f208-b453-4302-9d72-420d36ed580f"]
#df = df[df["ownerid"] != "af0e4d22-7d04-4f84-88c5-4a6c1c15fc07"]
In [ ]:
df["amount"].sort_values(ascending=True).head(20)
Out[ ]:
3827      1.00
35747     9.00
62643    10.00
51537    10.00
45894    10.00
36012    10.00
60159    16.00
16283    16.48
16284    16.48
16285    16.48
16287    16.48
16282    16.48
16288    16.48
16289    16.48
16290    16.48
16291    16.48
16286    16.48
16281    16.48
16279    16.48
16278    16.48
Name: amount, dtype: float64

The numbers less than 16.48 can be misleading amounts and they affect the mean and they will be replaced with median of the amount.

In [ ]:
unknown_amount_list = [0, 1, 9, 10, 16]
                       
df['amount'] = df['amount'].replace(unknown_amount_list, df.amount.median())

df["amount"].sort_values(ascending=True).head(20)
Out[ ]:
16291    16.48
16289    16.48
16278    16.48
16279    16.48
16280    16.48
16281    16.48
16282    16.48
16283    16.48
16288    16.48
16284    16.48
16285    16.48
16286    16.48
16287    16.48
16290    16.48
54626    17.50
54622    17.50
2502     17.50
2505     17.50
2904     17.75
2931     17.75
Name: amount, dtype: float64
In [ ]:
gby_ownerid2 = df.groupby("ownerid")["amount"].sum().sort_values(ascending=False)
gby_ownerid2
Out[ ]:
ownerid
eea120c4-6c99-4c83-8251-1ea3d1e89dd3    23992.080000
f82cb910-9213-49f4-98ec-ce3347328c9a    21524.990000
ea27cea2-0876-41bc-b8e8-5af5402b34a7    20674.215037
7ebb85b5-8d08-40b5-a334-0d32fd9b7be2    19432.000000
988ac167-f1d5-4d6f-b961-94c5b5de3e20    19238.780000
                                            ...     
e8b91196-9134-47b0-8785-abad1817f024       25.000000
fde60302-0033-4e69-ac93-80cc1fd2fda4       23.920000
a4966af8-31c3-4b80-92b5-eee0613a9241       23.920000
605d3444-bb0d-4711-965b-a1f152ff4680       20.000000
105c946a-64b5-4e6e-adcd-c17543df6f48       19.790000
Name: amount, Length: 1557, dtype: float64
In [ ]:
gby_ownerid2.describe()
Out[ ]:
count     1557.000000
mean      1068.534103
std       2361.804021
min         19.790000
25%         59.900000
50%        274.500000
75%        930.950000
max      23992.080000
Name: amount, dtype: float64

As a result of changes, the standart deviation was reduced.

In [ ]:
walker_first10 = df["walkerid"].value_counts(sort= True).head(10)
walker_first10 = pd.DataFrame(walker_first10)
walker_first10 = walker_first10.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "index", y= "walkerid", data= walker_first10, color='#253B8E')
plt.xlabel("\nWalker")
plt.ylabel("\nNumber of Walks")
plt.title("Top 10 Walkers\n", fontsize = 15)
plt.xticks(rotation=90)
plt.show()
In [ ]:
amount_walker = df.groupby("walkerid")["amount"].sum().sort_values(ascending=False)
amount_walker20 = amount_walker.head(20)

amount_walker20 = pd.DataFrame(amount_walker20)
amount_walker20 = amount_walker20.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "walkerid", y= "amount", data= amount_walker20, color='#253B8E')
plt.xlabel("\nWalker")
plt.ylabel("\nAmount")
plt.title("Top 10 Walkers\n", fontsize = 15)
plt.xticks(rotation=90)
plt.show()

A similar investigation was done for the top ten walkers, but there is no abnormal case.

In [ ]:
df.groupby("checkintime")["amount"].count().cumsum().plot()
plt.xlabel("\nCheck-in Time")
plt.ylabel("\nAmount")
plt.title("Cumulative Monetary\n", fontsize = 15)
Out[ ]:
Text(0.5, 1.0, 'Cumulative Monetary\n')
In [ ]:
def format_spines(ax, right_border=True):
    """docstring for format_spines:
    this function sets up borders from an axis and personalize colors
    input:
        ax: figure axis
        right_border: flag to determine if the right border will be visible or not"""
    
    # Setting up colors
    ax.spines['bottom'].set_color('#CCCCCC')
    ax.spines['left'].set_color('#CCCCCC')
    ax.spines['top'].set_color('#FFFFFF')
    if right_border:
        ax.spines['right'].set_color('#CCCCCC')
    else:
        ax.spines['right'].set_color('#FFFFFF')
    ax.patch.set_facecolor('#FFFFFF')

def count_plot(feature, df, colors='Blues_d', hue=False):
    """docstring for count_plot:
    this function plots data setting up frequency and percentage. This algo sets up borders
    and personalization
    input:
        feature: feature to be plotted
        df: dataframe
        colors = color palette (default=Blues_d)
        hue = second feature analysis (default=False)"""
    
    # Preparing variables
    ncount = len(df)
    fig, ax = plt.subplots()
    if hue != False:
        ax = sns.countplot(x=feature, data=df, palette=colors, hue=hue)
    else:
        ax = sns.countplot(x=feature, data=df, palette=colors)

    # Make twin axis
    ax2=ax.twinx()

    # Switch so count axis is on right, frequency on left
    ax2.yaxis.tick_left()
    ax.yaxis.tick_right()

    # Also switch the labels over
    ax.yaxis.set_label_position('right')
    ax2.yaxis.set_label_position('left')

    ax2.set_ylabel('Frequency [%]')

    # Setting borders
    format_spines(ax)
    format_spines(ax2)

    # Setting percentage
    for p in ax.patches:
        x=p.get_bbox().get_points()[:,0]
        y=p.get_bbox().get_points()[1,1]
        ax.annotate('{:.1f}%'.format(100.*y/ncount), (x.mean(), y), 
                ha='center', va='bottom') # set the alignment of the text
    if not hue:
        ax.set_title(df[feature].describe().name + ' Analysis', size=13, pad=15)
    else:
        ax.set_title(df[feature].describe().name + ' Analysis by ' + hue, size=13, pad=15)   
    plt.show()
In [ ]:
plt.figure(figsize=(10, 8))
count_plot(feature="walkingtype", df=df)
<Figure size 720x576 with 0 Axes>

According to walking type analysis, almost half of all transactions are customize walking which generated by customers based on their schedules or choises. Planned walking is second and it means 25% walks were scheduled before the walking, but this category includes only single walks.

In [ ]:
count_plot(feature="walkgroup", df=df)

Walk group is related to dog types, and dog types are defined according to dogs' weight. There is no significant difference between these three categories.

In [ ]:
perc_district = df["district"].value_counts()/len(df["district"])*100
perc_district20 = perc_district.head(20)

perc_district20 = pd.DataFrame(perc_district20)
perc_district20 = perc_district20.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "index", y= "district", data= perc_district20)
plt.xlabel("\ndistrict")
plt.ylabel("\n%")
plt.title("Top 10 districts\n", fontsize = 15)
plt.xticks(rotation=45)
plt.show()

In the top ten districts, Kadıköy is the number one, and there is a significant difference. The district variable can be used as a supporting variable of rfm in the following step to separate customer groups. On the other hand, another customer segmentation can be done for Kadiköy particularly.

In [ ]:
perc_paymenttype = df["paymenttype"].value_counts()/len(df["paymenttype"])*100

perc_paymenttype = pd.DataFrame(perc_paymenttype)
perc_paymenttype = perc_paymenttype.reset_index()

sns.set(rc={'figure.figsize':(11, 7)})
sns.barplot(x= "index", y= "paymenttype", data= perc_paymenttype)
plt.xlabel("\npaymenttype")
plt.ylabel("\n%")
plt.title("paymenttype\n", fontsize = 15)
plt.xticks(rotation=20)
plt.show()

Paymenttype variable consists of almost paid walkings.

In [ ]:
perc_paymentstatus = df[df["paymentstatus"] == "Free"]
nof_free = len(perc_paymentstatus)

perc_paymentstatus = df[df["paymentstatus"] == "Approved"]
nof_paid= len(perc_paymentstatus)
print('Free: {} and Approved:"{}"'.format(nof_free, nof_paid))
Free: 2089 and Approved:"59083"

RFM

In [ ]:
def owner_selection(id):
  result= data_rfm.loc[data_rfm["id"]]
  return result
In [ ]:
def last_X_days(df, X, C, owner=None):

  df= df[df["walkstatus"] == "Finished"]
  df['checkin_revized'] = np.where(df['checkintime'] >= df['ordercreatedtime'], df['checkintime'], df['ordercreatedtime'])
  df['checkin_revized'] = df['checkin_revized'].dt.normalize()


  import datetime
  start_date = pd.to_datetime('today')
  end_date = start_date - datetime.timedelta(days=X)
  snapshot_date = start_date + datetime.timedelta(days=1)
  mask = (df['checkin_revized'] > end_date) & (df['checkin_revized'] <= start_date)
  df_lastX = df.loc[mask]



  data_rfm =  df_lastX.groupby(["ownerid"]).agg({"checkin_revized": lambda x: (snapshot_date - x.max()).days,
                                         "checkintime": "count",
                                         "amount": "sum"})
  data_rfm.rename(columns={"checkintime": "Frequency",
                         "checkin_revized": "Recency",
                         "amount": "MonetaryValue"}, inplace=True)
  
  data_rfm_tenure = df.groupby(["ownerid"]).agg({"checkin_revized": lambda x: (snapshot_date - x.min()).days})
  
  data_rfm = pd.merge(data_rfm, data_rfm_tenure, left_on="ownerid", right_on="ownerid", how='left')

  data_rfm.rename(columns={"checkin_revized": "Tenure"}, inplace=True)

  data_rfm = data_rfm.reset_index(drop=False).sort_values("Recency")

  if owner == None:
    
    amount_owner = data_rfm.groupby("ownerid")[C].sum().sort_values(ascending=False)
    amount_owner20 = amount_owner.head(20)

    amount_owner20 = pd.DataFrame(amount_owner20)
    amount_owner20 = amount_owner20.reset_index()

    sns.set(rc={'figure.figsize':(11, 7)})
    sns.barplot(x= "ownerid", y= C, data= amount_owner20, color='#253B8E')
    plt.xlabel("\nowner")
    plt.ylabel(C)
    plt.title("Top 10 owners\n", fontsize = 15)
    plt.xticks(rotation=90)
    
    result = data_rfm, plt.show()

  else:
    data_rfm_ownerid = data_rfm[data_rfm["ownerid"].isin(owner)]

    amount_owner = data_rfm_ownerid.groupby("ownerid")[C].sum().sort_values(ascending=False)
    amount_owner20 = amount_owner.head(10)

    amount_owner20 = pd.DataFrame(amount_owner20)
    amount_owner20 = amount_owner20.reset_index()

    sns.set(rc={'figure.figsize':(11, 7)})
    sns.barplot(x= "ownerid", y= C, data= amount_owner20, color='#253B8E')
    plt.xlabel("\nowner")
    plt.ylabel(C)
    plt.title("Top 10 owners\n", fontsize = 15)
    plt.xticks(rotation=90)
    

    result = print(data_rfm_ownerid), plt.show()
  
  return result
In [ ]:
last_X_days(df, 150, "Frequency")
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:4: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  after removing the cwd from sys.path.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:5: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  """
Out[ ]:
(                                  ownerid  Recency  ...  MonetaryValue  Tenure
 109  3cf87466-e9b5-4487-ae7f-84661e337d78      123  ...     296.410000     308
 245  8b90ea2d-ca81-4844-b72a-4056b1b0fafb      124  ...    1078.000000     668
 288  a2f21d20-9522-45fe-a714-370ef1bf70c9      124  ...     583.800000     252
 67   2a97bb57-c1a8-4056-91c6-2868747d2857      125  ...     125.680000     420
 184  660bfc73-8637-4d3a-b165-fd476222463f      125  ...     383.660000     786
 ..                                    ...      ...  ...            ...     ...
 45   1ef43ab5-4c30-4388-bf84-433c53368d42      150  ...      64.800000     158
 52   228f9c9f-8704-4dd3-b999-28284ce95129      150  ...     119.866667     613
 425  fa77f8cd-170d-4631-be20-fc498de58edf      150  ...      55.260000     339
 289  a308896e-4b61-40a1-a1a8-0edfa7db02c4      150  ...      34.900000     322
 413  f422868d-1781-4765-9b87-6c8812ba9b01      150  ...      40.000000     309
 
 [429 rows x 5 columns], None)

120 120 periyotlar şeklinde geriye doğru giderek bir grafik oluşturulacak ve müşterinin durumu takip edilecek

In [ ]:
def last_X_days_slider(df, P, R, F, owner=None):

  plt.figure(figsize=(14,10))
  plt.xlabel("\nDate")
  plt.ylabel(F)
  plt.title(owner, fontsize = 15)
  freqs = []
  start_date_list = []

  for i in range(0,R):

    df= df[df["walkstatus"] == "Finished"]
    df['checkin_revized'] = np.where(df['checkintime'] >= df['ordercreatedtime'], df['checkintime'], df['ordercreatedtime'])
    df['checkin_revized'] = df['checkin_revized'].dt.normalize()
    import datetime
    start_date = pd.to_datetime('today') - datetime.timedelta(days=i)
    end_date = start_date - datetime.timedelta(days=P)
    snapshot_date = start_date + datetime.timedelta(days=1)
    mask = (df['checkin_revized'] > end_date) & (df['checkin_revized'] <= start_date)
    df_lastX = df.loc[mask]
    data_rfm =  df_lastX.groupby(["ownerid"]).agg({"checkin_revized": lambda x: (snapshot_date - x.max()).days,
                                          "checkintime": "count",
                                          "amount": "sum"})
    data_rfm.rename(columns={"checkintime": "Frequency",
                          "checkin_revized": "Recency",
                          "amount": "MonetaryValue"}, inplace=True)
    data_rfm_tenure = df.groupby(["ownerid"]).agg({"checkin_revized": lambda x: (snapshot_date - x.min()).days})
    data_rfm = pd.merge(data_rfm, data_rfm_tenure, left_on="ownerid", right_on="ownerid", how='left')
    data_rfm.rename(columns={"checkin_revized": "Tenure"}, inplace=True)
    data_rfm = data_rfm.reset_index(drop=False).sort_values("Recency")
    data_rfm_ownerid = data_rfm[data_rfm["ownerid"].isin(owner)]
    data_rfm_ownerid = data_rfm_ownerid.reset_index(drop=True)
    freq = (data_rfm_ownerid.iloc[:,F]).values 
    if not freq:
      freqs.append(0)
    else:
      freqs.append(freq[0])
    
    start_date_list.append(start_date)
    freqs_plot = sns.lineplot(x=start_date_list, y=freqs)
     
  return freqs, freqs_plot
In [ ]:
last_X_days_slider(df, 30, 300, 2, ["3cf87466-e9b5-4487-ae7f-84661e337d78"])
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:13: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  del sys.path[0]
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:14: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:34: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
Out[ ]:
([0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  2,
  2,
  2,
  3,
  4,
  5,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  4,
  4,
  4,
  4,
  4,
  4,
  3,
  4,
  5,
  5,
  6,
  7,
  7,
  7,
  7,
  7,
  7,
  8,
  9,
  10,
  10,
  10,
  11,
  12,
  12,
  12,
  12,
  12,
  12,
  12,
  12,
  12,
  12,
  11,
  10,
  9,
  9,
  8,
  7,
  7,
  6,
  5,
  5,
  6,
  7,
  8,
  8,
  7,
  6,
  5,
  6,
  7,
  6,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  6,
  7,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  7,
  7,
  6,
  6,
  6,
  6,
  6,
  5,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  3,
  2,
  1,
  1,
  1,
  1,
  1,
  2,
  3,
  4,
  3,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  27,
  27,
  27,
  27,
  27,
  27,
  27,
  27,
  26,
  25,
  24,
  23,
  22,
  21,
  20,
  20,
  21,
  21,
  20,
  20,
  20,
  19,
  19,
  19,
  19,
  18,
  17,
  16,
  15,
  14,
  13,
  12,
  11,
  11,
  11,
  10,
  9,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  7],
 <matplotlib.axes._subplots.AxesSubplot at 0x7fe0e58b9e10>)

Two walk statuses are finished and canceled. Finished walks are used to calculate RFM because canceled walks are not proper transactions.

In [ ]:
df= df[df["walkstatus"] == "Finished"]

Preprocessing

There are some problematic rows in checkintime and ordercreatedtime such as check in time is not recent than order created time. Order creation is previous step of check in. Therefore, a new column is generated and latest date is selected from them.

In [ ]:
df['checkin_revized'] = np.where(df['checkintime'] >= df['ordercreatedtime'], df['checkintime'], df['ordercreatedtime'])
In [ ]:
df['checkin_revized'].sort_values(ascending=False)
Out[ ]:
76      2021-04-19 03:00:00
77      2021-04-19 03:00:00
34305   2021-04-18 07:30:00
128     2021-04-18 03:00:00
32487   2021-04-17 15:00:00
                ...        
9642    2019-01-03 16:00:00
15772   2019-01-03 07:00:00
7975    2019-01-03 06:00:00
7972    2019-01-03 05:00:00
9647    2019-01-03 05:00:00
Name: checkin_revized, Length: 61880, dtype: datetime64[ns]
In [ ]:
#df['checkin_revized'] = df["checkintime"]
In [ ]:
df['checkin_revized'] = df['checkin_revized'].dt.normalize()
In [ ]:
df.checkin_revized.sort_values(ascending=False).head(10)
Out[ ]:
76      2021-04-19
77      2021-04-19
34305   2021-04-18
128     2021-04-18
54089   2021-04-17
127     2021-04-17
6479    2021-04-17
32487   2021-04-17
32486   2021-04-17
53989   2021-04-17
Name: checkin_revized, dtype: datetime64[ns]

Generating RFM and Tenure Columns

RFM and tenure columns are generated using the part from the last year.

In [ ]:
print("Min:{}; Max:{}".format(min(df.checkin_revized), max(df.checkin_revized)))
Min:2019-01-03 00:00:00; Max:2021-04-19 00:00:00
In [ ]:
'''import datetime

start_date = pd.to_datetime('today')
start_date'''
Out[ ]:
"import datetime\n\nstart_date = pd.to_datetime('today')\nstart_date"
In [ ]:
import datetime

start_date = max(df.checkin_revized)
start_date
Out[ ]:
Timestamp('2021-04-19 00:00:00')
In [ ]:
end_date = start_date - datetime.timedelta(days=365)
end_date
Out[ ]:
Timestamp('2020-04-19 00:00:00')
In [ ]:
mask = (df['checkin_revized'] > end_date) & (df['checkin_revized'] <= start_date)
In [ ]:
df_lastyear = df.loc[mask]
In [ ]:
snapshot_date = start_date + datetime.timedelta(days=1)
snapshot_date
Out[ ]:
Timestamp('2021-04-20 00:00:00')
In [ ]:
datamart =  df_lastyear.groupby(["ownerid"]).agg({"checkin_revized": lambda x: (snapshot_date - x.max()).days,
                                         "checkintime": "count",
                                         "amount": "sum"})
In [ ]:
datamart.head()
Out[ ]:
checkin_revized checkintime amount
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 212 1 29.90
008fabab-f868-4019-8b50-4022025b51b2 226 27 807.40
00d2941f-7e9f-4422-a662-2d9012607d35 66 2 179.80
012069f5-41a9-472c-ad99-1d72ceca4966 316 6 169.90
0122b307-340f-41e4-88ac-bdd9e14eb26d 39 5 146.51
In [ ]:
datamart.rename(columns={"checkintime": "Frequency",
                         "checkin_revized": "Recency",
                         "amount": "MonetaryValue"}, inplace=True)
In [ ]:
datamart_tenure = df.groupby(["ownerid"]).agg({"checkin_revized": lambda x: (snapshot_date - x.min()).days})
In [ ]:
datamart = pd.merge(datamart, datamart_tenure, left_on="ownerid", right_on="ownerid", how='left')
In [ ]:
datamart.head()
Out[ ]:
Recency Frequency MonetaryValue checkin_revized
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 212 1 29.90 212
008fabab-f868-4019-8b50-4022025b51b2 226 27 807.40 415
00d2941f-7e9f-4422-a662-2d9012607d35 66 2 179.80 67
012069f5-41a9-472c-ad99-1d72ceca4966 316 6 169.90 347
0122b307-340f-41e4-88ac-bdd9e14eb26d 39 5 146.51 415
In [ ]:
datamart.rename(columns={"checkin_revized": "Tenure"}, inplace=True)
In [ ]:
datamart.head()
Out[ ]:
Recency Frequency MonetaryValue Tenure
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 212 1 29.90 212
008fabab-f868-4019-8b50-4022025b51b2 226 27 807.40 415
00d2941f-7e9f-4422-a662-2d9012607d35 66 2 179.80 67
012069f5-41a9-472c-ad99-1d72ceca4966 316 6 169.90 347
0122b307-340f-41e4-88ac-bdd9e14eb26d 39 5 146.51 415
In [ ]:

In [ ]:
datamart.describe()
Out[ ]:
Recency Frequency MonetaryValue Tenure
count 1085.000000 1085.000000 1085.000000 1085.000000
mean 92.800922 36.971429 999.545488 253.930876
std 92.329583 74.839867 1920.672790 191.318955
min 1.000000 1.000000 19.790000 4.000000
25% 12.000000 3.000000 80.730000 117.000000
50% 53.000000 9.000000 296.310000 204.000000
75% 164.000000 31.000000 900.000000 407.000000
max 364.000000 581.000000 15907.370000 838.000000

Frequency and monetary are highly correlated, so frequency is excluded from RFM analysis. The analyses are completed using Recency, Monetary and Tenure features.

In [ ]:
heatmap_all = sns.heatmap(datamart.corr(), vmin=-1, vmax=1, annot=True)
In [ ]:
datamart = datamart.drop("Frequency", axis=1)

K-means

Normalization

Recency, Monetary and Tenure features are tried to normalise using four different transformation methods: square root, reciprocal, log, and boxcox one by one. All process failed, but the nearest values to normal distribution are obtained thanks to boxcox method.

In [ ]:
sns.distplot(datamart["Recency"])
plt.show()
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
In [ ]:
sns.distplot(datamart["MonetaryValue"])
plt.show()
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
In [ ]:
sns.distplot(datamart["Tenure"])
plt.show()
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
In [ ]:
from scipy import stats

shapiro_Recency= stats.shapiro(datamart.Recency)

shapiro_MonetaryValue= stats.shapiro(datamart.MonetaryValue)

shapiro_Tenure= stats.shapiro(datamart.Tenure)

print("Shapiro Score of Recency: {}".format(shapiro_Recency))
print("Shapiro Score of MonetaryValue: {}".format(shapiro_MonetaryValue))
print("Shapiro Score of Tenure: {}".format(shapiro_Tenure))
Shapiro Score of Recency: (0.8588888645172119, 4.293482772028118e-30)
Shapiro Score of MonetaryValue: (0.5277084708213806, 0.0)
Shapiro Score of Tenure: (0.9123618602752686, 1.5956375318528849e-24)
In [ ]:
from scipy.stats import normaltest
k2, p = normaltest(datamart.Tenure)
print(p)
4.262013997189939e-28
In [ ]:
datamart_log = np.log(datamart)

plt.subplot(3,1,1) ; sns.distplot(datamart_log["Recency"])

plt.subplot(3,1,2) ; sns.distplot(datamart_log["MonetaryValue"])

plt.subplot(3,1,3) ; sns.distplot(datamart_log["Tenure"])
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d49909c10>
In [ ]:
from scipy import stats

shapiro_Recency_log= stats.shapiro(datamart_log.Recency)

shapiro_MonetaryValue_log= stats.shapiro(datamart_log.MonetaryValue)

shapiro_Tenure_log= stats.shapiro(datamart_log.Tenure)

print("Shapiro Score of Recency: {}".format(shapiro_Recency_log))
print("Shapiro Score of MonetaryValue: {}".format(shapiro_MonetaryValue_log))
print("Shapiro Score of Tenure: {}".format(shapiro_Tenure_log))
Shapiro Score of Recency: (0.9125019311904907, 1.6620125842410202e-24)
Shapiro Score of MonetaryValue: (0.9618704915046692, 3.085428948145912e-16)
Shapiro Score of Tenure: (0.9217721223831177, 2.768176656381672e-23)
In [ ]:
datamart_sqrt = (datamart)**(0.5)

plt.subplot(3,1,1) ; sns.distplot(datamart_sqrt["Recency"])

plt.subplot(3,1,2) ; sns.distplot(datamart_sqrt["MonetaryValue"])

plt.subplot(3,1,3) ; sns.distplot(datamart_sqrt["Tenure"])
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d490857d0>
In [ ]:
from scipy import stats
print(stats.shapiro(datamart_sqrt["Recency"]))
print(stats.shapiro(datamart_sqrt["MonetaryValue"]))
print(stats.shapiro(datamart_sqrt["Tenure"]))
(0.9138001203536987, 2.4299402764810873e-24)
(0.7990274429321289, 1.2799710030264262e-34)
(0.9814667105674744, 1.5525675189920207e-10)
In [ ]:
datamart_recip = 1/datamart

plt.subplot(3,1,1) ; sns.distplot(datamart_recip["Recency"])

plt.subplot(3,1,2) ; sns.distplot(datamart_recip["MonetaryValue"])

plt.subplot(3,1,3) ; sns.distplot(datamart_recip["Tenure"])
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d49371150>
In [ ]:
from scipy import stats
print(stats.shapiro(datamart_recip["Recency"]))
print(stats.shapiro(datamart_recip["MonetaryValue"]))
print(stats.shapiro(datamart_recip["Tenure"]))
(0.6768391132354736, 3.192998680810528e-41)
(0.720300555229187, 3.764285643940327e-39)
(0.40848493576049805, 0.0)
In [ ]:
datamart_boxcox = datamart.copy()
from scipy.stats import boxcox
for i in datamart_boxcox:
  datamart_boxcox[i], lmbda = boxcox(datamart_boxcox[i], lmbda=None)

plt.subplot(3,1,1) ; sns.distplot(datamart_boxcox["Recency"])

plt.subplot(3,1,2) ; sns.distplot(datamart_boxcox["MonetaryValue"])

plt.subplot(3,1,3) ; sns.distplot(datamart_boxcox["Tenure"])
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
/usr/local/lib/python3.7/dist-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d49ac8050>
In [ ]:
from scipy import stats
print(stats.shapiro(datamart_boxcox["Recency"]))
print(stats.shapiro(datamart_boxcox["MonetaryValue"]))
print(stats.shapiro(datamart_boxcox["Tenure"]))
(0.922887921333313, 3.9489360862517926e-23)
(0.9605565071105957, 1.5409714390861843e-16)
(0.9835509061813354, 1.0048020193664797e-09)

Scaling the Data

Minmax scaler and Robust scaler are used to scale the data, and Minmax scaler gives better results.

In [ ]:
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
scaler.fit(datamart_boxcox)
Out[ ]:
MinMaxScaler(copy=True, feature_range=(0, 1))
In [ ]:
datamart_normalized = scaler.transform(datamart_boxcox)
In [ ]:
datamart_normalized = pd.DataFrame(data=datamart_normalized, index=datamart.index, columns=datamart.columns)
In [ ]:
datamart_normalized.head()
Out[ ]:
Recency MonetaryValue Tenure
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 0.862854 0.074403 0.524724
008fabab-f868-4019-8b50-4022025b51b2 0.878448 0.605044 0.725217
00d2941f-7e9f-4422-a662-2d9012607d35 0.605364 0.376618 0.282985
012069f5-41a9-472c-ad99-1d72ceca4966 0.962934 0.367582 0.666536
0122b307-340f-41e4-88ac-bdd9e14eb26d 0.504527 0.343799 0.725217
In [ ]:
heatmap = sns.heatmap(datamart_normalized.corr(), vmin=-1, vmax=1, annot=True)
In [ ]:
print(datamart_normalized.describe().round(2))
       Recency  MonetaryValue   Tenure
count  1085.00        1085.00  1085.00
mean      0.55           0.44     0.52
std       0.27           0.25     0.22
min       0.00           0.00     0.00
25%       0.31           0.25     0.39
50%       0.56           0.45     0.51
75%       0.80           0.62     0.72
max       1.00           1.00     1.00

Application of K-means

The Elbow Method

Firstly, the elbow method is applied with 10 options which are from 1 to 10. 3 seems like a good option, but the silhouette score graph can be clearer to determine the number of clusters.

In [ ]:
from sklearn.cluster import KMeans
sse = {}
for k in range(1,26):
  kmeans = KMeans(n_clusters=k, n_init=10, random_state=1)
  kmeans.fit(datamart_normalized)
  sse[k] = kmeans.inertia_

plt.title("The Elbow Method")
plt.xlabel("k")
plt.ylabel("SSE")
sns.pointplot(x=list(sse.keys()), y=list(sse.values()))
plt.show()
In [ ]:
def optimal_kmeans(dataset, start=2, end=11):
    '''
    Calculate the optimal number of kmeans
 
    INPUT:
        dataset : dataframe. Dataset for k-means to fit
        start : int. Starting range of kmeans to test
        end : int. Ending range of kmeans to test
    OUTPUT:
        Values and line plot of Silhouette Score.
    '''
 
    # Create empty lists to store values for plotting graphs
    n_clu = []
    km_ss = []
 
    # Create a for loop to find optimal n_clusters
    for n_clusters in range(start, end):
 
        # Create cluster labels
        kmeans = KMeans(n_clusters=n_clusters, n_init=10, random_state=1)
        labels = kmeans.fit_predict(dataset)
 
        # Calcualte model performance
        silhouette_avg = round(silhouette_score(dataset, labels, random_state=1), 3)
 
        # Append score to lists
        km_ss.append(silhouette_avg)
        n_clu.append(n_clusters)
 
        print("No. Clusters: {}, Silhouette Score: {}, Change from Previous Cluster: {}".format(
            n_clusters,
            silhouette_avg,
            (km_ss[n_clusters - start] - km_ss[n_clusters - start - 1]).round(3)))
 
        # Plot graph at the end of loop
        if n_clusters == end - 1:
            plt.figure(figsize=(6.47,3))
 
            plt.title('Silhouette Score')
            sns.pointplot(x=n_clu, y=km_ss)
            plt.tight_layout()
            plt.show()

Silhouette Score

A silhouette score graph is plotted, and it includes the cluster numbers from 2 to 10. There is a peak on 5, and the graph slightly increases on 7, 8 and 10. 5, 7, 8, and 10 are determined as important clusters for this project, and they are check by visualizing on different plots.

In [ ]:
from sklearn.metrics import silhouette_score
In [ ]:
optimal_kmeans(datamart_normalized, start=2, end=26)
No. Clusters: 2, Silhouette Score: 0.361, Change from Previous Cluster: 0.0
No. Clusters: 3, Silhouette Score: 0.375, Change from Previous Cluster: 0.014
No. Clusters: 4, Silhouette Score: 0.356, Change from Previous Cluster: -0.019
No. Clusters: 5, Silhouette Score: 0.339, Change from Previous Cluster: -0.017
No. Clusters: 6, Silhouette Score: 0.33, Change from Previous Cluster: -0.009
No. Clusters: 7, Silhouette Score: 0.342, Change from Previous Cluster: 0.012
No. Clusters: 8, Silhouette Score: 0.347, Change from Previous Cluster: 0.005
No. Clusters: 9, Silhouette Score: 0.344, Change from Previous Cluster: -0.003
No. Clusters: 10, Silhouette Score: 0.347, Change from Previous Cluster: 0.003
No. Clusters: 11, Silhouette Score: 0.35, Change from Previous Cluster: 0.003
No. Clusters: 12, Silhouette Score: 0.343, Change from Previous Cluster: -0.007
No. Clusters: 13, Silhouette Score: 0.337, Change from Previous Cluster: -0.006
No. Clusters: 14, Silhouette Score: 0.342, Change from Previous Cluster: 0.005
No. Clusters: 15, Silhouette Score: 0.349, Change from Previous Cluster: 0.007
No. Clusters: 16, Silhouette Score: 0.337, Change from Previous Cluster: -0.012
No. Clusters: 17, Silhouette Score: 0.326, Change from Previous Cluster: -0.011
No. Clusters: 18, Silhouette Score: 0.328, Change from Previous Cluster: 0.002
No. Clusters: 19, Silhouette Score: 0.335, Change from Previous Cluster: 0.007
No. Clusters: 20, Silhouette Score: 0.324, Change from Previous Cluster: -0.011
No. Clusters: 21, Silhouette Score: 0.318, Change from Previous Cluster: -0.006
No. Clusters: 22, Silhouette Score: 0.325, Change from Previous Cluster: 0.007
No. Clusters: 23, Silhouette Score: 0.32, Change from Previous Cluster: -0.005
No. Clusters: 24, Silhouette Score: 0.324, Change from Previous Cluster: 0.004
No. Clusters: 25, Silhouette Score: 0.324, Change from Previous Cluster: 0.0

Application of PCA to Convert from 3D to 2D

Clustering is carried out with 8 clusters using K-means algorithm as the first trial, and its results are plotted on two dimensions. PCA is used to convert from 3 to 2 dimensions.

In [ ]:
def kmeans_pca(df, n_clusters):
  kmeans = KMeans(n_clusters=n_clusters, n_init=20, random_state=1)
  datamart_k8_stat = kmeans.fit(df)

  labels = kmeans.labels_
  centers= kmeans.cluster_centers_
  clusters= kmeans.predict(df)

  from sklearn.decomposition import PCA
  pca = PCA(n_components=2, random_state=1)
  pca.fit(df)

  datamart_pca = pca.transform(df)

  datamart_pca = pd.DataFrame(datamart_pca, columns=["PCA1", "PCA2"])
  datamart_pca["Clusters"] = clusters

  pca.fit(centers)
  centers_pca = pca.transform(centers)

  colors = ["#FF0B04", "#4374B3","#FF0B04", "#4374B3","#FF0B04", "#4374B3","#FF0B04", "#4374B3","#FF0B04", "#4374B3","#FF0B04", "#4374B3","#FF0B04", "#4374B3","#FF0B04"]
  custompalette = sns.set_palette(sns.color_palette(colors))

  plt.figure(figsize=(14,10))
  sns.scatterplot(datamart_pca["PCA1"], datamart_pca["PCA2"], hue=clusters, s=25, palette="brg")
  sns.scatterplot(centers_pca[:, 0], centers_pca[:, 1], marker="o", s=200, alpha=0.8);

  plt.xlabel("PCA1")
  plt.ylabel("PCA2")

  plt.show()
In [ ]:
kmeans_pca(datamart_normalized, 8)
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
In [ ]:
kmeans = KMeans(n_clusters=8, n_init=20, random_state=1)
datamart_k8_stat = kmeans.fit(datamart_normalized)
In [ ]:
labels = kmeans.labels_
centers= kmeans.cluster_centers_
clusters= kmeans.predict(datamart_normalized)
In [ ]:
centers.shape
Out[ ]:
(8, 3)
In [ ]:
datamart_normalized.shape
Out[ ]:
(1085, 3)
In [ ]:
from sklearn.decomposition import PCA
pca = PCA(n_components=2, random_state=1)
pca.fit(datamart_normalized)
Out[ ]:
PCA(copy=True, iterated_power='auto', n_components=2, random_state=1,
    svd_solver='auto', tol=0.0, whiten=False)
In [ ]:
datamart_pca = pca.transform(datamart_normalized)
datamart_pca.shape
Out[ ]:
(1085, 2)
In [ ]:
datamart_pca = pd.DataFrame(datamart_pca, columns=["PCA1", "PCA2"])
In [ ]:
datamart_pca["Clusters"] = clusters
In [ ]:
datamart_pca
Out[ ]:
PCA1 PCA2 Clusters
0 -0.476122 0.050146 3
1 -0.152452 -0.354050 2
2 -0.079646 0.207030 1
3 -0.368164 -0.230243 2
4 -0.032843 -0.112030 6
... ... ... ...
1080 -0.161168 0.447549 1
1081 -0.102050 0.283977 1
1082 0.004878 0.140373 7
1083 -0.155829 0.168206 1
1084 -0.305617 0.035340 3

1085 rows × 3 columns

In [ ]:
pca.fit(centers)
centers_pca = pca.transform(centers)
centers_pca.shape
Out[ ]:
(8, 2)
In [ ]:
'''datamart_normalized_centers = datamart_normalized
datamart_normalized_centers['cluster'] = clusters

# get centroids
cen_x = [i[0] for i in centers] 
cen_y = [i[1] for i in centers]

## add to datamart_normalized
datamart_normalized_centers['cen_x'] = datamart_normalized_centers.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2]})
datamart_normalized_centers['cen_y'] = datamart_normalized_centers.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2]})'''
Out[ ]:
"datamart_normalized_centers = datamart_normalized\ndatamart_normalized_centers['cluster'] = clusters\n\n# get centroids\ncen_x = [i[0] for i in centers] \ncen_y = [i[1] for i in centers]\n\n## add to datamart_normalized\ndatamart_normalized_centers['cen_x'] = datamart_normalized_centers.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2]})\ndatamart_normalized_centers['cen_y'] = datamart_normalized_centers.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2]})"
In [ ]:
plt.figure(figsize=(14,10))
sns.scatterplot(datamart_pca["PCA1"], datamart_pca["PCA2"], hue=clusters, s=25, palette="brg")
sns.scatterplot(centers_pca[:, 0], centers_pca[:, 1], marker="o", s=200, alpha=0.8);

plt.xlabel("PCA1")
plt.ylabel("PCA2")

plt.show()
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
In [ ]:
'''plt.figure(figsize=(14,10))

plt.scatter(datamart_pca[datamart_pca["Clusters"] == 0].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 0].loc[:, "PCA2"], color="red")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 1].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 1].loc[:, "PCA2"], color="blue")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 2].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 2].loc[:, "PCA2"], color="cyan")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 3].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 3].loc[:, "PCA2"], color="yellow")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 4].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 4].loc[:, "PCA2"], color="green")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 5].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 5].loc[:, "PCA2"], color="black")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 6].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 6].loc[:, "PCA2"], color="white")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 7].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 7].loc[:, "PCA2"], color="purple")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 8].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 8].loc[:, "PCA2"], color="yellow")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 9].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 9].loc[:, "PCA2"], color="green")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 10].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 10].loc[:, "PCA2"], color="red")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 11].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 11].loc[:, "PCA2"], color="blue")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 12].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 12].loc[:, "PCA2"], color="cyan")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 13].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 13].loc[:, "PCA2"], color="yellow")
plt.scatter(datamart_pca[datamart_pca["Clusters"] == 14].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 14].loc[:, "PCA2"], color="green")

plt.scatter(centers_pca[:, 0], centers_pca[:, 1], c='black', marker="x", s=200, alpha=0.8)

plt.xlabel("PCA1")
plt.ylabel("PCA2")

plt.show()'''
Out[ ]:
'plt.figure(figsize=(14,10))\n\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 0].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 0].loc[:, "PCA2"], color="red")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 1].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 1].loc[:, "PCA2"], color="blue")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 2].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 2].loc[:, "PCA2"], color="cyan")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 3].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 3].loc[:, "PCA2"], color="yellow")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 4].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 4].loc[:, "PCA2"], color="green")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 5].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 5].loc[:, "PCA2"], color="black")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 6].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 6].loc[:, "PCA2"], color="white")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 7].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 7].loc[:, "PCA2"], color="purple")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 8].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 8].loc[:, "PCA2"], color="yellow")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 9].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 9].loc[:, "PCA2"], color="green")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 10].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 10].loc[:, "PCA2"], color="red")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 11].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 11].loc[:, "PCA2"], color="blue")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 12].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 12].loc[:, "PCA2"], color="cyan")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 13].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 13].loc[:, "PCA2"], color="yellow")\nplt.scatter(datamart_pca[datamart_pca["Clusters"] == 14].loc[:, "PCA1"], datamart_pca[datamart_pca["Clusters"] == 14].loc[:, "PCA2"], color="green")\n\nplt.scatter(centers_pca[:, 0], centers_pca[:, 1], c=\'black\', marker="x", s=200, alpha=0.8)\n\nplt.xlabel("PCA1")\nplt.ylabel("PCA2")\n\nplt.show()'
In [ ]:
datamart_normalized
Out[ ]:
Recency MonetaryValue Tenure
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 0.862854 0.074403 0.524724
008fabab-f868-4019-8b50-4022025b51b2 0.878448 0.605044 0.725217
00d2941f-7e9f-4422-a662-2d9012607d35 0.605364 0.376618 0.282985
012069f5-41a9-472c-ad99-1d72ceca4966 0.962934 0.367582 0.666536
0122b307-340f-41e4-88ac-bdd9e14eb26d 0.504527 0.343799 0.725217
... ... ... ...
feeeefc8-935d-4d87-9009-f819220f842e 0.484849 0.101795 0.187845
ff395835-2462-47e5-a202-e8d2693d750b 0.562253 0.289034 0.254242
ffb5f434-54e6-4f82-837a-b0ef8b878b43 0.551061 0.445724 0.349086
ffcc0f44-ecd8-4438-8f27-77c4b35ed37d 0.659504 0.324317 0.334919
fffd01ad-8bbb-41fc-a5b6-8ac70cb01554 0.763946 0.221409 0.505854

1085 rows × 3 columns

Pair Plots

Different pairs are plotted to understand the differences of clusters such as tenure with recency or recency with monetary.

In [ ]:
datamart_normalized_multiple = datamart_normalized.copy()
In [ ]:
# k means
kmeans = KMeans(n_clusters=8, random_state=0)
datamart_normalized_multiple['cluster'] = kmeans.fit_predict(datamart_normalized[['Recency', 'MonetaryValue']])

# get centroids
centroids = kmeans.cluster_centers_
cen_x = [i[0] for i in centroids] 
cen_y = [i[1] for i in centroids]

## add to datamart_normalized_multiple
datamart_normalized_multiple['cen_x'] = datamart_normalized_multiple.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2], 3:cen_x[3], 4:cen_x[4], 5:cen_x[5], 6:cen_x[6],
                                                                                  7:cen_x[7]})

datamart_normalized_multiple['cen_y'] = datamart_normalized_multiple.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2], 3:cen_x[3], 4:cen_x[4], 5:cen_x[5], 6:cen_x[6],
                                                                                  7:cen_y[7]})

# define and map colors
colors = ['#DF2020', '#00756F', '#005DFF', '#060000', '#FF33FF', '#2EFF00', '#E8FF00', "#000000", "#FF00FF", "#000000", "#FFA07A", "#F08080", "#5F1E1E", "#FF9E00", "#5C395C"]

datamart_normalized_multiple['c'] = datamart_normalized_multiple.cluster.map({0:colors[0], 1:colors[1], 2:colors[2], 3:colors[3], 4:colors[4], 5:colors[5], 6:colors[6],
                                                                              7:colors[7]})

#####PLOT#####
from matplotlib.lines import Line2D
fig, ax = plt.subplots(1, figsize=(14,14))
# plot data
plt.scatter(datamart_normalized_multiple.Recency, datamart_normalized_multiple.MonetaryValue, c=datamart_normalized_multiple.c, alpha = 0.6, s=10)

plt.scatter(cen_x, cen_y, marker='^', c="black", s=100, alpha=0.5)
# create a list of legend elemntes
## markers / records
legend_elements = [Line2D([0], [0], marker='o', color='w', label='Cluster {}'.format(i+1), 
               markerfacecolor=mcolor, markersize=5) for i, mcolor in enumerate(colors)]
# plot legend
plt.legend(handles=legend_elements, loc='upper right')
# title and labels
plt.title('\nRecency - MonetaryValue\n', loc='left', fontsize=22)
plt.xlabel('Recency')
plt.ylabel('MonetaryValue')
Out[ ]:
Text(0, 0.5, 'MonetaryValue')
In [ ]:
# k means
kmeans = KMeans(n_clusters=8, random_state=0)
datamart_normalized_multiple['cluster'] = kmeans.fit_predict(datamart_normalized[['Tenure', 'MonetaryValue']])

# get centroids
centroids = kmeans.cluster_centers_
cen_x = [i[0] for i in centroids] 
cen_y = [i[1] for i in centroids]

## add to datamart_normalized_multiple
datamart_normalized_multiple['cen_x'] = datamart_normalized_multiple.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2], 3:cen_x[3], 4:cen_x[4], 5:cen_x[5], 6:cen_x[6],
                                                                                  7:cen_x[7]})

datamart_normalized_multiple['cen_y'] = datamart_normalized_multiple.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2], 3:cen_x[3], 4:cen_x[4], 5:cen_x[5], 6:cen_x[6],
                                                                                  7:cen_y[7]})

# define and map colors
colors = ['#DF2020', '#00756F', '#005DFF', '#060000', '#FF33FF', '#2EFF00', '#E8FF00', "#000000", "#FF00FF", "#000000", "#FFA07A", "#F08080", "#5F1E1E", "#FF9E00", "#5C395C"]

datamart_normalized_multiple['c'] = datamart_normalized_multiple.cluster.map({0:colors[0], 1:colors[1], 2:colors[2], 3:colors[3], 4:colors[4], 5:colors[5], 6:colors[6],
                                                                              7:colors[7]})

#####PLOT#####
from matplotlib.lines import Line2D
fig, ax = plt.subplots(1, figsize=(14,14))
# plot data
plt.scatter(datamart_normalized_multiple.Tenure, datamart_normalized_multiple.MonetaryValue, c=datamart_normalized_multiple.c, alpha = 0.6, s=10)

plt.scatter(cen_x, cen_y, marker='^', c="black", s=70, alpha=0.5)
# create a list of legend elemntes
## markers / records
legend_elements = [Line2D([0], [0], marker='o', color='w', label='Cluster {}'.format(i+1), 
               markerfacecolor=mcolor, markersize=5) for i, mcolor in enumerate(colors)]
# plot legend
plt.legend(handles=legend_elements, loc='upper right')
# title and labels
plt.title('\nTenure - MonetaryValue\n', loc='left', fontsize=22)
plt.xlabel('Tenure')
plt.ylabel('MonetaryValue')
Out[ ]:
Text(0, 0.5, 'MonetaryValue')
In [ ]:
# k means
kmeans = KMeans(n_clusters=8, random_state=0)
datamart_normalized_multiple['cluster'] = kmeans.fit_predict(datamart_normalized[['Tenure', 'Recency']])

# get centroids
centroids = kmeans.cluster_centers_
cen_x = [i[0] for i in centroids] 
cen_y = [i[1] for i in centroids]

## add to datamart_normalized_multiple
datamart_normalized_multiple['cen_x'] = datamart_normalized_multiple.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2], 3:cen_x[3], 4:cen_x[4], 5:cen_x[5], 6:cen_x[6],
                                                                                  7:cen_x[7]})

datamart_normalized_multiple['cen_y'] = datamart_normalized_multiple.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2], 3:cen_x[3], 4:cen_x[4], 5:cen_x[5], 6:cen_x[6],
                                                                                  7:cen_y[7]})

# define and map colors
colors = ['#DF2020', '#00756F', '#005DFF', '#060000', '#FF33FF', '#2EFF00', '#E8FF00', "#000000", "#FF00FF", "#000000", "#FFA07A", "#F08080", "#5F1E1E", "#FF9E00", "#5C395C"]

datamart_normalized_multiple['c'] = datamart_normalized_multiple.cluster.map({0:colors[0], 1:colors[1], 2:colors[2], 3:colors[3], 4:colors[4], 5:colors[5], 6:colors[6],
                                                                              7:colors[7]})

#####PLOT#####
from matplotlib.lines import Line2D
fig, ax = plt.subplots(1, figsize=(14,14))
# plot data
plt.scatter(datamart_normalized_multiple.Tenure, datamart_normalized_multiple.Recency, c=datamart_normalized_multiple.c, alpha = 0.6, s=10)

plt.scatter(cen_x, cen_y, marker='^', c="black", s=70, alpha=0.5)
# create a list of legend elemntes
## markers / records
legend_elements = [Line2D([0], [0], marker='o', color='w', label='Cluster {}'.format(i+1), 
               markerfacecolor=mcolor, markersize=5) for i, mcolor in enumerate(colors)]
# plot legend
plt.legend(handles=legend_elements, loc='upper right')
# title and labels
plt.title('\nTenure - Recency\n', loc='left', fontsize=22)
plt.xlabel('Tenure')
plt.ylabel('Recency')
Out[ ]:
Text(0, 0.5, 'Recency')
In [ ]:
datamart_normalized
Out[ ]:
Recency MonetaryValue Tenure
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 0.862854 0.074403 0.524724
008fabab-f868-4019-8b50-4022025b51b2 0.878448 0.605044 0.725217
00d2941f-7e9f-4422-a662-2d9012607d35 0.605364 0.376618 0.282985
012069f5-41a9-472c-ad99-1d72ceca4966 0.962934 0.367582 0.666536
0122b307-340f-41e4-88ac-bdd9e14eb26d 0.504527 0.343799 0.725217
... ... ... ...
feeeefc8-935d-4d87-9009-f819220f842e 0.484849 0.101795 0.187845
ff395835-2462-47e5-a202-e8d2693d750b 0.562253 0.289034 0.254242
ffb5f434-54e6-4f82-837a-b0ef8b878b43 0.551061 0.445724 0.349086
ffcc0f44-ecd8-4438-8f27-77c4b35ed37d 0.659504 0.324317 0.334919
fffd01ad-8bbb-41fc-a5b6-8ac70cb01554 0.763946 0.221409 0.505854

1085 rows × 3 columns

Visualization of Important Cluster Numbers

PCA method and pair plots are applied for all important cluster numbers.

In [ ]:
important_clusters = [3, 8, 11, 15]
for i in important_clusters:
  kmeans = KMeans(n_clusters=i, n_init=20, random_state=1)
  datamart_k = kmeans.fit(datamart_normalized)

  centers= kmeans.cluster_centers_
  clusters= kmeans.predict(datamart_normalized)

  from sklearn.decomposition import PCA
  pca = PCA(n_components=2, random_state=1)
  pca.fit(datamart_normalized)

  datamart_pca = pca.transform(datamart_normalized)
 

  datamart_pca = pd.DataFrame(datamart_pca, columns=["PCA1", "PCA2"])
  datamart_pca["Clusters"] = clusters

  pca.fit(centers)
  centers_pca = pca.transform(centers)
  

  plt.figure(figsize=(10,120))
  plt.subplot(15,1,i)
  plt.scatter(datamart_pca["PCA1"], datamart_pca["PCA2"], c=clusters, s=25, cmap='brg')
  plt.scatter(centers_pca[:, 0], centers_pca[:, 1], c='black', marker="o", s=200, alpha=0.8)


  plt.title('Number of Clusters: {}'.format(i))
In [ ]:
# k means
important_clusters = [3, 8, 11, 15]
for i in important_clusters:
  kmeans = KMeans(n_clusters=i, random_state=1)
  datamart_normalized_multiple['cluster'] = kmeans.fit_predict(datamart_normalized[['Recency', 'MonetaryValue']])
  clusters= kmeans.predict(datamart_normalized[['Recency', 'MonetaryValue']])

  # get centroids
  centroids = kmeans.cluster_centers_
  cen_x = [j[0] for j in centroids] 
  cen_y = [j[1] for j in centroids]

  ## add to datamart_normalized_multiple
  datamart_normalized_multiple['cen_x'] = datamart_normalized_multiple.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2]})
  datamart_normalized_multiple['cen_y'] = datamart_normalized_multiple.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2]})

  #####PLOT#####
  plt.figure(figsize=(10,120))
  plt.subplot(15,1,i)

  plt.scatter(datamart_normalized_multiple.Recency, datamart_normalized_multiple.MonetaryValue, c=clusters, cmap="brg", alpha = 0.6, s=10)
  
  plt.scatter(cen_x, cen_y, marker='^', c="black", s=100, alpha=0.5)
 
  # title and labels
  plt.title('\nRecency - MonetaryValue\nNumber of Clusters: {}'.format(i))
  plt.xlabel('Recency')
  plt.ylabel('MonetaryValue')
In [ ]:
# k means
important_clusters = [3, 8, 11, 15]
for i in important_clusters:
  kmeans = KMeans(n_clusters=i, random_state=1)
  datamart_normalized_multiple['cluster'] = kmeans.fit_predict(datamart_normalized[['Tenure', 'MonetaryValue']])
  clusters= kmeans.predict(datamart_normalized[['Tenure', 'MonetaryValue']])

  # get centroids
  centroids = kmeans.cluster_centers_
  cen_x = [j[0] for j in centroids] 
  cen_y = [j[1] for j in centroids]

  ## add to datamart_normalized_multiple
  datamart_normalized_multiple['cen_x'] = datamart_normalized_multiple.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2]})
  datamart_normalized_multiple['cen_y'] = datamart_normalized_multiple.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2]})

  #####PLOT#####
  plt.figure(figsize=(10,120))
  plt.subplot(15,1,i)

  plt.scatter(datamart_normalized_multiple.Tenure, datamart_normalized_multiple.MonetaryValue, c=clusters, cmap="brg", alpha = 0.6, s=10)
  
  plt.scatter(cen_x, cen_y, marker='^', c="black", s=100, alpha=0.5)
 
  # title and labels
  plt.title('\nTenure - MonetaryValue\nNumber of Clusters: {}'.format(i))
  plt.xlabel('Tenure')
  plt.ylabel('MonetaryValue')
In [ ]:
# k means
important_clusters = [3, 8, 11, 15]
for i in important_clusters:
  kmeans = KMeans(n_clusters=i, random_state=1)
  datamart_normalized_multiple['cluster'] = kmeans.fit_predict(datamart_normalized[['Tenure', 'Recency']])
  clusters= kmeans.predict(datamart_normalized[['Tenure', 'Recency']])

  # get centroids
  centroids = kmeans.cluster_centers_
  cen_x = [j[0] for j in centroids] 
  cen_y = [j[1] for j in centroids]

  ## add to datamart_normalized_multiple
  datamart_normalized_multiple['cen_x'] = datamart_normalized_multiple.cluster.map({0:cen_x[0], 1:cen_x[1], 2:cen_x[2]})
  datamart_normalized_multiple['cen_y'] = datamart_normalized_multiple.cluster.map({0:cen_y[0], 1:cen_y[1], 2:cen_y[2]})

  #####PLOT#####
  plt.figure(figsize=(10,120))
  plt.subplot(15,1,i)

  plt.scatter(datamart_normalized_multiple.Tenure, datamart_normalized_multiple.Recency, c=clusters, cmap="brg", alpha = 0.6, s=10)
  
  plt.scatter(cen_x, cen_y, marker='^', c="black", s=100, alpha=0.5)
 
  # title and labels
  plt.title('\nTenure - Recency\nNumber of Clusters: {}'.format(i))
  plt.xlabel('Tenure')
  plt.ylabel('Recency')

Descriptive Analysis of K-means Clusters

Statistical values and snake plots are generated to help to determine labels of clusters.

In [ ]:
datamart_k8_stat = datamart.assign(Cluster = labels)
In [ ]:
datamart_k8_stat.groupby(["Cluster"]).agg({
    "Recency": ["mean", "std"],
    "MonetaryValue": ["mean", "std"],
    "Tenure": ["mean", "std", "count"],
}).round(0)
Out[ ]:
Recency MonetaryValue Tenure
mean std mean std mean std count
Cluster
0 10.0 12.0 4713.0 3586.0 529.0 153.0 107
1 52.0 27.0 67.0 41.0 69.0 43.0 105
2 179.0 60.0 820.0 1194.0 285.0 123.0 205
3 209.0 58.0 53.0 32.0 281.0 147.0 220
4 10.0 7.0 276.0 195.0 30.0 20.0 114
5 7.0 5.0 2181.0 1528.0 160.0 64.0 110
6 48.0 33.0 503.0 533.0 534.0 108.0 93
7 40.0 22.0 575.0 479.0 158.0 59.0 131
In [ ]:
datamart_normalized_k8 = datamart_normalized.copy()
In [ ]:
datamart_normalized_k8["Cluster"] = datamart_k8_stat["Cluster"]
In [ ]:
datamart_melt = pd.melt(datamart_normalized_k8.reset_index(),
                        id_vars= ["ownerid", "Cluster"],
                        value_vars= ["Recency", "MonetaryValue", "Tenure"],
                        var_name= "Attribute",
                        value_name= "Value")
In [ ]:
plt.title("Snake Plot of Standardized Variables")
sns.lineplot(x="Attribute", y="Value", hue="Cluster", data=datamart_melt)
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d4a42c150>
In [ ]:
important_clusters = [3, 8, 11, 15]
  for i in important_clusters:
    kmeans = KMeans(n_clusters=i, n_init=20, random_state=1)
    datamart_k = kmeans.fit(datamart_normalized)

    labels = kmeans.labels_
    centers= kmeans.cluster_centers_
    clusters= kmeans.predict(datamart_normalized)

    from sklearn.decomposition import PCA
    pca = PCA(n_components=2, random_state=1)
    pca.fit(datamart_normalized)

    datamart_pca = pca.transform(datamart_normalized)

    datamart_pca = pd.DataFrame(datamart_pca, columns=["PCA1", "PCA2"])
    datamart_pca["Clusters"] = clusters

    pca.fit(centers)
    centers_pca = pca.transform(centers)

    plt.figure(figsize=(14,10))
    sns.scatterplot(datamart_pca["PCA1"], datamart_pca["PCA2"], hue=clusters, s=25, palette="brg")
    sns.scatterplot(centers_pca[:, 0], centers_pca[:, 1], marker="o", s=200, alpha=0.8);

    plt.xlabel("PCA1")
    plt.ylabel("PCA2")

    plt.show()

    datamart_k = datamart.assign(Cluster = labels)

    datamart_summary = datamart_k.groupby(["Cluster"]).agg({
      "Recency": ["mean", "std"],
      "MonetaryValue": ["mean", "std", "max",],
      "Tenure": ["mean", "std", "count"],
    }).round(0)

    print('\t\t\tNumber of Cluster {}\n'.format(i))
    print(datamart_summary)
    print("\n")
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
			Number of Cluster 3

        Recency       MonetaryValue                  Tenure             
           mean   std          mean     std      max   mean    std count
Cluster                                                                 
0          20.0  25.0        2659.0  2836.0  15907.0  363.0  205.0   325
1         177.0  71.0         300.0   434.0   3470.0  286.0  149.0   495
2          25.0  20.0         271.0   283.0   1856.0   59.0   49.0   265


/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
			Number of Cluster 8

        Recency       MonetaryValue                  Tenure             
           mean   std          mean     std      max   mean    std count
Cluster                                                                 
0          10.0  12.0        4713.0  3586.0  15907.0  529.0  153.0   107
1          52.0  27.0          67.0    41.0    189.0   69.0   43.0   105
2         179.0  60.0         820.0  1194.0  12731.0  285.0  123.0   205
3         209.0  58.0          53.0    32.0    140.0  281.0  147.0   220
4          10.0   7.0         276.0   195.0   1096.0   30.0   20.0   114
5           7.0   5.0        2181.0  1528.0   9106.0  160.0   64.0   110
6          48.0  33.0         503.0   533.0   3000.0  534.0  108.0    93
7          40.0  22.0         575.0   479.0   4069.0  158.0   59.0   131


/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
			Number of Cluster 11

        Recency       MonetaryValue                  Tenure             
           mean   std          mean     std      max   mean    std count
Cluster                                                                 
0          12.0   7.0          57.0    34.0    152.0   14.0    9.0    44
1          30.0  20.0         507.0   393.0   1898.0  522.0  112.0    77
2         211.0  56.0          43.0    21.0    105.0  218.0   59.0   162
3          42.0  23.0         587.0   372.0   1726.0  166.0   56.0   116
4           7.0   6.0        2419.0  1707.0   9106.0  178.0   60.0   104
5         164.0  74.0        1812.0  1791.0  12731.0  404.0  128.0    80
6           9.0   8.0        5101.0  3626.0  15907.0  546.0  152.0    90
7         180.0  54.0         364.0   226.0   1080.0  221.0   61.0   146
8         173.0  79.0          97.0    76.0    318.0  544.0  109.0    66
9          11.0   8.0         437.0   318.0   1856.0   40.0   22.0   103
10         55.0  25.0          79.0    46.0    243.0   82.0   43.0    97


/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
/usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation.
  FutureWarning
			Number of Cluster 15

        Recency       MonetaryValue                  Tenure             
           mean   std          mean     std      max   mean    std count
Cluster                                                                 
0          66.0  23.0         257.0   146.0    760.0  113.0   41.0    57
1           7.0   5.0        5945.0  3562.0  15907.0  538.0  154.0    73
2          11.0   8.0         413.0   274.0   1684.0   39.0   21.0   100
3         211.0  53.0          38.0    14.0     76.0  214.0   51.0   144
4         210.0  66.0         935.0   957.0   6053.0  454.0   92.0    57
5          24.0  11.0         672.0   472.0   3138.0  188.0   46.0    88
6         137.0  44.0        1040.0   810.0   4395.0  205.0   47.0    89
7          52.0  23.0          61.0    31.0    129.0   68.0   33.0    72
8           6.0   4.0        2509.0  1614.0   9106.0  169.0   63.0    90
9          10.0   6.0         576.0   345.0   1441.0  528.0  119.0    38
10         48.0  24.0        2064.0  2113.0  12731.0  519.0  121.0    49
11         56.0  28.0         159.0    94.0    341.0  517.0  123.0    41
12         11.0   7.0          58.0    34.0    152.0   14.0    8.0    43
13        189.0  52.0         193.0    82.0    386.0  224.0   53.0    98
14        222.0  67.0          65.0    41.0    179.0  545.0  118.0    46


Determination of Cluster Labels

After a plenty of trials, cluster labels are determined based on the visualizations above and statistical values.

The Labels of Clusters for 3
  • Cluster 0: VIP
  • Cluster 1: Churn
  • Cluster 2: Newcomers
The Labels of Clusters for 8
  • Cluster 0: VIP (LR-HM-HT)
  • Cluster 1: Newest Passive (HR-LM-LT)
  • Cluster 2: Most Expensive Churn (HR-HM-HT)
  • Cluster 3: Just First Walk (HR-LM-HT)
  • Cluster 4: Newcomers (LR-LM-LT)
  • Cluster 5: New VIP (LR-HM-LT)
  • Cluster 6: Old Passive (HR-LM-HM)
  • Cluster 7: New Passive (HR-LM-LT)
The Labels of Clusters for 15
  • Cluster 0: New Passive -M-M (AC)
  • Cluster 1: VIP
  • Cluster 2: Newest VIP
  • Cluster 3: Just First Walk (C)
  • Cluster 4: Most Expensive Churn (C)
  • Cluster 5: New VIP Candidate
  • Cluster 6: Expensive Churn (C)
  • Cluster 7: New Just a few walks (AC)
  • Cluster 8: New VIP
  • Cluster 9: Old active -M
  • Cluster 10: VIP -R
  • Cluster 11: Old Passive -M-M-M (AC)
  • Cluster 12: Newest
  • Cluster 13: Just a few walks +M (C)
  • Cluster 14: Just a few walks +T (C)

Distance to Cluster Center

There are some different approaches to comparing distance. In this chapter, all distances are calculated for each cluster points to cluster centroids. Because of that, the smallest distance and sum of squared distance are used for this analysis.

In [ ]:
kmeans = KMeans(n_clusters=8, n_init=20, random_state=1)
datamart_k = kmeans.fit(datamart_normalized)

labels = kmeans.labels_
centers= kmeans.cluster_centers_
centroids= kmeans.predict(datamart_normalized)
In [ ]:
#Distance to cluster center
X_dist = kmeans.transform(datamart_normalized)

X_dist
Out[ ]:
array([[0.9974056 , 0.42878032, 0.46944266, ..., 0.92316697, 0.60238174,
        0.58826587],
       [0.67288501, 0.70954912, 0.16476257, ..., 0.74109635, 0.41244444,
        0.49294779],
       [0.76450636, 0.20698512, 0.40376355, ..., 0.5494051 , 0.54465585,
        0.2437209 ],
       ...,
       [0.65527753, 0.27530071, 0.36696818, ..., 0.44992167, 0.46460329,
        0.13423648],
       [0.78928338, 0.19954665, 0.36571134, ..., 0.61038379, 0.52001574,
        0.28122069],
       [0.83657741, 0.33073907, 0.32966337, ..., 0.74978739, 0.46892664,
        0.41186895]])
In [ ]:
df_dist = pd.DataFrame(X_dist)
df_dist['Cluster'] = centroids
df_dist
Out[ ]:
0 1 2 3 4 5 6 7 Cluster
0 0.997406 0.428780 0.469443 0.093348 0.775875 0.923167 0.602382 0.588266 3
1 0.672885 0.709549 0.164763 0.481304 0.866760 0.741096 0.412444 0.492948 2
2 0.764506 0.206985 0.403764 0.451629 0.367098 0.549405 0.544656 0.243721 1
3 0.854553 0.611859 0.238868 0.261843 0.869198 0.865429 0.492891 0.549149 2
4 0.534811 0.483527 0.386151 0.423424 0.624201 0.555202 0.145940 0.333422 6
... ... ... ... ... ... ... ... ... ...
1080 0.963358 0.125802 0.676904 0.540972 0.369934 0.720716 0.719720 0.486931 1
1081 0.817106 0.111275 0.486655 0.460833 0.333754 0.587931 0.585935 0.305243 1
1082 0.655278 0.275301 0.366968 0.484658 0.352646 0.449922 0.464603 0.134236 7
1083 0.789283 0.199547 0.365711 0.361069 0.442485 0.610384 0.520016 0.281221 1
1084 0.836577 0.330739 0.329663 0.139050 0.637616 0.749787 0.468927 0.411869 3

1085 rows × 9 columns

In [ ]:
X_dist_min = X_dist.min(1)
X_dist_min
Out[ ]:
array([0.09334826, 0.16476257, 0.20698512, ..., 0.13423648, 0.19954665,
       0.13904967])
In [ ]:
'''# squared distance to cluster center
X_sqdist = kmeans.transform(datamart_normalized)**2


import pandas as pd
df_dist_min = pd.DataFrame(X_dist_min.sum(axis=1).round(2), columns=['sqdist'])
df_dist_min['label'] = centroids

df_dist_min.head(10)'''
Out[ ]:
"# squared distance to cluster center\nX_sqdist = kmeans.transform(datamart_normalized)**2\n\n\nimport pandas as pd\ndf_dist_min = pd.DataFrame(X_dist_min.sum(axis=1).round(2), columns=['sqdist'])\ndf_dist_min['label'] = centroids\n\ndf_dist_min.head(10)"
In [ ]:
sum_sq_dist = X_dist.sum(axis=1).round(2)
In [ ]:
datamart_k8_dist = datamart_k8_stat.assign(MinDistance = X_dist_min)
datamart_k8_dist
Out[ ]:
Recency MonetaryValue Tenure Cluster MinDistance
ownerid
0062f2a6-878d-4100-9bea-2b50e266a56e 212 29.90 212 3 0.093348
008fabab-f868-4019-8b50-4022025b51b2 226 807.40 415 2 0.164763
00d2941f-7e9f-4422-a662-2d9012607d35 66 179.80 67 1 0.206985
012069f5-41a9-472c-ad99-1d72ceca4966 316 169.90 347 2 0.238868
0122b307-340f-41e4-88ac-bdd9e14eb26d 39 146.51 415 6 0.145940
... ... ... ... ... ...
feeeefc8-935d-4d87-9009-f819220f842e 35 34.90 35 1 0.125802
ff395835-2462-47e5-a202-e8d2693d750b 53 104.70 56 1 0.111275
ffb5f434-54e6-4f82-837a-b0ef8b878b43 50 279.13 97 7 0.134236
ffcc0f44-ecd8-4438-8f27-77c4b35ed37d 86 129.90 90 1 0.199547
fffd01ad-8bbb-41fc-a5b6-8ac70cb01554 139 69.80 197 3 0.139050

1085 rows × 5 columns

In [ ]:
df_dist = df_dist.assign(MinDistance = X_dist_min)
df_dist
Out[ ]:
0 1 2 3 4 5 6 7 Cluster MinDistance
0 0.997406 0.428780 0.469443 0.093348 0.775875 0.923167 0.602382 0.588266 3 0.093348
1 0.672885 0.709549 0.164763 0.481304 0.866760 0.741096 0.412444 0.492948 2 0.164763
2 0.764506 0.206985 0.403764 0.451629 0.367098 0.549405 0.544656 0.243721 1 0.206985
3 0.854553 0.611859 0.238868 0.261843 0.869198 0.865429 0.492891 0.549149 2 0.238868
4 0.534811 0.483527 0.386151 0.423424 0.624201 0.555202 0.145940 0.333422 6 0.145940
... ... ... ... ... ... ... ... ... ... ...
1080 0.963358 0.125802 0.676904 0.540972 0.369934 0.720716 0.719720 0.486931 1 0.125802
1081 0.817106 0.111275 0.486655 0.460833 0.333754 0.587931 0.585935 0.305243 1 0.111275
1082 0.655278 0.275301 0.366968 0.484658 0.352646 0.449922 0.464603 0.134236 7 0.134236
1083 0.789283 0.199547 0.365711 0.361069 0.442485 0.610384 0.520016 0.281221 1 0.199547
1084 0.836577 0.330739 0.329663 0.139050 0.637616 0.749787 0.468927 0.411869 3 0.139050

1085 rows × 10 columns

In [ ]:
datamart_k8_dist = datamart_k8_dist.assign(SumofSquareDistance = sum_sq_dist)
datamart_k8_dist = datamart_k8_dist.reset_index()
datamart_k8_dist
Out[ ]:
ownerid Recency MonetaryValue Tenure Cluster MinDistance SumofSquareDistance
0 0062f2a6-878d-4100-9bea-2b50e266a56e 212 29.90 212 3 0.093348 4.88
1 008fabab-f868-4019-8b50-4022025b51b2 226 807.40 415 2 0.164763 4.54
2 00d2941f-7e9f-4422-a662-2d9012607d35 66 179.80 67 1 0.206985 3.53
3 012069f5-41a9-472c-ad99-1d72ceca4966 316 169.90 347 2 0.238868 4.74
4 0122b307-340f-41e4-88ac-bdd9e14eb26d 39 146.51 415 6 0.145940 3.49
... ... ... ... ... ... ... ...
1080 feeeefc8-935d-4d87-9009-f819220f842e 35 34.90 35 1 0.125802 4.60
1081 ff395835-2462-47e5-a202-e8d2693d750b 53 104.70 56 1 0.111275 3.69
1082 ffb5f434-54e6-4f82-837a-b0ef8b878b43 50 279.13 97 7 0.134236 3.18
1083 ffcc0f44-ecd8-4438-8f27-77c4b35ed37d 86 129.90 90 1 0.199547 3.57
1084 fffd01ad-8bbb-41fc-a5b6-8ac70cb01554 139 69.80 197 3 0.139050 3.90

1085 rows × 7 columns

In [ ]:
df_k8_dist = pd.merge(datamart_k8_dist, df_dist.drop_duplicates("MinDistance"), left_on="MinDistance", right_on="MinDistance", how="left")
df_k8_dist.sort_values("MinDistance")
Out[ ]:
ownerid Recency MonetaryValue Tenure Cluster_x MinDistance SumofSquareDistance 0 1 2 3 4 5 6 7 Cluster_y
716 a3f3523d-6788-4a6b-a57e-b50196f6fef3 35 296.80 512 6 0.020897 3.54 0.424676 0.597424 0.395651 0.525755 0.687122 0.523684 0.020897 0.363634 6
672 97a3b518-1888-4101-adb3-7f013ed219df 34 388.80 151 7 0.021693 2.91 0.529971 0.362137 0.366049 0.530104 0.375709 0.352494 0.371101 0.021693 7
1045 f6878898-4652-41c3-8ed1-410f046cbfa8 8 2928.39 490 0 0.027143 4.41 0.027143 0.841411 0.644402 0.900481 0.741912 0.351305 0.410612 0.494309 0
680 9a6fb2e5-2fd2-4041-91d9-76c25c922e78 8 237.78 25 4 0.029257 4.22 0.758024 0.392285 0.726026 0.792887 0.029257 0.418652 0.711013 0.389449 4
943 df5f1dba-2d5c-4117-a980-920de6af6bbb 32 390.84 141 7 0.029905 2.94 0.535424 0.357635 0.382205 0.542528 0.357820 0.343918 0.387274 0.029905 7
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
854 c81ca470-6b27-4d64-ba9c-2796f78e0802 208 29.90 795 3 0.399572 6.23 0.970737 0.784189 0.603276 0.399572 1.066602 1.060484 0.552540 0.788826 3
932 dce77bd1-e807-439b-afa6-690c78e8ecc3 159 6052.77 549 2 0.416232 5.51 0.560952 0.928551 0.416232 0.774930 0.985424 0.724947 0.510862 0.612251 2
71 10471541-af3b-4f50-8fde-b2f0e7a2248a 322 99.70 781 3 0.424680 6.03 0.910686 0.827627 0.481841 0.424680 1.085048 1.025055 0.524955 0.753243 3
658 956fb71e-e8ab-4059-88ef-2c12e762b387 312 134.55 797 3 0.448422 5.96 0.878532 0.838147 0.462393 0.448422 1.082396 1.003804 0.505504 0.740383 3
1053 f82cb910-9213-49f4-98ec-ce3347328c9a 144 12731.34 622 2 0.521758 6.08 0.563662 1.022553 0.521758 0.880184 1.055411 0.760391 0.581719 0.690670 2

1085 rows × 16 columns

In [ ]:
df_k8_dist = df_k8_dist.drop("Cluster_y", axis=1)
df_k8_dist = df_k8_dist.rename(columns={"Cluster_x": "Cluster"})
df_k8_dist
Out[ ]:
ownerid Recency MonetaryValue Tenure Cluster MinDistance SumofSquareDistance 0 1 2 3 4 5 6 7
0 0062f2a6-878d-4100-9bea-2b50e266a56e 212 29.90 212 3 0.093348 4.88 0.997406 0.428780 0.469443 0.093348 0.775875 0.923167 0.602382 0.588266
1 008fabab-f868-4019-8b50-4022025b51b2 226 807.40 415 2 0.164763 4.54 0.672885 0.709549 0.164763 0.481304 0.866760 0.741096 0.412444 0.492948
2 00d2941f-7e9f-4422-a662-2d9012607d35 66 179.80 67 1 0.206985 3.53 0.764506 0.206985 0.403764 0.451629 0.367098 0.549405 0.544656 0.243721
3 012069f5-41a9-472c-ad99-1d72ceca4966 316 169.90 347 2 0.238868 4.74 0.854553 0.611859 0.238868 0.261843 0.869198 0.865429 0.492891 0.549149
4 0122b307-340f-41e4-88ac-bdd9e14eb26d 39 146.51 415 6 0.145940 3.49 0.534811 0.483527 0.386151 0.423424 0.624201 0.555202 0.145940 0.333422
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1080 feeeefc8-935d-4d87-9009-f819220f842e 35 34.90 35 1 0.125802 4.60 0.963358 0.125802 0.676904 0.540972 0.369934 0.720716 0.719720 0.486931
1081 ff395835-2462-47e5-a202-e8d2693d750b 53 104.70 56 1 0.111275 3.69 0.817106 0.111275 0.486655 0.460833 0.333754 0.587931 0.585935 0.305243
1082 ffb5f434-54e6-4f82-837a-b0ef8b878b43 50 279.13 97 7 0.134236 3.18 0.655278 0.275301 0.366968 0.484658 0.352646 0.449922 0.464603 0.134236
1083 ffcc0f44-ecd8-4438-8f27-77c4b35ed37d 86 129.90 90 1 0.199547 3.57 0.789283 0.199547 0.365711 0.361069 0.442485 0.610384 0.520016 0.281221
1084 fffd01ad-8bbb-41fc-a5b6-8ac70cb01554 139 69.80 197 3 0.139050 3.90 0.836577 0.330739 0.329663 0.139050 0.637616 0.749787 0.468927 0.411869

1085 rows × 15 columns

In [ ]:
'''from google.colab import files
datamart_k8_dist.to_csv('DogGo_CS_k8_dist.csv') 
files.download('DogGo_CS_k8_dist.csv')'''
Out[ ]:
"from google.colab import files\ndatamart_k8_dist.to_csv('DogGo_CS_k8_dist.csv') \nfiles.download('DogGo_CS_k8_dist.csv')"

First five customers that has smallest distance for each cluster are listed below.

In [ ]:
for i in range(8):
  print(df_k8_dist[df_k8_dist["Cluster"] == i].sort_values(["MinDistance"]).head(5))
                                   ownerid  Recency  ...         6         7
1045  f6878898-4652-41c3-8ed1-410f046cbfa8        8  ...  0.410612  0.494309
76    121c5787-1910-4b6c-8fbe-8e371c753392        8  ...  0.427021  0.561665
1035  f40f29dc-a00f-4233-b79c-ecdc1d10ff52       12  ...  0.366584  0.462536
677   998502a3-da2a-49e5-8398-4134e2496474        8  ...  0.484459  0.539612
254   3cf7107e-1758-4882-84fb-9fbdfa273a45        4  ...  0.482452  0.561006

[5 rows x 15 columns]
                                  ownerid  Recency  ...         6         7
497  722aff05-32e2-43de-981b-e970df836bab       53  ...  0.625183  0.383413
731  a6fd6a2f-0411-40eb-a69b-d126b1659b6e       54  ...  0.635452  0.406492
740  a8fe894a-222d-4566-9bca-0bfe14cdfd14       48  ...  0.636750  0.387622
535  7ba2c5f0-5a8f-466d-a910-54bff4b635bb       54  ...  0.617298  0.371325
59   0dc1571c-7699-4cf1-be9c-d6888381f6cc       42  ...  0.659467  0.408537

[5 rows x 15 columns]
                                  ownerid  Recency  ...         6         7
750  aa970aff-89ed-49f7-ac79-9e6eefc0e76c      167  ...  0.363437  0.368275
262  3e10ae06-4e96-4f19-a134-a1facec429b2      170  ...  0.377159  0.361298
489  6feee888-de2d-4f8f-9fc2-b2148fefff1f      150  ...  0.379520  0.326996
528  78566068-0629-4512-99f0-7d8860d93f70      172  ...  0.418040  0.347190
736  a7fa2f09-129b-4483-af52-500c90b6cb7d      197  ...  0.423460  0.393365

[5 rows x 15 columns]
                                  ownerid  Recency  ...         6         7
907  d5708423-4102-4ee3-a70e-5a7b5e9345a9      226  ...  0.586963  0.581084
745  a9c17cc9-750c-4130-84ae-e64872cd6b30      211  ...  0.538158  0.512635
980  e866638d-581b-49fd-b96c-8a19940fb3a2      210  ...  0.523231  0.504125
428  6348b031-b08e-46e3-80b7-b3d2014ac325      244  ...  0.536807  0.537962
244  3af741ef-2f90-48e4-8114-f27dac961eba      180  ...  0.498290  0.477932

[5 rows x 15 columns]
                                  ownerid  Recency  ...         6         7
680  9a6fb2e5-2fd2-4041-91d9-76c25c922e78        8  ...  0.711013  0.389449
753  ab1bf0f9-5816-41c4-a1e3-4910ec750740        6  ...  0.712382  0.409895
976  e7fb645b-1d40-485d-b50b-7911d8f06d76        8  ...  0.668894  0.351313
765  af0e141b-c62d-44e5-ad6c-e573880468fe        6  ...  0.743060  0.426717
36   086c46ad-e63e-449c-b0b0-2d2a1f379a95        9  ...  0.652992  0.333545

[5 rows x 15 columns]
                                   ownerid  Recency  ...         6         7
1047  f72d2f38-1f9c-4d0d-8aaa-d79863490bbe        5  ...  0.540014  0.370200
635   90a44990-0bfd-4d61-9afc-ab53ca9f282e        4  ...  0.566599  0.377566
554   7f5467bf-a711-4ee6-8186-95c9b7faf25d        6  ...  0.566040  0.369942
153   25cdc8cf-0062-4782-8fed-1eca3619e298        4  ...  0.556697  0.390977
354   5351e4a0-a0c8-4a75-99ae-0f7e15cba39d        8  ...  0.505158  0.319130

[5 rows x 15 columns]
                                  ownerid  Recency  ...         6         7
716  a3f3523d-6788-4a6b-a57e-b50196f6fef3       35  ...  0.020897  0.363634
30   06fb06b4-3795-4b12-b6cb-76166c2a3b3a       27  ...  0.069650  0.345903
925  daa69236-caad-4d5f-8b44-be3023b8342c       46  ...  0.074125  0.382903
532  7a4dfa0b-d8aa-4160-adfb-6c24916bec21       54  ...  0.079814  0.408165
862  c9aad91a-748e-423d-8b87-379ac0413cc5       34  ...  0.094266  0.330891

[5 rows x 15 columns]
                                  ownerid  Recency  ...         6         7
672  97a3b518-1888-4101-adb3-7f013ed219df       34  ...  0.371101  0.021693
943  df5f1dba-2d5c-4117-a980-920de6af6bbb       32  ...  0.387274  0.029905
650  94023950-ec94-4d04-9dbe-1057962f9bf4       40  ...  0.355635  0.030962
410  60892581-24bf-4cda-a0c9-fb6368c02be8       31  ...  0.360622  0.032804
564  8141b59e-58c6-4a5c-ad21-c82ae8dd5236       36  ...  0.373464  0.039187

[5 rows x 15 columns]
Distance Matrix of Centroids
In [ ]:
centers
Out[ ]:
array([[0.23967132, 0.80196099, 0.80242925],
       [0.53493301, 0.1823887 , 0.27044204],
       [0.81139326, 0.53623275, 0.59136839],
       [0.85101751, 0.14586127, 0.58360942],
       [0.26295964, 0.39561669, 0.15199131],
       [0.20202876, 0.71378333, 0.44262862],
       [0.50116001, 0.46202507, 0.81071361],
       [0.48507606, 0.51755415, 0.44131292]])
In [ ]:
df_dist_centers = pd.DataFrame(centers, columns=['xcord', 'ycord', 'zcord'])
In [ ]:
from scipy.spatial import distance_matrix
df_dist_matrix_centers = pd.DataFrame(distance_matrix(df_dist_centers.values, df_dist_centers.values), index=df_dist_centers.index, columns=df_dist_centers.index)
In [ ]:
df_dist_matrix_centers
Out[ ]:
0 1 2 3 4 5 6 7
0 0.000000 0.868366 0.664849 0.923089 0.767286 0.372356 0.428954 0.521072
1 0.868366 0.000000 0.551933 0.446450 0.365330 0.650272 0.609287 0.379498
2 0.664849 0.551933 0.000000 0.392454 0.716662 0.651899 0.387122 0.359650
3 0.923089 0.446450 0.392454 0.000000 0.771028 0.873841 0.523389 0.540664
4 0.767286 0.365330 0.716662 0.771028 0.000000 0.435216 0.703608 0.384593
5 0.372356 0.650272 0.651899 0.873841 0.435216 0.000000 0.536981 0.344417
6 0.428954 0.609287 0.387122 0.523389 0.703608 0.536981 0.000000 0.373897
7 0.521072 0.379498 0.359650 0.540664 0.384593 0.344417 0.373897 0.000000

Analysis of Similarity

To ensure each customer is in the correct cluster, the similarity between each point in a cluster. It can be helpful to realize a wrong cluster point. As a first step similarity function is generated. Next, similarities are calculated for each cluster and some statistical features are calculated to . Similarity heat maps are plotted to visualize these analyses.

In [ ]:
import math

from matplotlib import pyplot as plt
import numpy as np
import numpy.linalg as nla
import pandas as pd
import seaborn as sns
import altair as alt
import re
import pdb  # for Python debugger
import sys
from os.path import join
In [ ]:
datamart_normalized_tf = datamart_normalized.copy()
datamart_normalized_tf = datamart_normalized_tf.reset_index()
datamart_normalized_tf = datamart_normalized_tf.drop("ownerid", axis=1)
datamart_normalized_tf2 = datamart_normalized_tf.copy()
datamart_normalized_tf2
Out[ ]:
Recency MonetaryValue Tenure
0 0.862854 0.074403 0.524724
1 0.878448 0.605044 0.725217
2 0.605364 0.376618 0.282985
3 0.962934 0.367582 0.666536
4 0.504527 0.343799 0.725217
... ... ... ...
1080 0.484849 0.101795 0.187845
1081 0.562253 0.289034 0.254242
1082 0.551061 0.445724 0.349086
1083 0.659504 0.324317 0.334919
1084 0.763946 0.221409 0.505854

1085 rows × 3 columns

In [ ]:
def getSimilarity(obj1, obj2):
  len1 = len(obj1.index)
  len2 = len(obj2.index)
  if not (len1 == len2):
    print ("Error: Compared objects must have same number of features.")
    sys.exit()
    return 0
  else:
    similarity = obj1 - obj2
    similarity = np.sum((similarity**2.0) / 10)
    similarity = 1 - math.sqrt(similarity)
    return similarity
In [ ]:
datamart_tf = datamart.copy()
datamart_tf = datamart_tf.reset_index()
datamart_tf = datamart_tf.drop("ownerid", axis=1)
In [ ]:
def similarityHeatMapStats(df, cluster_number):
  datamart_sim = df.copy()
  datamart_sim["Cluster"] = centroids
  datamart_sim = datamart_sim.reset_index()
  datamart_sim = datamart_sim.drop("ownerid", axis=1)
  datamart_sim_c = datamart_sim[datamart_sim["Cluster"] == cluster_number]
  datamart_sim_c = datamart_sim_c.drop("Cluster", axis=1)
  datamart_sim_c = datamart_sim_c.reset_index()
  datamart_sim_c = datamart_sim_c.drop("index", axis=1)
  datamart_sim_c

  mat2 = []
  owner1 = 0
  ownersToCompare = [0, len(datamart_sim_c)-1]
  for ij in range(ownersToCompare[0], ownersToCompare[1] + 1):
    for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):
      mat2.append(getSimilarity(datamart_sim_c.loc[ij], datamart_sim_c.loc[ii]))

  Yrows = []
  for i in range(1,len(datamart_sim_c)+1):
    for j in range(1,len(datamart_sim_c)+1):
      Yrows.append(i)

  Xcols = []
  for i in range(1,len(datamart_sim_c)+1):
    for j in range(1,len(datamart_sim_c)+1):
      Xcols.append(j)

  df_mat = pd.DataFrame(mat2, columns=["M"])
  df_mat["Yrows"] = Yrows
  df_mat["Xcols"] = Xcols
  df_mat.sort_values("M")

  matrix = ((np.asarray(df_mat["M"])).reshape(len(datamart_sim_c), len(datamart_sim_c)))
  matrix_xcols = ((np.asarray(df_mat["Xcols"])).reshape(len(datamart_sim_c), len(datamart_sim_c)))

  result = df_mat.pivot(index="Yrows", columns="Xcols", values="M")

  labels = (np.asarray(["{0} \n {1:.2f}".format(symb, value) for symb, value in zip(matrix_xcols.flatten(), matrix.flatten())])).reshape(len(datamart_sim_c), len(datamart_sim_c))

  '''fig, ax = plt.subplots(figsize=(120,90))

  title = "Similarity Heat Map"

  plt.title(title, fontsize=60)
  ttl = ax.title
  ttl.set_position([0.5,1.05])

  ax.set_xticks([])
  ax.set_yticks([])

  ax.axis("off")

  sns.heatmap(result, annot=labels, fmt="", cmap="RdYlGn", linewidths=0.30, ax=ax)

  plt.show()'''

  print("Cluster: ", cluster_number)
  print("Max value: ", max(mat2))
  print("Min value: ", min(mat2))
  print("Mean value: ", statistics.mean(mat2))
  print("Mode value: ", statistics.mode(mat2))
  print("Number of elements: ", len(datamart_sim_c))
  print("\n")
In [ ]:
for i in range(0, 8):
  similarityHeatMapStats(datamart_normalized, i)
Cluster:  0
Max value:  1.0
Min value:  0.8053129495347635
Mean value:  0.9203309355922875
Mode value:  1.0
Number of elements:  107


Cluster:  1
Max value:  1.0
Min value:  0.8168329276357594
Mean value:  0.9286311034120989
Mode value:  1.0
Number of elements:  105


Cluster:  2
Max value:  1.0
Min value:  0.7596107316533882
Mean value:  0.9231145891901041
Mode value:  1.0
Number of elements:  205


Cluster:  3
Max value:  1.0
Min value:  0.783920282281919
Mean value:  0.9318867869504709
Mode value:  1.0
Number of elements:  220


Cluster:  4
Max value:  1.0
Min value:  0.8002062815397774
Mean value:  0.9273611156448313
Mode value:  1.0
Number of elements:  114


Cluster:  5
Max value:  1.0
Min value:  0.8512357350305877
Mean value:  0.936420462288477
Mode value:  1.0
Number of elements:  110


Cluster:  6
Max value:  1.0
Min value:  0.7549990671875924
Mean value:  0.9106038547216317
Mode value:  1.0
Number of elements:  93


Cluster:  7
Max value:  1.0
Min value:  0.8014889984758657
Mean value:  0.9285268508653314
Mode value:  1.0
Number of elements:  131


Within these 7 gruops, the best cluster is cluster 2, because it has higher mean value. The worst cluster is 3 that has lowest mean and min value.

In [ ]:
def similarityHeatMap(df, cluster_number):
  datamart_sim = df.copy()
  datamart_sim["Cluster"] = centroids
  datamart_sim = datamart_sim.reset_index()
  datamart_sim = datamart_sim.drop("ownerid", axis=1)
  datamart_sim_c = datamart_sim[datamart_sim["Cluster"] == cluster_number]
  datamart_sim_c = datamart_sim_c.drop("Cluster", axis=1)
  datamart_sim_c = datamart_sim_c.reset_index()
  datamart_sim_c = datamart_sim_c.drop("index", axis=1)
  datamart_sim_c

  mat2 = []
  owner1 = 0
  ownersToCompare = [0, len(datamart_sim_c)-1]
  for ij in range(ownersToCompare[0], ownersToCompare[1] + 1):
    for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):
      mat2.append(getSimilarity(datamart_sim_c.loc[ij], datamart_sim_c.loc[ii]))

  Yrows = []
  for i in range(1,len(datamart_sim_c)+1):
    for j in range(1,len(datamart_sim_c)+1):
      Yrows.append(i)

  Xcols = []
  for i in range(1,len(datamart_sim_c)+1):
    for j in range(1,len(datamart_sim_c)+1):
      Xcols.append(j)

  df_mat = pd.DataFrame(mat2, columns=["M"])
  df_mat["Yrows"] = Yrows
  df_mat["Xcols"] = Xcols
  df_mat.sort_values("M")

  matrix = ((np.asarray(df_mat["M"])).reshape(len(datamart_sim_c), len(datamart_sim_c)))
  matrix_xcols = ((np.asarray(df_mat["Xcols"])).reshape(len(datamart_sim_c), len(datamart_sim_c)))

  result = df_mat.pivot(index="Yrows", columns="Xcols", values="M")

  labels = (np.asarray(["{0} \n {1:.2f}".format(symb, value) for symb, value in zip(matrix_xcols.flatten(), matrix.flatten())])).reshape(len(datamart_sim_c), len(datamart_sim_c))

  fig, ax = plt.subplots(figsize=(90,60))

  title = "Similarity Heat Map"

  plt.title(title, fontsize=60)
  ttl = ax.title
  ttl.set_position([0.5,1.05])

  ax.set_xticks([])
  ax.set_yticks([])

  ax.axis("off")

  sns.heatmap(result, annot=labels, fmt="", cmap="RdYlGn", linewidths=0.30, ax=ax)

  plt.show()

  print("Cluster: ", cluster_number)
  print("Max value: ", max(mat2))
  print("Min value: ", min(mat2))
  print("Mean value: ", statistics.mean(mat2))
  print("Mode value: ", statistics.mode(mat2))
  print("Number of elements: ", len(datamart_sim_c))
  print("\n")

Similarity Heat Map is plotted for cluster 11 to understand the worst cluster based on similarity.

In [ ]:
similarityHeatMap(datamart_normalized, 6)
Cluster:  6
Max value:  1.0
Min value:  0.7549990671875924
Mean value:  0.9106038547216317
Mode value:  1.0
Number of elements:  93


In [ ]:
'''datamart_sim = datamart_normalized.copy()
datamart_sim["Cluster"] = centroids
datamart_sim = datamart_sim.reset_index()
datamart_sim = datamart_sim.drop("ownerid", axis=1)
datamart_sim_zero = datamart_sim[datamart_sim["Cluster"] == 1]
datamart_sim_zero = datamart_sim_zero.drop("Cluster", axis=1)
datamart_sim_zero = datamart_sim_zero.reset_index()
datamart_sim_zero = datamart_sim_zero.drop("index", axis=1)
datamart_sim_zero'''
Out[ ]:
'datamart_sim = datamart_normalized.copy()\ndatamart_sim["Cluster"] = centroids\ndatamart_sim = datamart_sim.reset_index()\ndatamart_sim = datamart_sim.drop("ownerid", axis=1)\ndatamart_sim_zero = datamart_sim[datamart_sim["Cluster"] == 1]\ndatamart_sim_zero = datamart_sim_zero.drop("Cluster", axis=1)\ndatamart_sim_zero = datamart_sim_zero.reset_index()\ndatamart_sim_zero = datamart_sim_zero.drop("index", axis=1)\ndatamart_sim_zero'
In [ ]:
'''owner1 = 0
ownersToCompare = [1, 4]

print ("Similarity between owners " + str(owner1) + " and ...")

for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):
  print (str(ii) + ": " + str(getSimilarity(datamart_sim_zero.loc[owner1], datamart_sim_zero.loc[ii])))

print ("\n\nFeature data for owner " + str(owner1))
print (datamart_tf.loc[owner1:owner1, :])
print ("\n\nFeature data for compared owners " + str(ownersToCompare))
print (datamart_tf.loc[ownersToCompare[0]:ownersToCompare[1], :])'''
Out[ ]:
'owner1 = 0\nownersToCompare = [1, 4]\n\nprint ("Similarity between owners " + str(owner1) + " and ...")\n\nfor ii in range(ownersToCompare[0], ownersToCompare[1] + 1):\n  print (str(ii) + ": " + str(getSimilarity(datamart_sim_zero.loc[owner1], datamart_sim_zero.loc[ii])))\n\nprint ("\n\nFeature data for owner " + str(owner1))\nprint (datamart_tf.loc[owner1:owner1, :])\nprint ("\n\nFeature data for compared owners " + str(ownersToCompare))\nprint (datamart_tf.loc[ownersToCompare[0]:ownersToCompare[1], :])'
In [ ]:
'''mat0 = []

owner1 = 0
ownersToCompare = [0, 169]
for ij in range(ownersToCompare[0], ownersToCompare[1] + 1):
  mat1=[]
  for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):
    mat1.append(getSimilarity(datamart_sim_zero.loc[ij], datamart_sim_zero.loc[ii]))
  mat0.append(mat1)

print(mat0)'''
Out[ ]:
'mat0 = []\n\nowner1 = 0\nownersToCompare = [0, 169]\nfor ij in range(ownersToCompare[0], ownersToCompare[1] + 1):\n  mat1=[]\n  for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):\n    mat1.append(getSimilarity(datamart_sim_zero.loc[ij], datamart_sim_zero.loc[ii]))\n  mat0.append(mat1)\n\nprint(mat0)'
In [ ]:
'''plt.imshow(mat0, cmap='hot', interpolation='nearest')
plt.show()'''
Out[ ]:
"plt.imshow(mat0, cmap='hot', interpolation='nearest')\nplt.show()"
In [ ]:
'''mat2 = []
owner1 = 0
ownersToCompare = [0, 169]
for ij in range(ownersToCompare[0], ownersToCompare[1] + 1):
  for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):
    mat2.append(getSimilarity(datamart_sim_zero.loc[ij], datamart_sim_zero.loc[ii]))'''
Out[ ]:
'mat2 = []\nowner1 = 0\nownersToCompare = [0, 169]\nfor ij in range(ownersToCompare[0], ownersToCompare[1] + 1):\n  for ii in range(ownersToCompare[0], ownersToCompare[1] + 1):\n    mat2.append(getSimilarity(datamart_sim_zero.loc[ij], datamart_sim_zero.loc[ii]))'
In [ ]:
'''Yrows = []

for i in range(1,171):
  for j in range(1,171):
    Yrows.append(i)'''
Out[ ]:
'Yrows = []\n\nfor i in range(1,171):\n  for j in range(1,171):\n    Yrows.append(i)'
In [ ]:
'''Xcols = []

for i in range(1,171):
  for j in range(1,171):
    Xcols.append(j)'''
Out[ ]:
'Xcols = []\n\nfor i in range(1,171):\n  for j in range(1,171):\n    Xcols.append(j)'
In [ ]:
'''df_mat = pd.DataFrame(mat2, columns=["M"])
df_mat["Yrows"] = Yrows
df_mat["Xcols"] = Xcols
df_mat.sort_values("M")'''
Out[ ]:
'df_mat = pd.DataFrame(mat2, columns=["M"])\ndf_mat["Yrows"] = Yrows\ndf_mat["Xcols"] = Xcols\ndf_mat.sort_values("M")'
In [ ]:
'''matrix = ((np.asarray(df_mat["M"])).reshape(170, 170))'''
Out[ ]:
'matrix = ((np.asarray(df_mat["M"])).reshape(170, 170))'
In [ ]:
'''matrix_xcols = ((np.asarray(df_mat["Xcols"])).reshape(170, 170))'''
Out[ ]:
'matrix_xcols = ((np.asarray(df_mat["Xcols"])).reshape(170, 170))'
In [ ]:
#matrix
In [ ]:
#result = df_mat.pivot(index="Yrows", columns="Xcols", values="M")
In [ ]:
#labels = (np.asarray(["{0} \n {1:.2f}".format(symb, value) for symb, value in zip(matrix_xcols.flatten(), matrix.flatten())])).reshape(170, 170)
In [ ]:
'''fig, ax = plt.subplots(figsize=(240,240))

title = "Similarity Heat Map"

plt.title(title, fontsize=180)
ttl = ax.title
ttl.set_position([0.5,1.05])

ax.set_xticks([])
ax.set_yticks([])

ax.axis("off")

sns.heatmap(result, annot=labels, fmt="", cmap="RdYlGn", linewidths=0.30, ax=ax)

plt.show()'''
Out[ ]:
'fig, ax = plt.subplots(figsize=(240,240))\n\ntitle = "Similarity Heat Map"\n\nplt.title(title, fontsize=180)\nttl = ax.title\nttl.set_position([0.5,1.05])\n\nax.set_xticks([])\nax.set_yticks([])\n\nax.axis("off")\n\nsns.heatmap(result, annot=labels, fmt="", cmap="RdYlGn", linewidths=0.30, ax=ax)\n\nplt.show()'

Another Application of K-means

In this chapter, k-means is applied like previous chapters, but distance to centroid is defined as loss. Firstly, clusters and distances are calculated and results are shown with some graphs below using related functions.

In [ ]:
datamart_tf
Out[ ]:
Recency MonetaryValue Tenure
0 212 29.90 212
1 226 807.40 415
2 66 179.80 67
3 316 169.90 347
4 39 146.51 415
... ... ... ...
1080 35 34.90 35
1081 53 104.70 56
1082 50 279.13 97
1083 86 129.90 90
1084 139 69.80 197

1085 rows × 3 columns

In [ ]:
def dfSimilarity(df, centroids, random_state=1):
  ### dfSimilarity = Calculate similarities for dataframe input
  ### We need to calculate ||a-b||^2 = |a|^2 + |b|^2 - 2*|a|*|b|
  ### Implement this with matrix operations
  ### See the Appendix for further explanation
  numPoints = len(df.index)
  numCentroids = len(centroids.index)
  ## Strictly speaking, we don't need to calculate the norm of points
  # because it adds a constant bias to distances
  # But calculating it so that the similarity doesn't go negative
  # And that we expect similarities in [0,1] which aids debugging
  pointNorms = np.square(nla.norm(df, axis=1))
  pointNorms = np.reshape(pointNorms, [numPoints, 1])
  ## Calculate the norm of centroids
  centroidNorms = np.square(nla.norm(centroids, axis=1))
  centroidNorms = np.reshape(centroidNorms, (1, numCentroids))
  ## Calculate |a|^2 + |b|^2 - 2*|a|*|b|
  similarities = pointNorms + centroidNorms - 2.0 * np.dot(
      df, np.transpose(centroids))
  # Divide by the number of features
  # Which is 10 because the one-hot encoding means the "Maker" and "Bean" are
  # weighted twice
  similarities = similarities / 3.0
  # numerical artifacts lead to negligible but negative values that go to NaN on the root
  similarities = similarities.clip(min=0.0)
  # Square root since it's ||a-b||^2
  similarities = np.sqrt(similarities)
  return similarities


def initCentroids(df, k, feature_cols, random_state=1):
  # Pick 'k' examples are random to serve as initial centroids
  limit = len(df.index)
  centroids_key = np.random.randint(0, limit - 1, k)
  centroids = df.loc[centroids_key, feature_cols].copy(deep=True)
  # the indexes get copied over so reset them
  centroids.reset_index(drop=True, inplace=True)
  return centroids


def pt2centroid(df, centroids, feature_cols, random_state=1):
  ### Calculate similarities between all points and centroids
  ### And assign points to the closest centroid + save that distance
  numCentroids = len(centroids.index)
  numExamples = len(df.index)
  # dfSimilarity = Calculate similarities for dataframe input
  dist = dfSimilarity(df.loc[:, feature_cols], centroids.loc[:, feature_cols])
  df.loc[:, 'centroid'] = np.argmin(dist, axis=1)  # closest centroid
  df.loc[:, 'pt2centroid'] = np.min(dist, axis=1)  # minimum distance
  return df


def recomputeCentroids(df, centroids, feature_cols, random_state=1):
  ### For every centroid, recompute it as an average of the points
  ### assigned to it
  numCentroids = len(centroids.index)
  for cen in range(numCentroids):
    dfSubset = df.loc[df['centroid'] == cen,
                      feature_cols]  # all points for centroid
    if not (dfSubset.empty):  # if there are points assigned to the centroid
      clusterAvg = np.sum(dfSubset) / len(dfSubset.index)
      centroids.loc[cen] = clusterAvg
  return centroids


def kmeans(df, k, feature_cols, verbose, random_state=1):
  flagConvergence = False
  maxIter = 100
  iter = 0  # ensure kmeans doesn't run for ever
  centroids = initCentroids(df, k, feature_cols)
  while not (flagConvergence):
    iter += 1
    #Save old mapping of points to centroids
    oldMapping = df['centroid'].copy(deep=True)
    # Perform k-means
    df = pt2centroid(df, centroids, feature_cols)
    centroids = recomputeCentroids(df, centroids, feature_cols)
    # Check convergence by comparing [oldMapping, newMapping]
    newMapping = df['centroid']
    flagConvergence = all(oldMapping == newMapping)
    if verbose == 1:
      print ('Total distance:' + str(np.sum(df['pt2centroid'])))
    if (iter > maxIter):
      print ('k-means did not converge! Reached maximum iteration limit of ' \
            + str(maxIter) + '.')
      sys.exit()
      return
  print ('k-means converged for ' + str(k) + ' clusters' + \
        ' after ' + str(iter) + ' iterations!')
  return [df, centroids]
In [ ]:
k = 8

feature_cols = datamart_normalized_tf.columns.values  # save original columns
# initialize every point to an impossible value, the k+1 cluster
datamart_normalized_tf['centroid'] = k
# init the point to centroid distance to an impossible value "2" (>1)
datamart_normalized_tf['pt2centroid'] = 2
[datamart_normalized_tf, centroids] = kmeans(datamart_normalized_tf, k, feature_cols, 1)
print("Data for the first few owners, with 'centroid' and 'pt2centroid' on"
      ' the extreme right:')
datamart_normalized_tf.head(10)
Total distance:124.90801373117836
Total distance:114.23291160813922
Total distance:112.147806646324
Total distance:111.24081037222089
Total distance:110.6464402450342
Total distance:109.9788787032827
Total distance:109.50120066284637
Total distance:108.99778022037843
Total distance:108.2091633838039
Total distance:107.66105054279147
Total distance:107.42768244550098
Total distance:107.27007461520606
Total distance:107.20043517478827
Total distance:107.12991360660016
Total distance:107.07682683269357
k-means converged for 8 clusters after 15 iterations!
Data for the first few owners, with 'centroid' and 'pt2centroid' on the extreme right:
Out[ ]:
Recency MonetaryValue Tenure centroid pt2centroid
0 0.862854 0.074403 0.524724 0 0.042031
1 0.878448 0.605044 0.725217 6 0.107176
2 0.605364 0.376618 0.282985 2 0.070437
3 0.962934 0.367582 0.666536 5 0.151036
4 0.504527 0.343799 0.725217 7 0.113967
5 0.781287 0.646879 0.449337 6 0.088609
6 0.479636 0.074403 0.184137 2 0.148626
7 0.320161 0.476067 0.172600 3 0.080876
8 0.922701 0.591370 0.738158 6 0.125208
9 0.156190 0.883191 0.822881 1 0.052999

K-means is converged for 7 clusters after 13 iterations and clusters and distances are listed.

In [ ]:
def clusterCardinality(df, random_state=1):
  k = np.max(df['centroid']) + 1
  #k = k.astype(float)
  print ('Number of clusters:' + str(k))
  clCard = np.zeros(k)
  for kk in range(k):
    clCard[kk] = np.sum(df['centroid'] == kk)
  clCard = clCard.astype(float)
  # print "Cluster Cardinality:"+str(clCard)
  plt.figure()
  plt.bar(range(k), clCard)
  plt.title('Cluster Cardinality')
  plt.xlabel('Cluster Number: ' + str(0) + ' to ' + str(k - 1))
  plt.ylabel('Points in Cluster')
  return clCard


def clusterMagnitude(df, random_state=1):
  k = np.max(df['centroid']) + 1
  #k = k.astype(float)
  cl = np.zeros(k)
  clMag = np.zeros(k)
  for kk in range(k):
    idx = np.where(df['centroid'] == kk)
    idx = idx[0]
    clMag[kk] = np.sum(df.loc[idx, 'pt2centroid'])
  # print "Cluster Magnitude:",clMag #precision set using np pref
  plt.figure()
  plt.bar(range(k), clMag)
  plt.title('Cluster Magnitude')
  plt.xlabel('Cluster Number: ' + str(0) + ' to ' + str(k - 1))
  plt.ylabel('Total Point-to-Centroid Distance')
  return clMag


def plotCardVsMag(clCard, clMag, random_state=1):
  plt.figure()
  plt.scatter(clCard, clMag)
  plt.xlim(xmin=0)
  plt.ylim(ymin=0)
  plt.title('Magnitude vs Cardinality')
  plt.ylabel('Magnitude')
  plt.xlabel('Cardinality')


def clusterQualityMetrics(df, random_state=1):
  clCard = clusterCardinality(df)
  clMag = clusterMagnitude(df)
  plotCardVsMag(clCard, clMag)

The first graph shows that how many customers are in each cluster. The expectation is each cluster has a similar number of the customer. In other words, uniform distribution is the best situation. However, there is some fluctuation in the graph. Therefore, some trials could be done with a different number of clusters.

The next graph shows the total point to centroid distance. Again, cluster 0 and cluster 1 have higher values than the others.

The relationship between cluster cardinality and magnitude is shown in the last graph.

In [ ]:
clusterQualityMetrics(datamart_normalized_tf)
Number of clusters:8
In [ ]:
# Plot loss vs number of clusters
def lossVsClusters(kmin, kmax, kstep, data, random_state=1):
  kmax += 1  # include kmax-th cluster in range
  kRange = range(kmin, kmax, kstep)
  loss = np.zeros(len(kRange))
  lossCtr = 0
  for kk in kRange:
    [data, centroids] = kmeans(data, kk, feature_cols, 0)
    loss[lossCtr] = np.sum(data['pt2centroid'])
    lossCtr += 1
  plt.scatter(kRange, loss)
  plt.title('Loss vs Clusters Used')
  plt.xlabel('Number of clusters')
  plt.ylabel('Total Point-to-Centroid Distance')


kmin = 2
kmax = 30  
kstep = 1  
lossVsClusters(kmin, kmax, kstep, datamart_normalized_tf, random_state=1)
k-means converged for 2 clusters after 10 iterations!
k-means converged for 3 clusters after 9 iterations!
k-means converged for 4 clusters after 11 iterations!
k-means converged for 5 clusters after 11 iterations!
k-means converged for 6 clusters after 16 iterations!
k-means converged for 7 clusters after 18 iterations!
k-means converged for 8 clusters after 18 iterations!
k-means converged for 9 clusters after 32 iterations!
k-means converged for 10 clusters after 27 iterations!
k-means converged for 11 clusters after 15 iterations!
k-means converged for 12 clusters after 56 iterations!
k-means converged for 13 clusters after 21 iterations!
k-means converged for 14 clusters after 21 iterations!
k-means converged for 15 clusters after 44 iterations!
k-means converged for 16 clusters after 19 iterations!
k-means converged for 17 clusters after 22 iterations!
k-means converged for 18 clusters after 25 iterations!
k-means converged for 19 clusters after 13 iterations!
k-means converged for 20 clusters after 29 iterations!
k-means converged for 21 clusters after 28 iterations!
k-means converged for 22 clusters after 14 iterations!
k-means converged for 23 clusters after 29 iterations!
k-means converged for 24 clusters after 17 iterations!
k-means converged for 25 clusters after 35 iterations!
k-means converged for 26 clusters after 12 iterations!
k-means converged for 27 clusters after 13 iterations!
k-means converged for 28 clusters after 23 iterations!
k-means converged for 29 clusters after 14 iterations!
k-means converged for 30 clusters after 25 iterations!

The graph above is similar to the elbow method. It gives us some insights to choose the correct number of clusters. According to the graph, 10 is one of the ideal numbers.

TensorFlow

In [ ]:
import tensorflow as tf

num_points = len(datamart_normalized_tf2.index)
dimensions = len(datamart_normalized_tf2. columns)
points = np.random.uniform(0, num_points, [num_points, dimensions])

def input_fn():
  return tf.compat.v1.train.limit_epochs(
      tf.convert_to_tensor(datamart_normalized_tf2, dtype=tf.float32), num_epochs=5)

num_clusters = 8
kmeans = tf.compat.v1.estimator.experimental.KMeans(
    num_clusters=num_clusters, use_mini_batch=False)

# train
num_iterations = 30
previous_centers = None
for _ in range(num_iterations):
  kmeans.train(input_fn)
  cluster_centers = kmeans.cluster_centers()
  if previous_centers is not None:
    print ('delta:', cluster_centers - previous_centers)
  previous_centers = cluster_centers
  print ('score:', kmeans.score(input_fn))
print ('cluster centers:', cluster_centers)

# map the input points to their clusters
cluster_indices = list(kmeans.predict_cluster_index(input_fn))
for i, point in enumerate(points):
  cluster_index = cluster_indices[i]
  center = cluster_centers[cluster_index]
  print ('point:', point, 'is in cluster', cluster_index, 'centered at', center)
INFO:tensorflow:Using default config.
WARNING:tensorflow:Using temporary folder as model directory: /tmp/tmp_heauick
INFO:tensorflow:Using config: {'_model_dir': '/tmp/tmp_heauick', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true
graph_options {
  rewrite_options {
    meta_optimizer_iterations: ONE
  }
}
, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_checkpoint_save_graph_def': True, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/training_util.py:236: Variable.initialized_value (from tensorflow.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Use Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts.
WARNING:tensorflow:From <ipython-input-164-f2d6cb57e48a>:9: limit_epochs (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensors(tensor).repeat(num_epochs)`.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/input.py:112: BaseResourceVariable.count_up_to (from tensorflow.python.ops.resource_variable_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Prefer Dataset.range instead.
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 0...
INFO:tensorflow:Saving checkpoints for 0 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 0...
INFO:tensorflow:loss = 91.16864, step = 0
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 5...
INFO:tensorflow:Saving checkpoints for 5 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 5...
INFO:tensorflow:Loss for final step: 44.109848.
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:29:57
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-5
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14641s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:29:57
INFO:tensorflow:Saving dict for global step 5: global_step = 5, loss = 43.107677, score = 43.107677
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 5: /tmp/tmp_heauick/model.ckpt-5
score: 43.107677
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-5
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/saver.py:1078: get_checkpoint_mtimes (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file utilities to get mtimes.
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 5...
INFO:tensorflow:Saving checkpoints for 5 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 5...
INFO:tensorflow:loss = 43.107677, step = 5
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 11...
INFO:tensorflow:Saving checkpoints for 11 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 11...
INFO:tensorflow:Loss for final step: 39.71161.
delta: [[-0.00260174  0.0138006  -0.02019686]
 [-0.12495124 -0.09327501 -0.11192682]
 [-0.01198965 -0.02061504  0.12167925]
 [-0.01359883  0.05545366 -0.0780713 ]
 [-0.04460347 -0.10111922  0.01462758]
 [-0.05287993  0.06662002 -0.0117489 ]
 [-0.00661774  0.01201814  0.01382345]
 [-0.02630991 -0.00883168 -0.00957322]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:29:58
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-11
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16677s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:29:58
INFO:tensorflow:Saving dict for global step 11: global_step = 11, loss = 39.337906, score = 39.337906
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 11: /tmp/tmp_heauick/model.ckpt-11
score: 39.337906
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-11
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 11...
INFO:tensorflow:Saving checkpoints for 11 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 11...
INFO:tensorflow:loss = 39.337906, step = 11
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 17...
INFO:tensorflow:Saving checkpoints for 17 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 17...
INFO:tensorflow:Loss for final step: 38.409523.
delta: [[ 0.00152242  0.00512376 -0.00922465]
 [-0.03710169 -0.01171671 -0.02680486]
 [-0.04214174 -0.0352186   0.01272064]
 [-0.0166482   0.04644346 -0.06273165]
 [-0.06212908 -0.05100894  0.00214583]
 [-0.01345387  0.0441263   0.01136518]
 [-0.00396882  0.01610243  0.04615432]
 [ 0.00635993  0.00863624  0.01766437]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:29:59
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-17
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16191s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:29:59
INFO:tensorflow:Saving dict for global step 17: global_step = 17, loss = 38.256805, score = 38.256805
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 17: /tmp/tmp_heauick/model.ckpt-17
score: 38.256805
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-17
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 17...
INFO:tensorflow:Saving checkpoints for 17 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 17...
INFO:tensorflow:loss = 38.256805, step = 17
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 23...
INFO:tensorflow:Saving checkpoints for 23 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 23...
INFO:tensorflow:Loss for final step: 37.556103.
delta: [[-0.00024027  0.00053112 -0.0016461 ]
 [-0.00244188  0.00311106  0.00603962]
 [-0.02136782 -0.04337412 -0.00691879]
 [-0.0507828   0.06316054 -0.03097123]
 [ 0.00644237 -0.01251858  0.00218046]
 [ 0.00899559 -0.0213016  -0.01170903]
 [ 0.00621016  0.01469678  0.06369466]
 [-0.00376356  0.00038302  0.00179344]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:29:59
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-23
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16959s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:00
INFO:tensorflow:Saving dict for global step 23: global_step = 23, loss = 37.444782, score = 37.444782
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 23: /tmp/tmp_heauick/model.ckpt-23
score: 37.444782
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-23
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 23...
INFO:tensorflow:Saving checkpoints for 23 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 23...
INFO:tensorflow:loss = 37.444782, step = 23
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 29...
INFO:tensorflow:Saving checkpoints for 29 into /tmp/tmp_heauick/model.ckpt.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow/python/training/saver.py:971: remove_checkpoint (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to delete files with this prefix.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 29...
INFO:tensorflow:Loss for final step: 37.081383.
delta: [[ 0.00040942  0.00253977 -0.00083506]
 [ 0.01344222  0.01786515  0.02483606]
 [-0.00268382 -0.01992303 -0.00272596]
 [-0.03016919  0.0327335  -0.00292367]
 [ 0.02193815 -0.00833368 -0.00377679]
 [ 0.00419885 -0.02918217 -0.00899541]
 [ 0.0062727   0.00308061  0.04135418]
 [-0.00384724  0.00359076  0.00097358]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:00
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-29
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15294s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:01
INFO:tensorflow:Saving dict for global step 29: global_step = 29, loss = 37.069798, score = 37.069798
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 29: /tmp/tmp_heauick/model.ckpt-29
score: 37.069798
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-29
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 29...
INFO:tensorflow:Saving checkpoints for 29 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 29...
INFO:tensorflow:loss = 37.069798, step = 29
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 35...
INFO:tensorflow:Saving checkpoints for 35 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 35...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[ 0.0000000e+00  0.0000000e+00  0.0000000e+00]
 [ 1.3689399e-03  1.9043684e-05  8.4286928e-04]
 [ 0.0000000e+00  0.0000000e+00  0.0000000e+00]
 [ 0.0000000e+00  0.0000000e+00  0.0000000e+00]
 [ 0.0000000e+00  0.0000000e+00  0.0000000e+00]
 [ 5.7524443e-04 -1.5429854e-03  1.9387901e-04]
 [ 0.0000000e+00  0.0000000e+00  0.0000000e+00]
 [ 0.0000000e+00  0.0000000e+00  0.0000000e+00]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:01
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-35
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14778s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:01
INFO:tensorflow:Saving dict for global step 35: global_step = 35, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 35: /tmp/tmp_heauick/model.ckpt-35
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-35
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 35...
INFO:tensorflow:Saving checkpoints for 35 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 35...
INFO:tensorflow:loss = 37.069122, step = 35
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 41...
INFO:tensorflow:Saving checkpoints for 41 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 41...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:02
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-41
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15715s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:02
INFO:tensorflow:Saving dict for global step 41: global_step = 41, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 41: /tmp/tmp_heauick/model.ckpt-41
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-41
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 41...
INFO:tensorflow:Saving checkpoints for 41 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 41...
INFO:tensorflow:loss = 37.069122, step = 41
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 47...
INFO:tensorflow:Saving checkpoints for 47 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 47...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:03
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-47
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14960s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:03
INFO:tensorflow:Saving dict for global step 47: global_step = 47, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 47: /tmp/tmp_heauick/model.ckpt-47
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-47
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 47...
INFO:tensorflow:Saving checkpoints for 47 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 47...
INFO:tensorflow:loss = 37.069122, step = 47
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 53...
INFO:tensorflow:Saving checkpoints for 53 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 53...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:04
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-53
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15938s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:04
INFO:tensorflow:Saving dict for global step 53: global_step = 53, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 53: /tmp/tmp_heauick/model.ckpt-53
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-53
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 53...
INFO:tensorflow:Saving checkpoints for 53 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 53...
INFO:tensorflow:loss = 37.069122, step = 53
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 59...
INFO:tensorflow:Saving checkpoints for 59 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 59...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:05
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-59
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14840s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:05
INFO:tensorflow:Saving dict for global step 59: global_step = 59, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 59: /tmp/tmp_heauick/model.ckpt-59
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-59
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 59...
INFO:tensorflow:Saving checkpoints for 59 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 59...
INFO:tensorflow:loss = 37.069122, step = 59
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 65...
INFO:tensorflow:Saving checkpoints for 65 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 65...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:06
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-65
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14324s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:06
INFO:tensorflow:Saving dict for global step 65: global_step = 65, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 65: /tmp/tmp_heauick/model.ckpt-65
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-65
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 65...
INFO:tensorflow:Saving checkpoints for 65 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 65...
INFO:tensorflow:loss = 37.069122, step = 65
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 71...
INFO:tensorflow:Saving checkpoints for 71 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 71...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:07
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-71
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16520s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:07
INFO:tensorflow:Saving dict for global step 71: global_step = 71, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 71: /tmp/tmp_heauick/model.ckpt-71
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-71
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 71...
INFO:tensorflow:Saving checkpoints for 71 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 71...
INFO:tensorflow:loss = 37.069122, step = 71
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 77...
INFO:tensorflow:Saving checkpoints for 77 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 77...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:08
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-77
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16872s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:08
INFO:tensorflow:Saving dict for global step 77: global_step = 77, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 77: /tmp/tmp_heauick/model.ckpt-77
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-77
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 77...
INFO:tensorflow:Saving checkpoints for 77 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 77...
INFO:tensorflow:loss = 37.069122, step = 77
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 83...
INFO:tensorflow:Saving checkpoints for 83 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 83...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:09
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-83
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.17368s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:09
INFO:tensorflow:Saving dict for global step 83: global_step = 83, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 83: /tmp/tmp_heauick/model.ckpt-83
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-83
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 83...
INFO:tensorflow:Saving checkpoints for 83 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 83...
INFO:tensorflow:loss = 37.069122, step = 83
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 89...
INFO:tensorflow:Saving checkpoints for 89 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 89...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:10
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-89
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.17249s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:11
INFO:tensorflow:Saving dict for global step 89: global_step = 89, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 89: /tmp/tmp_heauick/model.ckpt-89
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-89
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 89...
INFO:tensorflow:Saving checkpoints for 89 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 89...
INFO:tensorflow:loss = 37.069122, step = 89
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 95...
INFO:tensorflow:Saving checkpoints for 95 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 95...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:11
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-95
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16008s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:12
INFO:tensorflow:Saving dict for global step 95: global_step = 95, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 95: /tmp/tmp_heauick/model.ckpt-95
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-95
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 95...
INFO:tensorflow:Saving checkpoints for 95 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 95...
INFO:tensorflow:loss = 37.069122, step = 95
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 101...
INFO:tensorflow:Saving checkpoints for 101 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 101...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:12
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-101
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.17285s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:13
INFO:tensorflow:Saving dict for global step 101: global_step = 101, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 101: /tmp/tmp_heauick/model.ckpt-101
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-101
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 101...
INFO:tensorflow:Saving checkpoints for 101 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 101...
INFO:tensorflow:loss = 37.069122, step = 101
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 107...
INFO:tensorflow:Saving checkpoints for 107 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 107...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:13
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-107
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15890s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:13
INFO:tensorflow:Saving dict for global step 107: global_step = 107, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 107: /tmp/tmp_heauick/model.ckpt-107
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-107
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 107...
INFO:tensorflow:Saving checkpoints for 107 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 107...
INFO:tensorflow:loss = 37.069122, step = 107
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 113...
INFO:tensorflow:Saving checkpoints for 113 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 113...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:14
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-113
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15735s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:14
INFO:tensorflow:Saving dict for global step 113: global_step = 113, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 113: /tmp/tmp_heauick/model.ckpt-113
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-113
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 113...
INFO:tensorflow:Saving checkpoints for 113 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 113...
INFO:tensorflow:loss = 37.069122, step = 113
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 119...
INFO:tensorflow:Saving checkpoints for 119 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 119...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:15
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-119
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15252s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:15
INFO:tensorflow:Saving dict for global step 119: global_step = 119, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 119: /tmp/tmp_heauick/model.ckpt-119
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-119
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 119...
INFO:tensorflow:Saving checkpoints for 119 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 119...
INFO:tensorflow:loss = 37.069122, step = 119
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 125...
INFO:tensorflow:Saving checkpoints for 125 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 125...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:16
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-125
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14702s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:16
INFO:tensorflow:Saving dict for global step 125: global_step = 125, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 125: /tmp/tmp_heauick/model.ckpt-125
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-125
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 125...
INFO:tensorflow:Saving checkpoints for 125 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 125...
INFO:tensorflow:loss = 37.069122, step = 125
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 131...
INFO:tensorflow:Saving checkpoints for 131 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 131...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:17
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-131
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15940s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:17
INFO:tensorflow:Saving dict for global step 131: global_step = 131, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 131: /tmp/tmp_heauick/model.ckpt-131
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-131
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 131...
INFO:tensorflow:Saving checkpoints for 131 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 131...
INFO:tensorflow:loss = 37.069122, step = 131
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 137...
INFO:tensorflow:Saving checkpoints for 137 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 137...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:18
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-137
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.14358s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:18
INFO:tensorflow:Saving dict for global step 137: global_step = 137, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 137: /tmp/tmp_heauick/model.ckpt-137
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-137
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 137...
INFO:tensorflow:Saving checkpoints for 137 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 137...
INFO:tensorflow:loss = 37.069122, step = 137
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 143...
INFO:tensorflow:Saving checkpoints for 143 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 143...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:19
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-143
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.20305s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:19
INFO:tensorflow:Saving dict for global step 143: global_step = 143, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 143: /tmp/tmp_heauick/model.ckpt-143
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-143
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 143...
INFO:tensorflow:Saving checkpoints for 143 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 143...
INFO:tensorflow:loss = 37.069122, step = 143
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 149...
INFO:tensorflow:Saving checkpoints for 149 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 149...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:20
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-149
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.17257s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:20
INFO:tensorflow:Saving dict for global step 149: global_step = 149, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 149: /tmp/tmp_heauick/model.ckpt-149
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-149
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 149...
INFO:tensorflow:Saving checkpoints for 149 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 149...
INFO:tensorflow:loss = 37.069122, step = 149
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 155...
INFO:tensorflow:Saving checkpoints for 155 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 155...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:21
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-155
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15571s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:21
INFO:tensorflow:Saving dict for global step 155: global_step = 155, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 155: /tmp/tmp_heauick/model.ckpt-155
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-155
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 155...
INFO:tensorflow:Saving checkpoints for 155 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 155...
INFO:tensorflow:loss = 37.069122, step = 155
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 161...
INFO:tensorflow:Saving checkpoints for 161 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 161...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:22
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-161
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.16129s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:22
INFO:tensorflow:Saving dict for global step 161: global_step = 161, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 161: /tmp/tmp_heauick/model.ckpt-161
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-161
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 161...
INFO:tensorflow:Saving checkpoints for 161 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 161...
INFO:tensorflow:loss = 37.069122, step = 161
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 167...
INFO:tensorflow:Saving checkpoints for 167 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 167...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:23
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-167
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15569s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:23
INFO:tensorflow:Saving dict for global step 167: global_step = 167, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 167: /tmp/tmp_heauick/model.ckpt-167
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-167
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 167...
INFO:tensorflow:Saving checkpoints for 167 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 167...
INFO:tensorflow:loss = 37.069122, step = 167
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 173...
INFO:tensorflow:Saving checkpoints for 173 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 173...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:24
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-173
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15662s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:24
INFO:tensorflow:Saving dict for global step 173: global_step = 173, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 173: /tmp/tmp_heauick/model.ckpt-173
score: 37.069122
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Create CheckpointSaverHook.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-173
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 173...
INFO:tensorflow:Saving checkpoints for 173 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 173...
INFO:tensorflow:loss = 37.069122, step = 173
INFO:tensorflow:Calling checkpoint listeners before saving checkpoint 179...
INFO:tensorflow:Saving checkpoints for 179 into /tmp/tmp_heauick/model.ckpt.
INFO:tensorflow:Calling checkpoint listeners after saving checkpoint 179...
INFO:tensorflow:Loss for final step: 37.069122.
delta: [[0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]
 [0. 0. 0.]]
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Starting evaluation at 2021-08-19T07:30:25
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-179
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Evaluation [1/1]
INFO:tensorflow:Inference Time : 0.15121s
INFO:tensorflow:Finished evaluation at 2021-08-19-07:30:25
INFO:tensorflow:Saving dict for global step 179: global_step = 179, loss = 37.069122, score = 37.069122
INFO:tensorflow:Saving 'checkpoint_path' summary for global step 179: /tmp/tmp_heauick/model.ckpt-179
score: 37.069122
cluster centers: [[0.8554402  0.13945478 0.53941685]
 [0.52165204 0.22390209 0.29455298]
 [0.4771761  0.59001285 0.8061129 ]
 [0.28734505 0.6525521  0.4562684 ]
 [0.7346158  0.2859749  0.8167916 ]
 [0.27099857 0.4127391  0.16009527]
 [0.20073912 0.81520975 0.7909413 ]
 [0.783745   0.5368648  0.5489363 ]]
WARNING:tensorflow:Input graph does not use tf.data.Dataset or contain a QueueRunner. That means predict yields forever. This is probably a mistake.
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Graph was finalized.
INFO:tensorflow:Restoring parameters from /tmp/tmp_heauick/model.ckpt-179
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
point: [926.05918647 185.79252586 334.42990162] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [101.67664948 792.07659552 416.56957073] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [926.23420999 960.29400772 397.97570044] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 987.34768696   68.47601351 1024.63910695] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [261.39063123 588.63466103 733.44089129] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [331.9405482    0.96382163 388.37509972] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [442.15657252 682.49448458 338.87423757] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 67.51114375 513.51493051 618.70950421] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [906.69412026 513.97526373 464.04611012] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [550.82185352 856.88558312 897.67897503] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [271.06178318 987.43884255 340.89909158] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [142.19930589 360.19766974 174.5024323 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [511.67003921 619.77251607 849.77086109] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [982.89891658  10.87594989   3.58980697] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 619.31024683  656.74571008 1083.62925619] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [900.0618952  483.27831669  46.02743545] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [233.04644445 925.52231562 749.21150388] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [107.2153742  882.93960376 909.11916038] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [766.67692801  63.9078534  807.05074648] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [328.53522962 538.52166744 448.95313492] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [104.71131699 814.09517981 576.18797895] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 46.89326405 520.38413042 853.99168883] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [442.38371012 357.73220021 247.89104102] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [443.53855744 983.1811299  942.3620461 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [433.36796683 545.10466494 457.9190282 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [656.15885458 340.58760595 720.5989086 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [596.88622474 200.05123857 463.51503467] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [912.7827943  277.64654333 552.97744363] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [878.1964282  118.41081999 545.38719171] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [438.85932923 339.97675674 647.0618839 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [804.56335276 175.50055651 700.6594175 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 42.96482736 432.24140231 368.94058614] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [917.35163226 419.38395042  55.30904094] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [619.52774964 408.02508357 847.66778437] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [765.96316    206.73880304 417.72663888] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [968.1674802  756.09601899 601.20171029] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 433.43201112  995.99920728 1023.06009085] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [251.3345765  565.74936227 899.71889146] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 657.27095414  790.36551179 1008.14773334] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 78.53180616 521.26409599  54.96487785] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [1063.63833859   78.456047    453.7300065 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1019.55126286  226.3135895    58.60801727] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [604.36559964 478.1366323  557.13310985] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1011.76821103  618.78263526  719.21955732] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [914.08480265 499.90286002 306.1546351 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [1020.29041193  339.21392807 1041.81727272] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 849.59156682 1077.20056111  611.81154955] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [839.41069718 558.96517398 933.28104425] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [969.47592328 256.6791446  791.60556639] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 647.99188906 1026.47089316  678.38610764] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [764.54016538 461.23291593 582.77132151] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [301.48674218 829.07511932 360.61283147] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [727.64190268 763.23038077 618.89291538] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  49.13148929 1066.65177312   14.74867065] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 621.67874217 1035.61322109  519.92046322] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [935.74598539 573.62857932 378.37658805] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1019.51900086  559.03752701  604.00681327] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [152.57309532 609.70760634 592.35215259] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [983.25772308 491.45930266  18.99123651] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [723.37427899 255.77987068 849.45274671] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1062.93323417  565.31613026  967.96067926] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [878.45670336 903.28185218 273.11694304] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [442.3311999   84.06252223 511.37729619] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 392.82688535 1003.88553079  180.98780766] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 17.73829824 377.66213911 350.48045211] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [767.99970357  30.67415538 373.80100147] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [342.32692667 224.37880915 488.40735788] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [508.7786224  661.39823895  30.40167244] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [387.45925506 910.92555598 754.95274183] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [723.24377042 504.42006824 200.18137533] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [653.02315865 200.97227594  14.27586648] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 93.13728752 259.97763094  69.98094197] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [599.28296565 147.10192609 993.50489297] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 391.04771681 1008.49683855  410.15745278] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 706.92896925 1021.29212213   27.73686083] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1076.47309709  100.21090906   66.36924823] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 502.49431255 1009.50121378 1028.56060801] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [589.56241017 586.42378046 946.08764513] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [490.59964417 639.37860114 843.13570916] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 29.00723738 969.62378875 907.50847794] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 358.07897688 1074.54612563  453.02247818] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [209.08523025 350.91369969 798.00016463] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 873.48552808 1004.28467302  448.79096755] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [828.3226803  805.94700341 356.3798845 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [179.78393812 311.36578978 610.61920831] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1031.23395614  678.05248739  436.00858073] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [581.63738992 589.46830937 406.98356086] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [919.36764024 196.11109075 226.22292989] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1043.77520318  589.74520427  792.38989863] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [287.20835059 836.27987619 700.60129539] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1080.68634642  931.55169492   14.78521343] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [774.43773537 741.85971193 354.33123082] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 300.04117972 1069.98226964 1071.66814321] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [208.16583701 773.29572481 128.12041804] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [237.895803   526.58602277 901.01359138] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [763.3712161  421.99115719 623.02507873] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 375.42702525  762.05991379 1034.21045203] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [162.60970413 706.23836634 633.44389362] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [570.62414035 138.67649889 160.55117768] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [353.75845567 248.65858442  26.98685782] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [266.26949801 630.48212589  15.37828352] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 962.60417271  229.39747917 1063.60277973] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [881.74579885 573.50189432 574.26028301] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 762.47698113   79.61095178 1057.32990488] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [442.56037737 141.9294921  180.18350093] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [215.12046843 821.94445364 886.13734661] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [339.40297398 460.23916851 164.01064188] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [782.27948971 646.28966313 380.99862932] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [280.77917715 605.80705593 810.37471535] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1037.16443989  942.71231528  442.14466198] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1015.78258996  825.66182307  559.59154031] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [797.52423314  47.92336409 525.74548363] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [238.08996002 946.57093611 187.7244149 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [847.23658514 395.48318136 200.42247535] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [138.58161237 504.83665603 408.15384026] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [210.2212405  818.38937143 272.45722696] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [575.00020035 330.30226844 376.74088012] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [595.5175686    5.54091184 689.93292757] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 941.84393762  136.22873142 1026.30499495] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [110.721031   834.05604937 578.15124225] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [557.89720234 947.46592456 338.6775671 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [369.81608353  67.13757065 527.23158687] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [500.22194326 749.79606096 837.54519601] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [104.3931472  381.36614982 971.60230983] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [620.48522932 828.16839454 590.28028204] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [155.82563772 273.55660552 847.51691073] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 678.29551527  300.82348059 1073.00216165] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [821.21309292 342.62922671 669.6241895 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 18.71842638 260.23389092 936.78800031] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [129.71982065 536.3521389  925.44794894] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1060.08940569  701.48623032  914.76228975] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 94.6373607  675.28254157 924.77919324] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [856.32788174 193.94059186 220.40589086] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [936.80452738 789.6602236  476.82184793] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [370.83510621 743.01084484 232.30719197] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  40.81504541 1076.49445202 1050.46047995] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [770.75701308 800.37028575 854.53131519] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [709.48822346 854.68830673 862.41141695] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [345.63772946 324.53399365 131.19240768] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 983.7235381   968.59199857 1047.93931658] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 897.33471434 1027.16128582  506.93592552] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 991.17103236 1040.96064774  894.52328155] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [463.69405093 501.17082296 853.50110221] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [546.88255093 537.03047814 418.85407931] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [886.25762703 876.68415825 551.17805497] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 45.35298105 236.65898825 223.39307149] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [454.54877162 776.76034939 971.77356021] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [543.49006787 831.29626189 452.58892553] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [806.57905901 354.22511199 925.42854812] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [832.76395152  51.78545501 270.950988  ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [741.42639136 691.18809564 331.14231639] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [421.50412282 652.59269707 968.01103883] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 280.63948316 1061.11903638  851.18585147] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 582.19960844 1038.46766012  715.94744915] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 387.24922671 1015.4518045   741.1099999 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [863.16799245 630.09352036 783.09927232] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1063.8233557   484.46027587  722.12061169] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [753.3668115  196.56042441 490.29530384] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 807.17438143 1050.74261768  793.4023072 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 537.46434286  744.42093933 1061.07376953] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [864.29966438 504.9087051  336.80387041] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [477.82666902 389.95400839 197.85782424] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [275.711625   180.6651425  834.49257834] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [240.89389277 790.28317844 425.52327082] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [310.47260454  44.24591874 651.62112218] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [637.43055073 681.76480912 511.45328143] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1079.55008647  716.80005303  983.60807147] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 110.45260701  843.46339342 1001.53102003] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [433.20884974 322.23159794 545.92546503] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [822.58782828 455.87253005 350.88544594] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 22.46614293 261.38838533 756.74402859] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [144.79545296 286.10463456 457.57672507] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [997.86705293 322.84865008 943.33539314] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [208.32053538 332.08189257 568.00955733] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [167.56085422 520.58511732 634.14070098] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1060.50478063  618.88086565  273.30092288] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [874.38523907 246.36773254 667.96787263] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 963.35588012 1066.31108228  280.02242062] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 250.73069083  582.15029435 1065.574154  ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 27.36622206  63.84097379 779.28681095] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [106.28923273 274.40215475 156.9900633 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 900.12797755  765.02415807 1028.61520574] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [280.79381894  88.5783445  397.76720204] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [896.60671416 704.82008949 481.23058576] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [881.31582068 842.64608252 276.1978556 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [270.13919032 644.49841139 617.10857104] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 30.68352266 845.8373728  387.2834322 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [433.31196564 475.74923251 327.75882351] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1058.25154299  537.77187728  673.97352421] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [112.41106666 793.91921287 707.90917111] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [151.29117812 775.75739383 372.11862682] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [848.65996302  42.64429053 456.5875548 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [192.66111495 106.24646435 299.77106443] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [959.0339896 889.5181061 268.671041 ] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 376.61621546    8.55883329 1069.49463224] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [540.03157356 494.31199652 125.9281714 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [940.93951198 876.82310774  40.97229382] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [108.11342917 148.83163888 459.96911272] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 81.46496449 362.34897792 138.98258244] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [720.47498035 375.5035872  753.80746595] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [696.04182873 211.96275097  33.74351294] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 937.18534158   97.84137431 1074.52327727] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [894.39881155 746.03590308 833.65611951] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [265.52830008 951.10951019 810.39218614] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1004.42753586  301.05741661  580.47292178] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [962.77840375 590.3392218  913.51237459] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [885.4548226   28.61569531 973.98218427] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [545.53518501  88.13058521 933.15437798] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [498.25254496 466.59112552 223.00297893] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [571.49121517 944.12213811 590.32762432] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [219.44674031 145.25813103 227.51245788] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [795.67354443 977.634338   781.28763109] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 23.50669292   6.69068803 913.39216686] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [835.88907607  47.43031425   5.75578729] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [571.06521581 355.66781353 671.6947754 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [515.52425147 224.74656384 888.26489175] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1058.7866525   635.21616467  247.67465627] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [757.49211294 955.92816131 328.95674685] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1004.94112993   83.50889588  262.93193067] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [901.78461383 695.15973578 502.49017592] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [859.78868304  52.29136728 558.85980999] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [  82.53242266 1026.06760834  745.17167879] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [137.26527867 217.59733533 771.84051352] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 41.02293201 427.92851962 832.90513717] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [339.52679305 380.48935438 507.87902213] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [875.72670991 463.26618326 614.20949919] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 36.03203717 476.31480881  70.42677272] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [621.41972873 110.73709581 682.8746307 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [755.69185139 641.23213533 598.03958485] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1020.64809113    6.66976496  748.41032285] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [805.06270354 503.81072503 715.49291579] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [782.07415073 246.43033741 108.87675732] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [161.17157463 635.29845201 652.97096833] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [107.02540704 988.68577064 304.80265098] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [724.31585579 921.35313832 165.05980705] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 830.06040246  960.59383317 1084.68506984] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [235.37233402 118.46595657 910.20450003] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1060.64761526  416.85576069  567.71881808] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [479.67836822 676.78352772 335.23357235] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [980.39237707 447.08128107 440.89601425] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [  48.31792516  581.99792218 1011.87790938] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [465.10859898 669.74738018 252.32850066] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [673.17967483 857.73427268 395.69770579] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [709.30430982 290.77524168 639.552176  ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [812.53343686 604.10895185 443.91854159] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1001.33853163   95.55726243  538.7649478 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [327.75299763 919.78595437 612.4697737 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [351.63949495 139.5463475   14.60239436] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  8.89055929 274.69531183 277.34735626] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [880.76015139  42.7874441  528.62661676] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [443.59185284 388.46188826 291.71644034] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [345.62418215 926.99697868  51.51873422] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [330.90503045 224.7174176  202.0309813 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [445.42683119 593.80015627 226.51027641] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [130.45501286 124.064336   263.91358355] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [440.32074572 581.8971902  691.2409789 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [850.12176526 879.56079835 707.29782224] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [360.68491956 929.73847512 614.00385652] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [885.75383716 997.85286009 625.24859809] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [667.93109349 981.81854402 226.16122671] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 724.51216644 1024.27244989  320.9180495 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [772.88348479 874.36261869 125.18956618] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [  25.47817586 1061.01135381  579.13071191] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1006.3318628   342.85959515  647.47405889] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [649.18493223 174.38663264 477.87661897] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [986.96303959 534.47450466  54.98419658] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [531.55683607 103.25294742 827.38745544] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [401.99335818 772.64088905 440.71936171] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [892.15858373 607.02839663 728.32994757] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [5.67418847e-01 7.69151703e+02 7.45035415e+02] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 950.69343101 1012.10851036  629.68879485] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [407.15965351 736.46108793 681.65456703] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1034.62718982  446.23996141  918.43332351] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [290.25381439 751.65103044 901.14868443] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [739.91272494 299.85262354 669.77724055] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [270.68509442 664.57421912 660.18564128] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [437.08655929  72.25068842 484.06706284] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [889.57630489 113.83481557 388.60304864] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [152.54140821 153.5793712  168.79496088] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [511.43580797  23.57407159 813.93005284] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [181.96802191 450.43261558 945.40237016] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 69.51270492 501.05522005 193.59532011] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [265.57750772  91.30464972 241.89305137] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [191.10421379 465.92401785 269.80766883] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [697.06735798 349.28916863 404.33475047] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [281.18120079 118.88718033 449.40174094] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [112.70995609 537.70068205 913.57621588] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [445.63724863  26.5558358  586.92427803] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [792.31673428  50.40758514 241.55770606] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [439.78864701 102.24456803 803.19954074] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [102.44333688 922.5321551  700.81056459] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [916.62902933  52.62575359  76.69233741] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [105.29081388 791.95465302 539.18230836] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 575.92937764 1016.71332674  803.99711881] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [801.06877669 249.81327421  45.94500851] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 909.57383499 1072.9217753   986.12312967] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1064.11472908   16.97379551  293.85090178] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [247.56706967 361.07156821 361.30556685] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1051.29499196  867.29677083  542.28609736] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [932.37597564 874.04347874 388.4253352 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [275.61921332 798.67303218  95.28462845] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  7.13921196 566.05602795 978.22870138] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 79.89329453 220.77312897 419.13904129] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [327.83221707 614.96504261 999.15369346] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 55.66157426 237.55681627 200.03583543] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 48.68263042 446.25526796 921.66269774] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [388.17176393 418.80018164 166.09042985] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [228.3762585  614.72751995   1.42538441] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [919.14642136 484.32274958 296.36260019] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 134.35446519 1051.65146534  406.05480982] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [538.36389462 944.10676963 284.51572955] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [429.19048572  81.67364442 971.04001259] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [228.67142005 520.47885207  98.70988355] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [167.82136307 193.5809226  832.88796167] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1046.5775577   130.53828088  511.05878832] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [405.65851059 888.39713743 540.06302945] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1045.41714481  246.47681831  470.14785573] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [204.79757556 342.3286458  330.32060449] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [829.91989748 172.57945025 915.83295352] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [114.6924848  553.96202778 975.85363418] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 183.5420699  1068.70390001  927.38163356] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 224.25851804 1080.96774626   19.98031664] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [894.49713585 229.8393825  532.77907125] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [625.37716382 400.56157209 885.56380693] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [505.8080328  668.17506497 750.59498818] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 636.94224718  684.83293935 1077.59356407] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [939.65905348 597.3905511  162.1667763 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [480.20064421 601.99543148 929.64778532] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1062.59299455 1014.12095014 1040.1300846 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [737.95026893 705.74677932 960.56770474] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [871.44774641 594.64189809 651.6302433 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [711.87805808 693.60512761 750.20447146] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 852.06311147 1061.14754788  503.54470913] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [851.13980754 785.23692418 208.76960423] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 67.77727415 769.62864497 855.03909328] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [608.07217711 960.88574636  70.62438024] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 801.72331945  741.98266637 1043.95053419] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 720.3123026  1033.05192299  127.79332267] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 182.50215407  952.00357005 1034.14206684] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [473.95909233 671.91545592 327.50097459] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1069.96645869  421.6971503   560.61754905] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [860.57187368 398.46469188 435.93914545] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [275.25544945 812.96091232 587.27568205] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [950.8643228  900.11424983 438.61241415] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [876.43155694 343.51282578 928.27340263] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [1064.58870248  888.8028034   690.40393016] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [553.52414102 270.32561528 380.14358195] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [162.88085537 376.09977538 894.08412182] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [436.27201646 199.32370738 511.76672493] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [586.32151032 331.67473566 814.16275995] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [206.26170294 794.18666872 257.29413155] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 52.27564577 483.86753247 536.03441852] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [175.68220051 846.99656716 377.58724008] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [126.1617937  587.76321151 869.16412531] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1039.06892751  213.67249003  154.09781005] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [736.88378502 394.19505811 597.87711392] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [1033.44006689  873.440114    789.82328651] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 73.55102487  98.60114015 475.80896602] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [425.30391725 232.13186406 395.41357553] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 228.12681672  375.45748256 1077.71945445] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 108.65332559   64.12245586 1073.40828194] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [997.46444314  47.53257738 228.52152053] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [656.95643258 192.35432253 849.32178145] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [651.50416777 466.22912101 922.57178406] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [374.41539545 403.90815173 415.70263288] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [790.53595758 666.89784448 199.01667205] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [605.29610516  86.50393986 622.69983205] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [487.56765126 963.4061073  461.25377333] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [642.05059901 695.63691794 899.85846012] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 886.73919462 1013.50399932   87.40975196] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [795.76851405 942.30894893 869.23506238] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [418.78133689 873.55352012 385.06432792] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [298.28567152 759.17980957 460.01778099] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [863.28700624 569.58961133 195.32509773] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 487.07412803  456.40478583 1043.80534081] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 487.52004114 1063.63874955  131.97634223] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [300.5771658  959.74428538 472.44434139] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 25.20380884 611.5052979  904.65272567] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 590.60249642 1082.40940415   18.48883966] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 730.72286652 1074.06345397   76.00963269] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [  6.21982116 506.65032282 480.46449454] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [478.29565763 277.87033082 472.14010134] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [558.53400201 543.48528163  28.54692472] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 347.17786865 1081.46539695  232.66322283] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [528.86847521 690.37176117 492.6400125 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [956.4145826  259.32353584 113.21005391] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 619.30161753 1084.54650589   33.40553891] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [666.8520546  856.96604356  33.66525926] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1005.62499055  136.00208699  502.74748897] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [123.96706709 775.55870471 203.17844702] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [753.75942971 540.2833351  202.89070825] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [270.06510949 696.20382919 534.99957218] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [598.79173064 999.37383856 841.4425676 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [409.15940395 773.86422484 762.67021662] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [838.34665969 385.67815796 422.96469822] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 841.51906928  241.70064803 1052.55721007] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [566.93174086 289.25787547 936.61275141] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [379.12423575 799.86379733 806.92654143] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 986.30273107 1017.12604588   78.518412  ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [589.16203083 599.17167206 804.52625575] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 621.8071047  1051.15420131  911.74343921] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [362.12879757 148.57244053  75.30407303] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [209.35508113  12.02295472 550.38608004] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [299.54146485 610.42405368 700.3975962 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [573.07755468 979.65457954 149.45239294] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [420.51904076 432.77660419  35.82437615] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [453.08139851 947.47571541 869.26952202] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [676.83484979 433.78748699 499.12913594] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [126.23502599 330.00000298 721.39536395] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [524.12054776  97.83009124 213.57090074] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [880.33901184 782.82619179 716.42520169] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 770.94460358  485.02406678 1007.52728084] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [980.81550985 951.94073359 710.18658393] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 785.70884957  703.42488507 1068.06132725] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [775.46489172 689.70257958 362.96148463] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 737.70404822 1052.77124475  316.4695572 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 23.9627087  137.70454581  15.87405879] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [141.74640627 905.28437876 409.61932734] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 701.3347681  1082.39435915 1023.1838177 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [107.14595086 723.57581485 907.39769991] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 622.04986662 1049.46380111  833.8121612 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [673.9439695  490.15706187 101.57813461] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [323.39003302 393.9232358  719.00627322] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [209.58135148 432.23191207 890.48059532] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [710.83068514 815.74208991 511.78402757] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [548.50593581 131.0750319  677.65250064] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [456.37589625 577.0781952  191.19154758] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [661.40318238 684.8321497  514.88415016] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [718.45775475 189.99823651 932.10429126] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1077.50354513 1019.73594524  547.74756391] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [133.58659502 491.6571042  744.20048314] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [167.97833449 909.64469181 586.54056205] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [248.35749341 726.06920238 657.11204053] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1027.77974479  127.44459464  134.63985678] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 90.03673681 660.12878957 513.60040595] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [669.93540817 583.61269268 859.11948832] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [335.4141209  237.28671313 383.08625248] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [590.62487589 824.13850361 314.10981993] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1080.66047232  848.67128758  445.23071856] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [450.18294591 238.6597109  961.97137589] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [141.41292689 383.27487834 657.52865362] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 928.77706159 1041.2507955   383.57131828] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [989.56420984 808.61480023 237.05390098] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [782.65250731 165.58628701 710.59479932] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [574.96005743 958.71314088 874.47878041] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [330.98828281 207.5668734  460.3395484 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [487.51794068 353.00222011  24.89609738] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [161.88204568 801.26898856 438.33669786] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [275.86205692 705.69532225 811.82352401] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1012.16649734   77.74960896  150.72357398] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 241.17000532  781.8958765  1024.56940132] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1026.88063509  748.89232024  909.97894378] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [245.01579927 696.48947907 823.48589533] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [721.45925536 817.63097128 540.26042637] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [437.47081444 578.53333505 128.77100846] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1025.73553561  946.14947667  463.66537625] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [164.89340378 284.32357049 646.54404383] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [545.22907387 585.86838403 263.37293754] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [  2.39434491 401.27667182  92.40918411] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  91.08517574  775.12237781 1042.54777473] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [892.63266876 511.07826683 232.50418457] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 677.82378525 1005.5332566   607.39092585] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 13.05051355 902.18850119 889.39045445] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1026.95059153  988.56349559  967.74650794] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [937.334551   151.6242303  233.66841577] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [112.48737955  98.0462332  128.7545916 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [764.91414328 682.89392835 329.36470465] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1066.07693792  843.9425276   638.39393122] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1009.50902385  121.76026206 1040.41509786] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [967.26859968  22.75043472 360.35659639] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [903.19389466 974.38393253 724.82187966] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [442.97022152  93.93749296 963.87876176] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [728.3696597  946.78425315 188.33063341] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [211.22781712 204.88587717 432.12523222] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [420.24955773 828.61194485 124.58844812] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 616.59126315 1004.06768165  646.59928187] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1025.09734486  298.42684715  913.11390856] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [208.715363   697.66207061 527.28942642] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [418.20295769 583.94784966 139.21873323] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [444.50839978 936.88130286 201.1281595 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [204.32205608 364.14319115 127.24518932] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [433.46931824 506.20675959 466.13552453] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [533.75452717 410.79021297 334.93800037] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [391.15815154 524.31091136 149.53178411] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [125.41964159 113.61978467  79.22509224] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [380.63750163 602.25739296 681.63743833] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 981.07874043  676.34645779 1037.15912728] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [344.72867755 637.39756621 122.60205991] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 484.26496627 1003.1278436  1064.39491603] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [278.73192064 796.66368203 416.00840588] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 715.75456012 1068.70985447  222.06896032] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [615.32328148 174.64095316 962.93608926] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 241.1509053    70.86597184 1040.30274523] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [583.91438209 675.01795624 315.47707788] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 748.28452869  549.45400103 1061.55948459] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [901.35661305 517.07177846 751.12984106] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [905.35634455 257.40256684 567.58001388] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 72.1272958  766.7867753  153.96452507] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [803.675419   570.31128347 699.64960062] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [927.2523332  538.30061357 196.21828908] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [301.11761886 954.73014457 399.31279726] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [244.49976614 532.43324493 757.1722985 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [571.15083624 806.85366918 468.97429622] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [329.31479564 941.068077   566.99319832] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [425.12731557 569.79841606 570.85766693] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [705.05690768  86.30760793 826.08037712] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [314.64186236 186.62064419 934.51778611] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1035.90077599  406.34883989  172.66746722] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 231.14064886  490.43438995 1025.44592939] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 490.10129822  509.02941992 1024.05207872] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [218.93156071 609.06615249 127.65343024] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [501.84293367  26.77359389 967.89378683] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [268.0493929  269.48085962 770.96459617] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [941.37604018 848.51141284  40.09443949] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [807.41109851  48.20336784 125.63752625] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [403.73051065  18.40998751 432.68308057] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [564.95138923 974.67300928 334.02886302] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [783.24281079 334.87766549 323.39505793] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [242.18306482 885.9088104  419.19467057] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [907.85925124 776.05444304 351.00058587] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [116.47444884 676.51062158 825.74597904] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 23.50671171 610.38019529 374.22698914] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 81.77386043 480.10114501  99.93186594] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [158.70052689 328.08427496 924.85907519] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [814.07280674 479.17403523 832.13893816] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [394.2171026  841.55834327 415.28931744] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [649.54800686 579.14722067 109.64341232] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 985.5450164   865.99979456 1015.92927504] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [359.95492807 112.61692406  54.62506617] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [809.24513642 554.74275187 627.02474187] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [434.5142918  389.35447406 896.53991754] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [629.01743585 343.04580772 199.92999083] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [741.35701495  99.62988032 604.88712281] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 722.19822147 1037.04010368   97.23733754] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 471.00404679  870.56609274 1013.46672979] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [934.89192681 854.15910634 353.92756809] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [963.09201501 510.98331254 814.38976983] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [485.83716487 658.84734149 252.93132314] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [695.40708781 693.82613333 708.14122265] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1030.76423211  155.37407431  964.5802151 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [235.74827255  18.39387214  93.16221565] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [668.61253223 120.10086545  71.43799176] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 91.12070403 661.05516104 817.98801235] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 753.37442244 1041.23530352  447.18229034] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [814.22047615 289.84482916 922.87107976] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [387.58570111  30.96924051 300.94134937] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 74.57722377 124.26327953 122.79781269] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [655.08565979 140.46394846 135.12181056] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [317.32456011 695.90962123 572.14307944] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [696.59416722 950.0121165  288.94326954] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [742.96930765 823.17520594 417.63489115] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [676.58427123 832.98266198 338.74330716] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [586.42796129 427.99002665 497.47443505] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [116.74719801 354.52795151 679.43107476] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 800.84983943  107.70460049 1001.10474697] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [886.64948783 597.06270942 437.60276666] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 415.24512388  213.02980909 1030.14756842] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [558.64687678 728.78931529 315.1102753 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [   9.89434646  574.82821323 1032.44630973] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 94.15693296 597.75919495 396.45110343] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [392.59660553 783.79283452 874.80413129] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [747.67249538 962.92839698 826.50791124] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [465.72953653 271.03170636 365.6247709 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [641.15502523 447.19402766 285.39026264] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 95.12905563 785.57305932 831.48762228] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1031.54195833  213.35500564  732.68025081] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [277.17146009 836.71743495 496.80323665] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1078.07658634  331.55676816  152.92691319] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [247.42995139 185.29617248 370.96557011] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [309.62515507 516.81170903 612.64371844] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 259.3138011  1002.18904661 1035.82685845] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [465.6569711  646.05920608 144.62348995] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [906.06604806 974.75907752 464.09871577] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [136.81368918 624.1096975  576.1151739 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [388.24272808 716.93584293 836.06619082] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [239.93373085  49.07716479 721.96336321] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [550.26600061 764.55502756 190.54941358] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [514.55511197 299.35120998 952.82246003] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [990.50655084 334.39313508 143.9638696 ] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [756.80614795 364.15238384 629.99339452] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 604.37243575 1007.62887018 1040.46465705] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [221.41560102 874.93575102 197.27718102] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1026.32622277    4.01605385  390.99204707] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [793.58039949 462.97147719 377.15737261] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 678.16338533 1046.47003711  913.58425846] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [198.05295946 112.01030683 794.49479896] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [170.15062623 109.93356951 522.53323473] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [823.90479702 915.26676918 276.03507923] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [495.13145532 542.09278467  34.03194618] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  99.7607492  1082.52020099  464.77388123] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [172.08405613 827.27211322 538.44890538] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [670.6410879  732.05075425  56.71191817] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [367.83315999 317.84490516 997.56990837] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [306.64833428 514.00699986 425.82103727] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [  31.53216452 1012.84479551  189.26803374] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [877.99066868 891.52075686 188.82651023] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [443.43280692 534.33504521 501.29502155] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 987.66468165 1038.00403983  339.39866908] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [549.13068648 814.42960786 831.93583337] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 411.71510505 1008.41412192  415.75886302] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1071.26311824  291.6795885   452.3135821 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [156.22357752 218.45884763 917.07582901] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 114.98067743 1004.48346258 1033.57675624] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [648.46376756 592.85999697 112.74616277] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1055.6970468   393.10311244  166.83573849] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1077.26664843  697.27604419  309.99913129] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [549.21123435 406.9475378  476.94190232] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [929.88280301 428.63521517 896.15683392] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1036.73271975 1043.82460001  180.20814406] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [920.28093818 771.10743848 418.050298  ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 859.88305186 1079.68699216  678.24116866] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [478.69577764 512.84682146 524.7364408 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [437.50612665 145.43213166 517.83896547] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 436.39946947 1080.92488691  575.9297418 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [425.93158255 491.53178589 730.83038306] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [153.49421062 883.75187639 368.11956937] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [592.83080121 685.56132762 162.67568989] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [802.44936156 581.64403647 149.27230234] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [986.49533164 818.07353765 983.400223  ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [794.14918165 499.3152675  263.73481983] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 433.74558442   50.44585051 1008.28114563] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [487.738781   897.82674262 478.56134728] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [513.43988501  74.20836872 486.74308527] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 132.559888   1034.54473786  879.8011748 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1012.92943245  159.23978474   18.60066288] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [651.57443361  81.42293572 592.58957498] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [636.81830993 505.77407001 272.08137195] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [455.76954652 400.69941062 817.60744628] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [439.41272779 819.66888827 204.25083587] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [210.083594   753.38467227 158.0616381 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 415.77664855  741.18210057 1023.71065323] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [829.54027886 959.1188328    5.43967824] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 30.85575118 735.95347533 202.13162915] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 77.95491799 610.23111284 208.83617035] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [898.61160599  88.62848901 303.41682789] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [472.31928583 383.950173   803.63238346] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [376.47693258 216.63246217 927.17393786] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [707.48803666 482.31569843 458.41741502] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [879.44893908 930.8659161  301.2254439 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [809.01866395 259.69604475 282.37956025] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [779.67234413  87.53686982 724.77039459] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [996.53463194 397.67072832 431.4384474 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 46.00034211 836.60374388 235.44650379] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [815.52242209 834.35611114 958.89339073] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [875.37372947 515.36980475 334.31705612] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [727.33757141 561.14576642 471.37461415] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [448.71483684 374.68708406 392.19387865] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [217.87460557 107.51601033 927.21783378] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [669.24390959 283.32071919 162.13381703] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [596.02444215 597.50117276  37.73474423] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [939.76510778 755.46521676 238.93359754] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [200.52270388 476.55096165 565.64437467] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [785.73870461 963.22313279 411.03477245] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  38.14999191  911.76302268 1057.03830035] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [614.92209536 330.81544084 942.8529228 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 732.72802955  164.5009117  1020.99602996] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 330.17719852 1046.36037408  224.84111825] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 95.67277369 153.28264628 448.78388201] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [759.35798627 485.97635949 926.12927065] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [352.04732624 127.45517953 333.91628459] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [557.2706268  588.99963583 199.21302141] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [137.64820657 677.13217727 971.76787266] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [125.34720366 863.0465631  514.66800249] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [111.41013074 651.86229287 195.81707287] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [688.18113876 261.43249843 433.02491869] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [565.14084181 805.14713856 953.20208815] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1041.47475701   53.61103269  613.14518223] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1042.38330747  304.33133324  817.17028646] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [967.78191838  64.84596289 654.04952307] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [780.17598253 298.09680782 215.95079495] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [742.57353494 837.95760926 235.82251681] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [975.44204024 400.41172044 836.34375965] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [649.21693849 225.12529645 994.05669338] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [583.71294589 699.05387015 531.24078756] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 933.56441527   50.74359609 1007.21213018] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [238.05235868 891.56940476 606.91953437] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [795.25231841  37.29408162 519.53303036] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [395.20076263 137.56044365  12.63114569] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [224.13194023 512.57123263 586.35042655] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [713.16042176 815.16792687 847.60108332] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [230.39932664 544.76223172 208.3905305 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [799.59559773 344.05980752  85.40820155] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [650.92370501 953.66433244 174.39612194] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 23.71832602 501.00469437 721.93119026] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 245.60858952 1025.93952499  998.48048378] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [472.55887269 446.67239665 243.15737104] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [106.48058654 691.1063595  622.51705519] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [439.67997629 789.67010995 209.96410222] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 56.91041636 455.33866379 799.36539113] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [258.28821864 587.67130377 113.75477746] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [988.39892875 256.43827032 517.24298435] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 73.49306743 255.26816296 554.58030544] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [390.86893732 186.85261466 953.6277866 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [665.18765889 206.25278998 411.74078525] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [903.50854068 388.23484478 993.0509615 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [667.47598537 448.1379933  728.37958385] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 875.58787067 1082.72372607  368.53431455] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1081.16101743  533.09331084  586.3627433 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [841.60373362 794.08715253 817.22300034] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [525.47961482 234.58721115 474.39564325] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 238.53852605 1075.06983074  297.42147885] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [269.71032277 966.99640063 144.50619532] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [994.61380904 959.11532561 506.40663057] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [520.02526725 328.72192799 288.86317519] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1023.86635489  827.37760747 1025.02463366] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [578.15456864  19.54197697 763.5298062 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [600.34549603 742.81347776 340.03258716] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [612.77133074 859.87056438 970.22780556] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [295.14174577 494.82440077 421.08065459] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [720.16334171 586.55099414  21.36660273] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [523.49518083  75.99141555 805.56382466] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [703.05241969 264.15214009 776.02867878] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1032.89481042  894.78094223  788.58319106] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [678.16953099 638.15202794 495.84670188] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [725.07066565 101.10976378 618.8659271 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  87.27455728 1031.83164469  773.70900124] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [348.94870976  77.45961193 626.23289672] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 58.42615555 409.34207426 982.5867934 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [941.17355253 621.66036195 410.40428907] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [401.05271069 641.64527379 805.56894948] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [126.15512235 719.7804345  148.48652585] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 900.79338342  415.38549256 1011.43595263] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [951.87081567 513.42911726 814.3332937 ] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [287.19488057 784.35125384 619.28630189] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [715.19985903 666.36844214 881.31693684] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 32.85679913 100.97886972 905.71042303] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [990.22335837 252.66242123 607.37106808] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [167.58688436 350.01008377 854.54941567] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1061.09317743   78.21252688  595.71871353] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 248.40353127 1022.89472069  664.90102855] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [224.67734464 231.54490932 175.8723415 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [893.55706213 692.65332805  16.32957202] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 460.54589968 1032.0795443   965.54166334] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1066.95528949  601.64526031   49.75976116] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [274.61870105 716.97385751 324.14437264] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [820.14146354 538.2110513  284.79256473] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [416.45839407 153.93696856 555.41287103] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [750.68907007 570.29333765 156.23273047] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [567.17526372 122.00376908 465.26449428] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [761.76683818 535.21797154 698.8893642 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [670.32826248 592.67189702 554.86060102] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [269.2331789  572.39388266 463.48602118] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [586.09398547 466.3014215  701.39934278] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [433.4980099  497.50737897 667.99569799] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [370.34969989 622.72856788 967.22816077] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [583.46021389   9.72965517 446.64621328] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [670.68629318 339.88753858 930.45450098] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [774.96963867 438.75420878 276.03334346] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 64.28503326 752.58090466 112.59545614] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [958.81895375 679.78802614 197.71403282] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [790.40392803 721.14118678 491.24837036] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [141.0787513  592.55986743 654.95348197] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 90.34390598 476.39880203 527.46612689] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1041.46998377  850.43891436  639.09397885] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [955.75661038 197.49979391 909.54889476] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [872.87359198 414.1082869   78.30688347] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [612.93159851  33.0114751  252.5767928 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1042.60849443 1000.62792196   14.05575955] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [583.17536136  43.75087873 573.21421119] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 99.4585419  622.19199861 553.17964933] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1003.39608441 1061.76571268   78.65366738] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [952.4359879  181.22997932 505.25283368] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1052.7400047    93.00493305  674.05772965] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [300.58474685 838.94954112 972.29562223] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [880.31884365 540.47024968 298.84469197] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [179.4000971  312.9079649  993.34179355] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [450.55961281 123.96672232  11.49912542] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [706.32247873 167.35960035 747.66753064] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [493.01968127 504.54948751  36.56052387] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1051.02914973   73.90151973   83.44707952] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [874.19588896 923.42976944 975.53935798] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [279.5243098  306.63962901  56.59703491] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1074.58846429  291.74561986  366.4025499 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [532.79186711 103.35497679 689.19700308] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [944.89767075 369.46783956 237.36918418] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [762.21499603 686.11222127 992.57804243] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 819.0509677  1039.15616718  377.85260411] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 340.05478869 1000.48154152  752.01087718] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [227.79927823 918.48006425 837.44923333] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 73.5109072  779.13619001 936.82087313] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [148.40699469 829.73786566 994.73779599] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [293.86970532 405.66632276 729.16723412] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [341.25082736 625.99998383 534.90437268] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [346.3865625  364.48875772 636.98749884] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 69.67483392 301.60906754 439.80043257] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [703.85269788 276.42015064 228.49627809] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [216.37935796 227.6314315  543.97982034] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 807.9139944  1002.00449127  661.24352215] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [683.06069113 227.93452134 563.63914974] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [590.97108807 789.27670236 162.11077043] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [277.48110376 203.48116617   3.90165819] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [350.41432338 542.75961421 920.00646067] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [567.73496771 613.50446672 540.79760419] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [964.6237934   91.91482497 429.97367141] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [304.78049449 467.69366094 342.03880359] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [379.71531987 522.73134871  19.60996282] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 122.03623263  212.56715589 1024.1602392 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [3.73578915e+02 9.19075678e+02 7.72845415e-01] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [674.64134278 705.99959489 131.84832627] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [520.31734203 219.78717368 646.18655438] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [322.520236   616.01582087 686.77414323] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [359.2380669  369.89621434 325.0114829 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [168.92904169  43.93827627 416.05614958] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 93.07409237 693.67099433 554.99109787] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 782.25066607  231.63487359 1021.27800999] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 63.39319033 601.98427228 415.35281651] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [344.42637025 223.08224899 488.06905383] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [340.05579586 406.86963865 273.06806565] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [664.62327643 947.56698392 369.58693057] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [218.71164869 346.56301119 835.08714386] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [845.1348751  548.68759123 826.67363347] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [529.17401014 615.3844181  653.87338393] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [720.65111928 246.0457195  556.98175698] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [677.17255421 742.23954819 140.3856738 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 531.21079445  526.99756949 1058.71254555] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [238.24865287 419.69202298 263.62791545] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [626.10312982 605.10044074 304.51906371] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 126.63264066 1046.27387537   78.75947212] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [689.33879468 175.7832429  178.70802379] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1045.0731548   100.44117732 1064.37955478] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [826.82870191 494.38735215 416.42165463] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [414.71056214 613.99843628 990.38265746] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 470.78485218  746.10898201 1068.31225249] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 28.24061012 877.59884159 314.39002987] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [505.4586465  646.01865926 474.83736651] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [364.19081921  59.30435781  43.97612714] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [269.37312858 740.8705892  424.22509072] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [614.17857254 577.85388015 385.64624217] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [  5.34902447 452.09971189 124.96367041] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [325.29917812  72.36914818 790.66822087] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [153.24607652   2.17443372 395.50377685] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [645.10039912 175.50018551 239.46278406] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 737.03249887 1013.36452419  163.11183227] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [  11.30967421   87.81788446 1012.80009808] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [754.913713   947.37144403 722.41279843] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [947.19320747 477.93716203 754.30886975] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [965.02295474 494.74490837 558.03711867] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [106.36237988  49.08751067 765.16473034] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [171.3867701  542.68338648 734.20789322] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 49.76738809 351.4000304  668.90473996] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [159.12625042 463.66181603 489.04464729] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1036.97256639  417.25661783  110.9294715 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 262.11219475 1020.85575436  626.72507918] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [204.77916138 789.51658858 974.54074785] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [180.15409991 191.85264678 825.52905558] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [982.52898272 250.39904593 313.78000907] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [910.45341268 391.40240843 463.89378946] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 348.96702832 1043.71681027  809.38274988] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [320.23385913 488.55213774 589.35796295] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [965.02653277 355.03609113 888.49496731] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 54.00121686  83.89316739 396.31301333] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 51.19737127 183.89342817 846.29380484] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [353.20286483 729.22211479 371.93056641] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [927.15196278 878.54318431 357.6743077 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1047.03528531  182.49505539  719.90795707] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 17.39933369 844.7438332  724.52391816] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 12.87717103 777.47844432 181.22688018] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1002.64097218  771.20304588  809.47387955] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 35.83482105 290.06777232 640.15790516] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [444.40997745 740.0077229    6.38590155] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 12.01950062 386.42579556 411.034446  ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 432.12855541 1060.25971532   96.42735635] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [692.91862209  14.28100212   5.10107574] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1020.96545748  884.28258339    9.61024493] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [624.07896306 963.71104847 353.78396079] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [360.6359736  782.46356304 942.77100745] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [656.65140361 563.25123503 136.76269538] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [245.6129615  843.48868901 300.81538913] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [233.36322231 172.73165784 855.47961393] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 325.13261395 1012.80380259  973.2442027 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [1017.81004436  843.45302667 1025.79507109] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [671.7284297  673.59524302 953.27885849] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 78.81327882 229.84251019 775.90888815] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [440.79313321 511.87937608 552.25437492] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [ 80.81452657 974.43666214 274.10261009] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [284.78463054 610.46834613 167.79176853] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [246.48478048 493.95780094  95.86982579] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [600.62160756 598.46701603 312.99683279] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [449.02898389 486.22824484 837.84269479] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [123.41687071 262.47409487 225.75031017] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [831.59244959 486.05374935 322.52029241] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 584.22407529 1006.69689767  368.93652192] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [802.53686327 596.74370649  18.70127988] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [787.20037549 732.52954785  81.00992453] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [325.70642864 627.33466126  60.42363635] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [839.0390889  524.33465312 661.23516699] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 69.56041989 499.20025955 791.5551539 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [226.49985923  68.21702154  91.8463554 ] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [310.48612813 901.51499607 743.15522768] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [145.60719501 789.42254704 159.19201074] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1.02226884e+03 3.46148034e+02 7.60649871e-02] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [794.90458845 159.33503086 300.53622451] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [556.94675208  23.49342244 408.67979742] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [200.73199494 662.03812848 470.79447353] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [251.15800548 481.96483371 905.51566978] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [894.44029236  30.92715888 395.37703943] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [111.36652437 982.59586105 556.33450325] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 71.45662032 361.58202491  96.72358854] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [276.42616019 770.7111209  472.50236921] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [222.3580245  850.55347941 720.39319307] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1079.54781921  824.15702242  631.52582096] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [884.52567361 910.36421242 530.45697716] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [263.86746387 552.65353907 563.40139774] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [819.55542581 978.25431268 579.02193538] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [577.36232212 935.55725511 579.47850087] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 49.24602372 784.62930947  53.30621789] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 209.58434047  752.53057745 1076.04733711] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [764.6455091  503.17839766 961.75924333] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 132.99241238  382.72287041 1080.96509825] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [732.60908195 815.6691541  152.15046042] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [622.51723715 239.60062024 296.09799356] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [188.05871597 247.6435968  758.21760941] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [447.79401432 892.04104172 107.33687097] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [106.3202355  413.73355186 228.48997568] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [575.8279702  889.77286581 925.33609733] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1082.88016095  433.86994466  700.50669959] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [376.52863879 911.05305203 854.57733778] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [417.97385971  71.3503323  619.22754879] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [210.76720424 866.19791705 317.67617069] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [1000.0873247   297.29698737  145.17894147] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [934.55581946 976.85480881 713.89303553] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [498.2243487  917.54440976 492.72252916] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [346.6982609  923.23954695 632.30762276] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [591.46472978 602.41411675 443.11461992] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [704.83216083 382.18354712 442.48806445] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [242.1294621  310.01740008 211.47482226] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [963.40420661 640.12066286 548.96581773] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [416.81216286 191.80950175 711.4756741 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [747.20068066 662.94352664 779.83980728] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [872.3441148  408.31151895 193.39783516] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 939.58945732 1030.1593175   551.91643951] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [711.0187436   35.80958921 104.5010129 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [198.25498644 310.51018742 422.32290027] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [936.69034291 167.60181456 876.47256016] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [840.79847905 318.17804362 227.11389821] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 201.19780877  649.51354223 1000.72907604] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [570.38246435 445.2695687  349.38540117] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [799.9438477  890.13863827 933.37214367] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 255.11987998 1017.36499465  483.37102155] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [858.49086173 745.71098822 422.93179124] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [770.14795453 986.4150205  261.67676302] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 97.50198313 158.45694012 178.1074021 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 56.82285608  72.63088311 123.26600032] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [281.60615275 273.69966812  42.08293545] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [822.32074117 320.37633602 588.30373793] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [410.84391983 131.64695236 659.33493516] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [143.70353275 544.98932719 667.5410254 ] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 551.1997927  1027.12107717 1027.19262814] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 973.0583742   485.2262566  1034.22028166] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [155.72373887 900.42214433  88.38721034] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1029.81565011  847.42563983 1037.36478011] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [301.89632635 812.32682924 986.48831385] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [474.69598315  56.55716817 866.08580306] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [532.94388891  65.90518322 547.91686304] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [659.70728877 240.31249959 377.3959771 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [286.25380938 741.69789199 270.73588771] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 639.97201203 1022.52275195  595.53165087] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 10.77340001 238.04539071 234.60218871] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [638.02583634 821.9850479  889.31630891] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [118.58351761 747.30523179 237.82244607] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [392.67543547 180.49723645 978.51598163] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [943.28926613 145.03126174 687.4040475 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [497.34526435 792.59798998   7.7405839 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [133.311908   987.90831149 989.7306382 ] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [408.78108093 371.3391007  191.64527399] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [719.249423   328.34402626 578.22012395] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [941.71634421 280.39394806 537.23578029] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [749.40939014 540.68566786 928.76518131] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [785.3419498  345.96580961 501.13913217] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [315.92344526 767.64449651 603.77081315] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [405.32615597 877.18466016 570.82543214] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1002.78646335   67.24186798  468.890256  ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [612.58908784 153.15606813  71.71972743] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 21.6408649  867.68965854 867.00153861] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [897.87801884 298.47979239 225.830569  ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [569.20199368  33.33873548 573.05285607] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [868.62666043 753.55338208 160.12925123] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [231.71475871 700.7480415  465.37228241] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [843.56640974 266.74357656 350.53363184] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [967.86226362 584.34496932 634.13604268] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [259.51135676 718.88646954 551.47469755] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 44.00243811 575.84800985 987.77647592] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [  92.80236164 1044.89404499  287.59668783] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [873.00792967 483.60837653  28.44245183] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [466.53064242 305.04969005 176.18212171] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [259.89977837 859.45933493 912.25129576] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 60.0475838  176.55522955 967.51012582] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [136.34098206 201.7725012  730.45359042] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 983.03314554  960.85241182 1040.06873162] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 322.81585363 1002.03105748  696.94234176] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [119.54087796  31.08172426 736.6727627 ] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [546.03258907 591.1641197  417.09146897] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [612.27259176 688.90607623 903.46604241] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [621.87723235 752.84155724 674.36133995] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [926.72213242 424.02497603 554.57027965] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [248.08306864 231.03782001 355.58703306] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 447.05301243  199.17349679 1058.32410782] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [831.69613563 758.39184444 239.38332451] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [589.80743195 198.28044663 764.27929616] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [157.25432131 963.43585515 393.94207338] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 127.77587531  511.09488562 1065.2730748 ] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [896.88506878  85.09562439 751.42102768] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [407.90109918 367.90367179 648.68762103] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 377.69993031 1051.29536008  854.32945373] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [882.85899149 713.009473   939.82722093] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [1004.65936014  558.18257335 1080.74170219] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [336.55876341  51.58483528 984.58605409] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [225.57356935 711.24142572 359.14201565] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [793.29182931  45.57429363 887.80651665] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [524.85557114 633.88946145 803.92687331] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [824.05278751 650.32048832   8.64416722] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1019.23383932  142.01621293  662.50456719] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 443.26951513 1082.9627555   334.19885788] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1079.97398167  147.15747557  238.33844672] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 82.94780932 733.37056505 395.43405988] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [407.11515938 667.35176107 478.19140185] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [1026.76911425  176.78077541  606.72567253] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 787.06927556  936.87675659 1073.38942328] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [354.6040465  765.20410743 888.48210592] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 648.5196589    70.94001187 1008.35258178] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [369.17162594 532.01115045 104.83773552] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [986.90128439 515.55621607 974.10977307] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 307.72380817  926.86152594 1077.22010878] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [789.11695918   8.05449557  47.70992741] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [553.93588494 416.03580128 246.948862  ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [1048.46716627   34.09705706  984.12295547] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [1014.28468916  302.95019664  201.13703362] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [753.64403261 621.01953333 264.32934989] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [684.99387577 625.41570191 839.02069327] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1039.28203483  389.6024827   664.19812002] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 97.23281911 544.26784817 850.21604467] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [325.229376   935.63177098 452.29109055] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [1008.52393071  698.5173191   444.2621683 ] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [ 309.98445104 1064.47173608  703.46884745] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [204.18608785 878.71725667 265.29528738] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [899.99797504 865.60103026 701.74503047] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [796.50312848 357.22490092 582.5083455 ] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 594.01916311 1034.82006069  217.31282413] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [939.3691973  596.71031577 891.68183144] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [ 460.08821604  552.66108621 1003.27662428] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [ 65.5039692  531.38557453 627.42504276] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 798.7077669   791.97072659 1057.45463678] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [513.22854734 430.85340627 673.99296889] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [724.31271867  93.31502589 544.76434752] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [748.57672533  87.92319883 312.70232169] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [838.99961613 124.208911   551.50800385] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [581.11647863 917.74690973 241.00318615] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [172.55879816 149.80576752 130.00561999] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [189.68190887 540.95812864 695.66329492] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [741.18325795 572.23800187  15.48450763] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [715.34106227 683.58659259 706.09636016] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [873.9928448  920.19874424 898.29326494] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [478.73472463 813.58253772 924.077723  ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 86.54796441 101.80368634  67.62381206] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [965.64753176 172.01332985 503.0518551 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [725.43845793 142.09502882 189.62258542] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [407.87889445 385.30216598  90.67807561] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [362.87965812 681.82881545 530.80383135] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [444.34485159 655.55500664 283.56737151] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [565.48835731 165.19016824 333.09105978] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [841.44327824 723.51448304 497.53162659] is in cluster 6 centered at [0.20073912 0.81520975 0.7909413 ]
point: [632.40666682 937.40844615 293.06807605] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [ 177.32169619 1001.54000109  382.35789609] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [204.71854162 459.5328004  545.47431178] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [   5.36784667   86.73122304 1056.3047775 ] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [621.137364   183.62093334 954.91910594] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [225.44882505 126.58030993 623.13091351] is in cluster 5 centered at [0.27099857 0.4127391  0.16009527]
point: [761.14533935 555.28277203 226.11306953] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [542.64139349 681.70683742 656.85670556] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [911.19122599 259.38037045 847.18029744] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [150.00521958 605.5610617  699.5030677 ] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [191.09583256 207.20527675 915.87190309] is in cluster 3 centered at [0.28734505 0.6525521  0.4562684 ]
point: [829.60054186 178.40546276 295.04987859] is in cluster 2 centered at [0.4771761  0.59001285 0.8061129 ]
point: [1029.02585238  459.80730052  382.10719856] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [270.7956648  295.81798228 484.86808528] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [ 54.70279453  29.81981329 241.47060143] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [414.28499929 971.15939853 876.48804081] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]
point: [533.94777894 530.46652181  42.17297405] is in cluster 4 centered at [0.7346158 0.2859749 0.8167916]
point: [265.68917526 131.7372364  887.04697642] is in cluster 7 centered at [0.783745  0.5368648 0.5489363]
point: [ 371.69910753  453.18622682 1003.28588442] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 957.84179932 1003.44338991  681.85688941] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [768.43359354 187.35671366 636.73831221] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [ 706.29592298 1009.28285386 1062.90396493] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [793.71945999 321.49165122 210.38060899] is in cluster 1 centered at [0.52165204 0.22390209 0.29455298]
point: [261.01850907 392.17994754 511.60395458] is in cluster 0 centered at [0.8554402  0.13945478 0.53941685]

Conclusion

Nowadays, big data analytics is becoming more popular day by day and most innovative companies would like to improve their methods, processes using big data analytics’ techniques to obtain the best results. According to a research from Ducange et al. (2017), for any efficient and successful strategic marketing effort, getting and evaluating the useful insight buried behind the massive quantity of data available on social media is becoming a must. DogGo is a start-up that understand the power of data. In this project, RFM based customer segmentation is carried out and clusters are labeled. With these results, DogGo can be identified their current customer and new ones and organized some specific campaigns for each group.

Reference List

Ducange, P., Pecori, R., & Mezzina, P. (2017). A glimpse on big data analytics in the framework of marketing strategies. Soft Computing, 22(1), 325–342. https://doi.org/10.1007/s00500-017-2536-4

In [ ]:
df_graph = df_lastyear[df_lastyear["ownerid"] == "eea120c4-6c99-4c83-8251-1ea3d1e89dd3"]
In [ ]:
df_lastyear.groupby("ownerid")["amount"].sum().sort_values(ascending=False)
Out[ ]:
ownerid
eea120c4-6c99-4c83-8251-1ea3d1e89dd3    15907.370000
12652cc3-a4c3-43ef-9ad0-2d55c64d3c7b    15783.313333
c0caef87-8143-4fe2-a071-44aea8d3905a    15519.620000
7ebb85b5-8d08-40b5-a334-0d32fd9b7be2    13422.000000
f82cb910-9213-49f4-98ec-ce3347328c9a    12731.340000
                                            ...     
9b720f0f-f18b-4fb5-b0cb-4bd545b3d0ab       26.910000
a8c7c4f0-86e1-4423-815f-96b07d888c44       25.420000
27f61029-661a-41f7-85fc-e6ed26fc6b83       25.360000
36f8c029-2206-43ee-a8f6-6f836e3290d6       23.920000
105c946a-64b5-4e6e-adcd-c17543df6f48       19.790000
Name: amount, Length: 1085, dtype: float64
In [ ]:
df_graph.groupby("checkintime")["amount"].count()
Out[ ]:
checkintime
2020-04-20 05:30:00    1
2020-04-20 14:01:00    1
2020-04-21 14:00:00    1
2020-04-22 14:00:00    1
2020-04-27 05:00:00    1
                      ..
2021-04-14 05:30:00    1
2021-04-14 14:30:00    1
2021-04-15 05:30:00    1
2021-04-15 14:30:00    1
2021-04-16 05:30:00    1
Name: amount, Length: 540, dtype: int64
In [ ]:
df_graph.groupby("checkintime")["amount"].count().cumsum().plot()
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d362a0f10>
In [ ]:
df.groupby("checkintime")["amount"].count().cumsum().plot()
Out[ ]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d36488150>