K-means Clustering


In [7]:
%matplotlib inline
import numpy as np
import pandas as pd
from IPython import display
import matplotlib.pylab as plt

import time
from IPython import display

N = 100
D = 2

# Generate a data set
X1 = np.random.randn(D,N/2)
X2 = 0.8*np.random.randn(D,N/2) + 3*np.ones((D, N/2))
X = np.hstack((np.mat(X1), np.mat(X2)))

K = 5;

mu = X[:,0:K]
#plt.plot(mu[0,:],mu[1,:],'ro')

# Number of epochs
EP = 20

fig = plt.figure(figsize=(8,10))
plt.plot(X[0,:], X[1,:],'kx')

ax = fig.gca()
ln = plt.Line2D(xdata=mu[0,:], ydata=mu[1,:], marker='o', color='r',linestyle=None,linewidth=0)
ax.add_line(ln)

for e in range(EP):
    
    dist = np.zeros((N,K))
    for i in range(N):
        for c in range(K):
            err = X[:,i]-mu[:,c]
            dist[i,c] = float(err.T*err)
    
    # Assignments
    a = np.argmin(dist, axis=1)
    
    mu = np.mat(np.zeros((D,K)))
    count = np.zeros((K))
    for i,c in enumerate(a):
        count[c] += 1
        mu[:,c] = (count[c]-1)/count[c]*mu[:,c] + 1./count[c]*X[:,i]
    
    ln.set_xdata(mu[0,:])
    ln.set_ydata(mu[1,:])
    
    #plt.subplot(EP,1,e+1)
    display.clear_output(wait=True)
    display.display(plt.gcf())
    time.sleep(0.1)
    plt.plot(X[0,:], X[1,:],'kx')
    #plt.plot(mu[0,:],mu[1,:],'ro')

plt.show()


SVD


In [2]:
D = 4
N = 30

#X = np.mat('[1,2,3;5,7,2]')
X = np.mat(np.random.randn(D,N))


U,Sig,V = np.linalg.svd(X, full_matrices=True)

print(X)
print(U)
print(np.diag(Sig))
print(V)

a = U[:,0] 
w = Sig[0]*V[0,:]


Xhat = a*w


plt.plot(X[0,:], X[1,:],'x')
plt.plot(Xhat[0,:], Xhat[1,:],'o')
ax = plt.gca()
ax.set_aspect(1)
plt.show()


[[-0.27178384 -0.68695254 -0.06148734  0.4272493   0.00402096 -0.1513811
   0.02996431 -0.6319934   0.73270656  1.41604634  0.31682215 -1.48061139
  -0.08188947 -0.25580301  0.82346341 -0.22943276  0.20392575  0.63260018
  -0.15095987  1.19067592  0.69470086 -0.50328369 -0.01189888 -1.12050844
   0.1129367  -0.06433369  0.32727297 -0.6736358   0.13550325 -2.06335767]
 [ 0.68643155 -0.49211519  0.5827548   0.09672223  1.07188718  0.87165245
  -1.34017859  1.99774755 -0.27870617 -0.95964831  0.01076813 -1.79994624
  -0.72738759 -0.95079763  1.01435088 -0.26568168 -1.79892967  1.15927628
  -0.82135806 -0.31342689  0.12822283 -0.53477584  2.18065339  0.87438316
  -0.95920637  1.50502881 -0.53102307 -0.68731283  2.46692924  0.20997204]
 [ 1.75157822  0.65803829  0.06591008  1.08197471 -0.88957676 -1.21935735
  -0.96341036  1.96135081  1.23434055  0.24783934  1.02953266 -0.15107712
  -1.28969139 -0.98262655  1.09311658  0.09747725  1.49034424  0.08722825
  -0.56725631 -2.49377916  0.56450124 -1.37911041  1.63060525 -1.00648569
  -0.64982707 -0.8896044   0.15958252 -1.02697128  0.24535346  0.56767193]
 [-0.00769776 -1.07618401  1.17429492 -0.42846355 -0.39007068 -0.74907204
   0.56313728  1.2137838   0.24369411  0.05702333  0.07670971 -0.32078638
  -0.63457934  0.13441551  0.0477557  -0.99081851  2.12826977  1.9336579
   0.05755374  0.45605758  0.59695937 -0.37575201  2.09310986  1.1722937
  -0.63644051 -1.76548036 -1.28504214 -1.49034502 -0.76639818 -0.32479867]]
[[-0.06700026  0.11610069 -0.32591407 -0.93584807]
 [-0.57410715 -0.79104257 -0.21067928  0.01633607]
 [-0.66766427  0.30487046  0.66342428 -0.14541886]
 [-0.46918692  0.51751935 -0.63973626  0.3205852 ]]
[[ 7.20174218  0.          0.          0.        ]
 [ 0.          5.47120771  0.          0.        ]
 [ 0.          0.          4.61185743  0.        ]
 [ 0.          0.          0.          3.79669838]]
[[ -2.14077392e-01   5.47278192e-02  -1.28498581e-01  -8.40798089e-02
    2.23983541e-02   9.37685334e-02   1.59186000e-01  -4.14287642e-01
   -1.14909347e-01   3.66352211e-02  -1.04250135e-01   1.92167518e-01
    2.19655491e-01   1.60516331e-01  -1.92975471e-01   7.88279824e-02
   -1.35313177e-01  -2.32363129e-01   1.15721332e-01   2.15391773e-01
   -1.07910224e-01   1.99648836e-01  -4.61261738e-01  -4.23433106e-02
    1.77123298e-01   7.81144220e-02   1.08211897e-01   2.53361945e-01
   -1.70735106e-01  -2.90101933e-02]
 [ -8.13899795e-03  -8.55409108e-03   2.91876706e-02   1.48443431e-02
   -2.41357381e-01  -2.68038618e-01   1.93985741e-01  -7.81479555e-02
    1.47676092e-01   1.88001670e-01   6.97904562e-02   1.90060777e-01
   -2.84596716e-02   9.00004797e-02  -6.37549557e-02  -5.47450616e-02
    5.48779861e-01   3.35770711e-02   8.93857724e-02  -2.52391582e-02
    8.41246283e-02  -4.57504273e-02  -2.66893352e-02  -9.53956071e-02
    4.46705290e-02  -4.35533713e-01  -2.89376157e-02  -1.13117889e-01
   -4.12621677e-01  -7.32337877e-02]
 [  2.40884578e-01   3.14970379e-01  -1.75687882e-01   1.80466993e-01
   -1.23108613e-01  -1.00619894e-01  -1.57599646e-01   6.71741867e-02
    1.04710475e-01  -2.84893171e-02   1.14578036e-01   2.09623544e-01
   -5.84828888e-02  -9.84864869e-02   4.60916265e-02   1.79814815e-01
   -1.30675887e-02  -3.53343646e-01  -4.13949818e-02  -4.91822598e-01
   -5.65540912e-02  -8.62688698e-02  -1.54557170e-01  -2.68158937e-01
    3.06428082e-02   5.27218213e-02   2.02341829e-01   1.38005138e-01
    1.93355647e-02   2.62938171e-01]
 [  2.20762623e-03   5.11349922e-02   1.14293972e-01  -1.82516202e-01
    4.75617551e-03   2.45174166e-02   7.12977927e-02   1.91742616e-01
   -2.08503962e-01  -3.57847970e-01  -1.11002485e-01   3.35911161e-01
    1.28696428e-02   1.07947608e-01  -2.36446524e-01  -3.19864146e-02
    6.46184244e-02   8.99145106e-03   6.02624575e-02  -1.60814489e-01
   -1.41900287e-01   1.42847550e-01   1.26598981e-01   4.17492121e-01
   -6.08153533e-02  -9.26670407e-02  -1.97572820e-01   7.65800123e-02
   -9.68961514e-02   4.60332478e-01]
 [  4.11185549e-04   1.56000433e-01  -2.01359533e-01  -7.07686118e-02
    9.29973711e-01  -8.03406459e-02   2.63936968e-02   1.30912724e-02
    5.30539153e-02   4.44395198e-02   3.29718460e-02   4.59485195e-02
   -2.65362434e-02   4.04552871e-03   2.03270277e-03  -7.14932694e-03
    1.45360792e-01   1.32674218e-03   1.10912869e-02  -5.31671846e-02
    2.56495338e-02  -3.19953297e-02   1.49314464e-02  -4.08772550e-02
    1.02853887e-03  -1.10269516e-01  -3.77617310e-04  -3.73947500e-02
   -8.91894739e-02  -1.35851239e-03]
 [ -1.59306301e-02   1.07877773e-01  -2.58256586e-01  -1.00914268e-01
   -7.81914122e-02   9.03928967e-01   1.76900031e-02   4.37758278e-02
    7.03288367e-02   5.29003584e-02   4.53375972e-02   2.72577868e-02
   -4.66176974e-02  -8.77340596e-03   2.10214208e-02  -1.63319838e-02
    1.72035603e-01   2.50257847e-02   2.65678415e-03  -6.69422996e-02
    4.04095188e-02  -5.28440859e-02   5.38264350e-02  -4.52408209e-02
   -1.25221648e-02  -1.28421117e-01  -8.73410707e-03  -6.52728389e-02
   -8.43768251e-02  -1.05091864e-02]
 [  1.27876822e-01  -1.60278802e-01  -1.06703396e-01   2.11719122e-01
    2.41645705e-02   2.31820879e-02   9.14188328e-01   7.70872856e-02
    7.42182275e-03  -3.90594712e-02   2.08810710e-02  -3.52844118e-02
   -3.31933768e-02  -5.68554382e-02   5.00998548e-02   2.99712512e-02
   -9.26485452e-02  -3.31380369e-02  -4.06379170e-02  -9.98715684e-02
   -8.48748545e-03  -3.42417427e-02   3.86957081e-02  -2.74072423e-02
   -2.59786062e-02   8.50673015e-02   2.79729071e-02   9.38157266e-03
    1.08179891e-01   5.15147463e-02]
 [ -3.02270422e-01   2.93837495e-01   2.07116427e-01   1.12290328e-01
    2.83861663e-03   2.31464112e-02   7.69024618e-02   7.81105294e-01
   -8.04267161e-04   1.07472841e-01  -2.38860379e-02  -2.08203137e-03
    8.87218477e-02   5.66689041e-02  -3.51919454e-02   1.74833130e-02
   -2.85464436e-02  -5.89263810e-02   4.35206647e-02   1.65884448e-01
   -1.40301183e-03   5.41920775e-02  -1.98969570e-01  -8.78761839e-02
    8.41633365e-02   1.58092350e-02   6.45215961e-02   6.38851875e-02
   -7.80908489e-02  -1.40800512e-01]
 [  1.08911349e-01  -1.45420322e-02   2.72164754e-01  -7.60454362e-02
    5.39873976e-02   7.25970011e-02   2.73372791e-02  -3.70723995e-02
    9.09114536e-01  -8.26550033e-02  -6.06531004e-02   4.53887972e-02
    5.28552032e-02   4.43625053e-02  -7.20514234e-02  -6.34591960e-06
   -9.67600447e-02  -1.24229885e-02   2.22543699e-02   6.26576804e-02
   -5.24963615e-02   7.74687897e-02  -4.38008077e-02   1.06488927e-01
    1.21336565e-02   5.99905834e-02  -2.99842868e-02   6.44229190e-02
    1.29816969e-02   6.19091094e-02]
 [  3.39529797e-01  -7.83738623e-02   1.75039384e-01  -9.63374418e-02
    4.77582156e-02   6.40715854e-02  -4.36768642e-03   5.55293286e-02
   -1.04998049e-01   8.44570326e-01  -5.63122160e-02   9.15854120e-02
    2.25808954e-02   2.84575666e-02  -7.95648129e-02   5.89213102e-03
   -9.06400399e-02  -2.05231783e-02   1.01500446e-02  -4.11648320e-02
   -7.12729886e-02   6.86022410e-02   1.87980856e-02   1.55146805e-01
   -1.81620340e-02   5.64644312e-02  -5.33328593e-02   6.41075978e-02
    3.52960331e-02   1.70993310e-01]
 [  1.28709887e-02   4.93883947e-03   1.97946890e-01  -7.03232690e-02
    3.37730550e-02   4.51130748e-02   2.95402758e-02  -4.27613154e-02
   -5.48788478e-02  -3.58376138e-02   9.59536057e-01   1.97344092e-02
    3.97034088e-02   3.45857232e-02  -4.65356899e-02  -5.60278629e-03
   -5.29439134e-02   1.20029109e-03   1.86855510e-02   6.77732094e-02
   -2.74813010e-02   5.18163471e-02  -3.63712978e-02   6.28399196e-02
    1.32669909e-02   3.02403688e-02  -1.94822476e-02   3.63348324e-02
   -3.20712861e-03   1.34514393e-02]
 [ -2.57287177e-01  -3.49740112e-01  -3.70548708e-02   1.53695146e-01
    4.88417335e-02   2.98341862e-02  -8.58343964e-02   5.10177780e-02
    5.31980214e-02   6.32601354e-02   3.61674165e-02   8.03255172e-01
   -4.59747948e-02  -8.07975865e-02   1.25181351e-01  -1.05936853e-02
   -9.36882208e-02   6.95474642e-02  -5.98205051e-02   3.57270355e-02
    5.51135248e-02  -7.47319847e-02   8.65649719e-02  -7.75371696e-02
   -3.43674280e-02   9.06874708e-02   2.52649997e-02  -6.97676320e-02
    1.48307836e-01  -1.34004018e-01]
 [  6.90854241e-02  -1.21691677e-01  -1.94355884e-01  -1.85423615e-02
   -2.24766181e-02  -3.90613792e-02  -4.27891543e-02   1.05118835e-01
    3.86949305e-02  -7.79840849e-03   3.50069710e-02  -2.24667924e-02
    9.41288616e-01  -4.21527667e-02   4.60884630e-02  -8.66832830e-03
    5.16077351e-02   3.29317829e-02  -2.76042571e-02  -8.99421904e-02
    2.39512952e-02  -5.51975026e-02   1.02018286e-01  -8.15406998e-03
   -4.01430578e-02  -3.11717178e-02  -1.48819460e-02  -5.53156639e-02
    2.80369824e-02   2.74785693e-02]
 [  3.99638041e-02  -1.33930709e-01  -1.44229711e-01   1.40244359e-01
    3.54324066e-03  -4.73914952e-03  -6.63016092e-02   7.05926104e-02
    3.17567284e-02  -2.06133675e-03   3.14955797e-02  -4.77292763e-02
   -4.14628077e-02   9.46946104e-01   5.88145763e-02   1.41955760e-02
   -3.21371197e-02  -4.81638730e-03  -3.59110892e-02  -7.83025794e-02
    1.35876212e-02  -4.84412527e-02   5.31696974e-02  -4.27024546e-02
   -2.59022073e-02   3.79264992e-02   2.06489616e-02  -2.16311463e-02
    7.37927198e-02   1.01687078e-02]
 [  8.16943925e-02   1.76274770e-01   1.95634447e-01  -1.65874712e-01
    2.11443014e-03   1.86469833e-02   7.66419119e-02  -7.08776009e-02
   -6.59977309e-02  -4.43858135e-02  -5.09835138e-02   1.00511502e-01
    5.67852382e-02   7.19796874e-02   9.02752879e-01  -7.44714287e-03
    1.63243169e-02  -1.80477772e-02   4.74491506e-02   6.25793524e-02
   -4.12564967e-02   7.79960816e-02  -7.07111826e-02   8.68950506e-02
    2.96118055e-02  -3.13373638e-02  -3.21659192e-02   5.34839494e-02
   -8.52959481e-02   5.13717560e-02]
 [ -6.97341391e-02  -9.51400072e-02   1.75278889e-02  -1.67249797e-01
   -5.50139646e-04  -1.21766548e-02   1.47340647e-02   3.23070578e-02
    5.36576122e-03   7.10454360e-03  -5.07436421e-04  -3.25514000e-02
   -1.71724980e-02   1.62587401e-03   8.65056386e-03   9.65802396e-01
    4.75140844e-02   7.06247241e-02  -1.31204616e-03   3.61888455e-02
    2.18593750e-02  -1.13796646e-02   6.73445768e-02   3.64810666e-02
   -2.04220406e-02  -4.03319583e-02  -4.01576736e-02  -4.95505853e-02
   -8.81891217e-03  -2.98489206e-02]
 [  8.13876681e-02  -1.87464987e-01   3.46209508e-01   3.87484169e-01
    1.36139720e-01   1.70470686e-01  -7.90818105e-02  -6.46640466e-02
   -1.02521102e-01  -8.91955279e-02  -5.76176117e-02  -5.58240133e-02
    6.96934380e-02  -1.75470694e-02  -5.13584420e-03   6.19342758e-02
    6.50982785e-01  -9.83644745e-02  -2.45166898e-02   4.83519563e-02
   -7.49761744e-02   6.93803853e-02  -1.16110463e-01   1.77963266e-02
    2.38468875e-02   2.72750905e-01   6.05144859e-02   1.35238645e-01
    1.93519342e-01   3.57620938e-02]
 [  1.36108839e-01   2.86009297e-01  -3.31372720e-03   2.69155179e-01
   -1.21127152e-02   1.44230012e-02   4.24508563e-03  -9.56411090e-02
   -1.86335931e-02  -9.75546709e-03  -8.69597692e-03   1.00456960e-01
    5.03911921e-02   2.22752583e-02  -4.65389993e-02   6.36503277e-02
   -5.99990736e-02   8.54692699e-01   2.14059837e-02  -5.06213102e-02
   -4.88972906e-02   4.16961719e-02  -1.61356768e-01  -6.00482813e-02
    5.40835513e-02   4.79581001e-02   7.28291754e-02   1.07930859e-01
   -3.07419483e-02   6.18102133e-02]
 [  3.25667548e-02  -1.19043441e-01  -7.11210542e-02   8.80251186e-02
    1.13718884e-02   6.34694783e-03  -4.75199864e-02   5.15869595e-02
    1.33892703e-02  -1.04499225e-02   1.64061091e-02  -3.75618602e-02
   -2.64228083e-02  -3.60113306e-02   3.85583918e-02   8.02554482e-03
   -3.67550973e-02   1.50084933e-03   9.74256658e-01  -4.67393287e-02
    6.14509523e-03  -2.87593314e-02   4.10084905e-02  -1.73574032e-02
   -2.01627341e-02   3.65033927e-02   9.43496926e-03  -1.28586596e-02
    6.08309354e-02   1.01182188e-02]
 [  4.30512335e-01   6.45075117e-02  -3.45540830e-01   1.24935576e-01
   -5.61454638e-02  -5.77853237e-02  -6.37390696e-02   1.38698217e-01
    1.91375372e-02  -8.74869726e-02   3.90024758e-02   1.19757385e-01
   -5.95797583e-02  -3.84473922e-02  -1.31235525e-03   4.16288536e-02
    5.36075876e-02  -8.18817750e-02  -1.99419542e-02   7.47387162e-01
   -2.82681070e-02  -3.85220551e-02   5.50283970e-02  -2.39441852e-03
   -3.28981330e-02  -3.08221329e-02   9.57666008e-03   1.59104948e-02
    2.60096576e-03   1.96948973e-01]
 [  1.31241531e-01   6.95520292e-02   1.34035573e-01   1.66880318e-02
    2.30108103e-02   4.00060836e-02   1.53329694e-02  -3.40119295e-02
   -5.71337278e-02  -5.82668766e-02  -3.55252443e-02   6.30500784e-02
    3.88253542e-02   3.06194092e-02  -5.61724632e-02   1.68608378e-02
   -6.17415540e-02  -4.63843682e-02   1.81835848e-02   6.57710043e-03
    9.55251556e-01   5.37046386e-02  -5.90290737e-02   5.14023354e-02
    1.74933601e-02   3.95859955e-02  -2.03869971e-03   6.39103359e-02
   -4.13546509e-03   6.75157446e-02]
 [ -2.08326986e-02  -9.99596397e-02  -2.45815965e-01   6.85462302e-02
   -3.05630580e-02  -4.93181994e-02  -5.23897769e-02   8.38931735e-02
    6.83784209e-02   3.59577299e-02   5.23611415e-02  -5.24613905e-02
   -6.25375711e-02  -5.60758308e-02   7.38877710e-02  -8.89237448e-04
    5.30818841e-02   2.27178293e-02  -3.43631107e-02  -8.58079037e-02
    4.03046520e-02   9.24869453e-01   8.29955877e-02  -6.56207236e-02
   -3.16574596e-02  -2.63272998e-02   1.31134701e-02  -6.24338757e-02
    3.30528246e-02  -1.96233740e-02]
 [ -1.31779536e-01   3.93303388e-01   1.77682895e-01   2.37190764e-01
   -7.42278606e-04   3.22277590e-02   6.32899367e-02  -2.24802253e-01
   -2.05104606e-02   6.63589086e-02  -2.88919991e-02   6.47530126e-02
    1.01757670e-01   6.04922339e-02  -6.19444758e-02   5.13868078e-02
   -6.52059835e-02  -1.33072234e-01   4.79498847e-02   9.88459467e-02
   -3.56824534e-02   7.32382526e-02   7.49670452e-01  -9.13497374e-02
    9.67796567e-02   4.51658664e-02   8.89890033e-02   1.19030660e-01
   -7.70440856e-02  -6.11944308e-02]
 [ -1.97788242e-01   1.44119786e-01  -2.88131110e-01   3.53422762e-01
   -5.22401288e-02  -5.86380657e-02  -4.43161875e-02  -5.05216301e-02
    1.13181346e-01   1.37166610e-01   7.31841121e-02  -5.91537851e-02
   -2.52663884e-02  -5.45180418e-02   9.17506264e-02   4.30024664e-02
    3.08027655e-02  -7.08208496e-02  -2.43357616e-02  -5.75340289e-02
    4.84787914e-02  -7.82490464e-02  -6.94837475e-02   7.86683209e-01
    2.80933178e-02   8.22654355e-06   1.07984185e-01  -1.41590264e-02
    2.50437993e-03  -1.11559793e-01]
 [  8.48120477e-02  -1.56510791e-01  -6.05549309e-02  -6.23959692e-02
    6.29292658e-03  -3.77411328e-03  -3.16729152e-02   8.90796005e-02
    2.59949673e-04  -3.83140872e-02   8.19370013e-03  -1.89393444e-02
   -3.66801722e-02  -2.49776407e-02   2.08967768e-02  -1.33657531e-02
    5.02896654e-03   3.93960654e-02  -2.01555357e-02  -4.84795100e-02
    5.85193113e-03  -2.37992756e-02   9.04118224e-02   3.88618513e-02
    9.62966713e-01  -1.53027102e-03  -3.06434019e-02  -3.44267392e-02
    4.09238552e-02   3.94357347e-02]
 [ -6.45668029e-02   1.57317869e-01  -2.20984884e-01  -3.50350085e-01
   -1.02201340e-01  -1.27141788e-01   7.65152965e-02   3.96906320e-02
    6.68745925e-02   6.23421139e-02   3.42170955e-02   5.30705858e-02
   -4.47869053e-02   2.66295893e-02  -1.16474883e-02  -5.41499133e-02
    2.74187415e-01   8.35471018e-02   2.69356072e-02  -1.65712297e-02
    5.34963245e-02  -4.02830875e-02   8.53608344e-02   7.22707389e-03
   -1.56069833e-02   7.81846571e-01  -5.78131946e-02  -1.01172076e-01
   -1.63053478e-01  -2.56748593e-02]
 [  5.38287062e-02  -1.22582134e-01   7.61280668e-02  -2.69529538e-01
    9.35440783e-03   6.74694023e-04   2.43950957e-02   6.17816796e-02
   -3.20746690e-02  -5.04568964e-02  -2.16790797e-02   7.27060729e-03
   -1.33236326e-02   1.78463339e-02  -2.60551813e-02  -4.23624748e-02
    4.39595804e-02   8.05693099e-02   6.37642859e-03   2.51665735e-02
    1.29745369e-04   1.30933256e-02   9.15733658e-02   1.08314136e-01
   -3.16722263e-02  -4.47560432e-02   9.25635552e-01  -3.91689598e-02
   -1.32482789e-02   3.41071717e-02]
 [ -9.94108371e-02  -1.84522813e-01  -1.85081073e-01  -1.46548799e-01
   -2.84513162e-02  -5.76643673e-02  -2.30284016e-02   1.05634942e-01
    6.35119502e-02   3.93706285e-02   4.27779417e-02  -7.81649364e-02
   -7.14512089e-02  -4.25887938e-02   6.92835229e-02  -4.15113803e-02
    1.05645297e-01   1.01722712e-01  -2.84030473e-02  -2.81026406e-02
    5.92876066e-02  -7.49452842e-02   1.46490041e-01  -1.12776906e-02
   -4.93104944e-02  -7.40941479e-02  -3.70145898e-02   8.89763984e-01
    1.15372774e-02  -5.11828525e-02]
 [ -9.91132425e-02   3.37710811e-01  -5.77802671e-02  -2.72360976e-01
   -8.78898147e-02  -9.24919583e-02   1.16406911e-01  -7.62469479e-02
    3.12901238e-02   7.05602939e-02   2.90849246e-03   9.64823521e-02
    1.79194557e-02   6.89798651e-02  -6.22185471e-02  -3.19995753e-02
    2.20227442e-01   2.09310568e-02   5.66315925e-02   5.05264196e-02
    2.26725227e-02   1.64751659e-02  -4.24855252e-02  -2.88020218e-03
    3.28838569e-02  -1.83571293e-01  -2.69791018e-02  -2.90629198e-02
    8.01628574e-01  -3.81842959e-02]
 [ -5.06979727e-01  -8.72192760e-02  -3.94490754e-02   8.96744052e-02
   -1.89079717e-03  -2.14414762e-02  -6.64434016e-03  -7.08890730e-02
    9.69496426e-02   1.75911295e-01   4.52923552e-02  -1.84494870e-01
   -1.54098066e-02  -3.94829351e-02   1.09625441e-01  -2.26723728e-02
    2.12156889e-02   6.95061463e-02  -2.33501002e-02   1.29311010e-01
    8.65162396e-02  -6.94538327e-02  -6.96315197e-04  -1.50800942e-01
    1.25260009e-02  -2.42754966e-03   4.81048029e-02  -8.24281836e-02
    2.48717132e-02   7.49655951e-01]]

In [4]:
df_iris = pd.read_csv(u'../data/iris.txt',sep=' ')

df_iris


Out[4]:
sl sw pl pw c
0 5.1 3.5 1.4 0.2 1
1 4.9 3.0 1.4 0.2 1
2 4.7 3.2 1.3 0.2 1
3 4.6 3.1 1.5 0.2 1
4 5.0 3.6 1.4 0.2 1
5 5.4 3.9 1.7 0.4 1
6 4.6 3.4 1.4 0.3 1
7 5.0 3.4 1.5 0.2 1
8 4.4 2.9 1.4 0.2 1
9 4.9 3.1 1.5 0.1 1
10 5.4 3.7 1.5 0.2 1
11 4.8 3.4 1.6 0.2 1
12 4.8 3.0 1.4 0.1 1
13 4.3 3.0 1.1 0.1 1
14 5.8 4.0 1.2 0.2 1
15 5.7 4.4 1.5 0.4 1
16 5.4 3.9 1.3 0.4 1
17 5.1 3.5 1.4 0.3 1
18 5.7 3.8 1.7 0.3 1
19 5.1 3.8 1.5 0.3 1
20 5.4 3.4 1.7 0.2 1
21 5.1 3.7 1.5 0.4 1
22 4.6 3.6 1.0 0.2 1
23 5.1 3.3 1.7 0.5 1
24 4.8 3.4 1.9 0.2 1
25 5.0 3.0 1.6 0.2 1
26 5.0 3.4 1.6 0.4 1
27 5.2 3.5 1.5 0.2 1
28 5.2 3.4 1.4 0.2 1
29 4.7 3.2 1.6 0.2 1
... ... ... ... ... ...
120 6.9 3.2 5.7 2.3 3
121 5.6 2.8 4.9 2.0 3
122 7.7 2.8 6.7 2.0 3
123 6.3 2.7 4.9 1.8 3
124 6.7 3.3 5.7 2.1 3
125 7.2 3.2 6.0 1.8 3
126 6.2 2.8 4.8 1.8 3
127 6.1 3.0 4.9 1.8 3
128 6.4 2.8 5.6 2.1 3
129 7.2 3.0 5.8 1.6 3
130 7.4 2.8 6.1 1.9 3
131 7.9 3.8 6.4 2.0 3
132 6.4 2.8 5.6 2.2 3
133 6.3 2.8 5.1 1.5 3
134 6.1 2.6 5.6 1.4 3
135 7.7 3.0 6.1 2.3 3
136 6.3 3.4 5.6 2.4 3
137 6.4 3.1 5.5 1.8 3
138 6.0 3.0 4.8 1.8 3
139 6.9 3.1 5.4 2.1 3
140 6.7 3.1 5.6 2.4 3
141 6.9 3.1 5.1 2.3 3
142 5.8 2.7 5.1 1.9 3
143 6.8 3.2 5.9 2.3 3
144 6.7 3.3 5.7 2.5 3
145 6.7 3.0 5.2 2.3 3
146 6.3 2.5 5.0 1.9 3
147 6.5 3.0 5.2 2.0 3
148 6.2 3.4 5.4 2.3 3
149 5.9 3.0 5.1 1.8 3

150 rows × 5 columns


In [28]:
X = np.vstack((np.mat(df_iris.sl),np.mat(df_iris.sw), np.mat(df_iris.pl), np.mat(df_iris.pw) ))

#plt.plot(X[0,:], X[2,:],'kx')
#plt.show()

U,S,VT = np.linalg.svd(X)

K = 2

X_approx = U[:,0:2]*np.diag(S[0:2])*VT[0:2,:]

print(X[:,0:5])

X_approx[:,0:5]


Z = np.diag(S[0:2])*VT[0:2,:]
plt.plot(Z[0,:], Z[1,:],'ko')
plt.show()


[[ 5.1  4.9  4.7  4.6  5. ]
 [ 3.5  3.   3.2  3.1  3.6]
 [ 1.4  1.4  1.3  1.5  1.4]
 [ 0.2  0.2  0.2  0.2  0.2]]

ALS : Alternating Least Squares


In [48]:
## Y = A*B

M = 10
N = 20
K = 2

A_true = np.mat(np.random.randn(M, K))
B_true = np.mat(np.random.randn(K, N))

Y = A_true*B_true + 0.01*np.random.randn(M, N)



#plt.imshow(Y, interpolation='nearest')



U,S,VT = np.linalg.svd(Y)

plt.plot(S)


Out[48]:
[<matplotlib.lines.Line2D at 0x10a73aa10>]

In [49]:
B = np.linalg.pinv(A_true)*Y

print(B)

print(B_true)


[[-0.24689075  1.57755101 -0.40278582 -0.97668021  0.83105358 -0.39167884
   0.42919512  0.32386468 -0.21709037 -1.03028013  0.82323109 -0.21183812
   0.34578657 -2.27599858  1.70841411  1.0604837  -0.48612418 -0.10871185
   0.92060881 -0.02923552]
 [-1.02162883 -0.31562673 -0.26050259 -2.68765201 -0.07986925  1.67245433
  -0.65703119  1.49145806 -0.64543568  0.41723178 -2.12081694  0.45172714
   0.92322494  1.05729907 -0.95724887  0.85934019  1.07326711 -1.44889833
   0.28261623  1.84063881]]
[[-0.25720486  1.57520013 -0.40790521 -0.97979845  0.82904462 -0.38912155
   0.41717713  0.33143982 -0.21769882 -1.03915673  0.82424218 -0.20780859
   0.34309775 -2.26655924  1.71285713  1.06395845 -0.48792366 -0.11096627
   0.9202921  -0.02872279]
 [-1.02509732 -0.31157644 -0.26126411 -2.6852999  -0.09048101  1.67434223
  -0.6628631   1.49236572 -0.64664919  0.41193001 -2.12017968  0.44967789
   0.92065636  1.05725399 -0.94471663  0.86113879  1.06992555 -1.44693705
   0.28314188  1.83337281]]

In [58]:
A = np.mat(np.random.randn(M, K))
B = np.mat(np.random.randn(K, N))


for e in range(5):

    Y_est = A*B
    E = Y - Y_est
    err = np.sum(np.sum(np.array(E)*np.array(E)))
    print(err)

    B = np.linalg.pinv(A)*Y

    Y_est = A*B
    E = Y - Y_est
    err = np.sum(np.sum(np.array(E)*np.array(E)))
    print(err)

    A = (np.linalg.pinv(B.T)*Y.T).T

    Y_est = A*B
    E = Y - Y_est
    err = np.sum(np.sum(np.array(E)*np.array(E)))
    print(err)


616.260844618
206.41135676
0.022270864975
0.022270864975
0.012636800579
0.0126366287166
0.0126366287166
0.0126366287107
0.0126366287107
0.0126366287107
0.0126366287107
0.0126366287107
0.0126366287107
0.0126366287107
0.0126366287107

In [59]:
A


Out[59]:
matrix([[-3.84717275, -1.1647452 ],
        [ 0.59184538, -0.3115495 ],
        [-3.74445309,  3.04945327],
        [-8.20662843,  3.38580033],
        [-1.96267491, -0.82938965],
        [-1.59871863,  0.9701449 ],
        [-0.80395512, -1.67948961],
        [-2.77493982,  1.32603348],
        [ 1.34590873,  0.30487757],
        [-0.28603236,  0.10144157]])

In [60]:
A_true


Out[60]:
matrix([[ 1.43190551, -1.19740565],
        [ 0.04161512,  0.12247163],
        [-0.83908214, -0.64963932],
        [-0.07577827, -1.82300917],
        [ 0.85587752, -0.63988428],
        [-0.18214254, -0.3192553 ],
        [ 1.06418939, -0.42793252],
        [-0.12095646, -0.59426192],
        [-0.44321394,  0.4036003 ],
        [ 0.00950295, -0.06394318]])

In [61]:
U,S,VT = np.linalg.svd(Y)

A.T*U[:,2:]


Out[61]:
matrix([[ -1.63365721e-15,   6.36577266e-16,   2.19513670e-16,
          -2.04362614e-16,   6.70384178e-16,  -5.96420160e-16,
           1.41153760e-15,  -2.96043897e-16],
        [ -3.10030222e-16,   1.38068360e-16,  -5.57825729e-17,
           2.72405407e-16,  -8.13897637e-16,  -1.08668305e-16,
          -7.28972350e-17,   5.72466795e-16]])

Stochastic Gradient Descent (SGD)

Rank of approximation is $1$


In [19]:
%matplotlib inline
import numpy as np
import pandas as pd
from IPython import display
import matplotlib.pylab as plt

Nr = 2
Nc = 3

M = np.mat('[0, 1, 1;1, 1, 0]')
Y = np.mat('[0, 2, 4;3, 5, 0]')


Ys = np.mat('[2,0,1;4,0,2;3,1,0;5, 1,1]')

Ysize = Ys.shape[0]

A = np.mat(np.random.rand(Nr, 1))
B = np.mat(np.random.rand(1, Nc))

E = np.array(M)*np.array(Y - A*B)
np.sum(E*E)/np.sum(np.array(M))

EPOCH = 100
Eta = 0.1
eta = Eta

for i in range(EPOCH):
    E = np.array(M)*np.array(Y - A*B)
    Err = np.sum(E*E)/np.sum(np.array(M))
    print(Err)
    
    for k in range(Ysize):
        u = Ys[k,1]
        m = Ys[k,2]
        
        err = Ys[k,0] - A[u,0]*B[0,m]
        
        temp_A = A[u,0] + eta*err*B[0,m]
        B[0,m]   = B[0,m] + eta*err*A[u,0]
        A[u,0]   = temp_A
    
    eta = Eta*1./(i+1)


11.0769926265
7.80241114215
3.72357836563
2.4509723585
1.93478423846
1.65921234432
1.48448980809
1.36134211049
1.26840506668
1.19491850061
1.13483533098
1.08446670746
1.04141634864
1.00404899851
0.971203861101
0.942030035965
0.915886963914
0.892281523467
0.870826796322
0.851214174311
0.833193972481
0.816561632379
0.801147698012
0.786810398221
0.773430067496
0.760904887881
0.749147596114
0.738082906728
0.727645473492
0.717778260712
0.708431230131
0.69956027342
0.691126337598
0.683094703402
0.675434385877
0.66811763342
0.66111950667
0.654417522613
0.647991352265
0.641822562651
0.635894395587
0.630191577225
0.624700153412
0.619407346838
0.614301432627
0.609371629634
0.604608005149
0.600001391098
0.595543310135
0.591225910276
0.587041906933
0.582984531371
0.579047484777
0.575224897218
0.571511290897
0.567901547176
0.564390876925
0.560974793803
0.55764909014
0.554409815117
0.551253255005
0.548175915217
0.545174503999
0.542245917574
0.539387226595
0.536595663769
0.533868612536
0.531203596699
0.52859827091
0.526050411934
0.523557910611
0.521118764455
0.518731070835
0.516393020671
0.51410289262
0.511859047688
0.509659924246
0.507504033405
0.505389954724
0.503316332232
0.501281870712
0.499285332259
0.497325533064
0.495401340416
0.493511669911
0.491655482832
0.489831783717
0.488039618067
0.486278070211
0.484546261302
0.482843347436
0.48116851789
0.479520993465
0.47790002493
0.47630489156
0.474734899755
0.473189381745
0.471667694369
0.47016921792
0.468693355063

Rank of approximation is $K$


In [68]:
Nr = 2
Nc = 3
Nk = 2

M = np.mat('[0, 1, 1;1, 1, 0]')
Y = np.mat('[0, 2, 4;3, 5, 0]')
Ys = np.mat('[2,0,1;4,0,2;3,1,0;5, 1,1]')
Ysize = Ys.shape[0]

A = np.mat(np.random.rand(Nr, Nk))
B = np.mat(np.random.rand(Nk, Nc))

EPOCH = 1000
Eta = 0.1
eta = Eta

for i in range(EPOCH):
    if i%10==0:
        E = np.array(M)*np.array(Y - A*B)
        Err = np.sum(E*E)/np.sum(np.array(M))
        print(Err)
    
    for k in range(Ysize):
        u = Ys[k,1]
        m = Ys[k,2]
        
        err = Ys[k,0] - A[u,:]*B[:,m]
        
        temp_A = A[u,:] + eta*err[0,0]*B[:,m].T
        B[:,m]   = B[:,m] + eta*err[0,0]*A[u,:].T
        A[u,:]   = temp_A
    
    eta = Eta*1./(i+1)


11.3422372325
0.736754732138
0.555474395541
0.47752380818
0.430071947237
0.39688637519
0.371819075973
0.351924561689
0.335580985619
0.321807842737
0.309970930646
0.299638453819
0.290504324256
0.282344375977
0.27498996242
0.268311306351
0.262206600093
0.256594640472
0.251409714864
0.246597965381
0.242114749776
0.237922690372
0.233990207896
0.230290403431
0.226800194494
0.22349963944
0.220371403337
0.217400331453
0.214573105548
0.211877964533
0.209304475677
0.206843345842
0.2044862647
0.202225773693
0.200055155856
0.197968342688
0.195959835008
0.194024635387
0.192158190184
0.190356339614
0.188615274562
0.186931499079
0.185301797697
0.183723206853
0.182192989805
0.18070861456
0.179267734389
0.177868170576
0.176507897098
0.175185026995
0.173897800208
0.172644572695
0.171423806681
0.170234061893
0.169073987671
0.167942315846
0.166837854311
0.165759481189
0.164706139546
0.163676832585
0.162670619275
0.161686610355
0.160723964692
0.159781885951
0.158859619537
0.157956449794
0.157071697437
0.156204717177
0.155354895547
0.154521648887
0.153704421492
0.152902683892
0.152115931265
0.151343681967
0.150585476163
0.149840874566
0.149109457253
0.148390822574
0.14768458613
0.146990379819
0.146307850954
0.14563666143
0.144976486951
0.144327016307
0.143687950693
0.143059003076
0.142439897597
0.141830369013
0.141230162174
0.140639031524
0.140056740642
0.139483061804
0.13891777557
0.138360670398
0.137811542277
0.137270194384
0.136736436757
0.136210085986
0.135690964925
0.135178902415

In [72]:
print(Y)
print(M)
print(Ys)


[[0 2 4]
 [3 5 0]]
[[0 1 1]
 [1 1 0]]
[[2 0 1]
 [4 0 2]
 [3 1 0]
 [5 1 1]]

In [67]:
import scipy.sparse as sp

A = sp.rand(100, 100, 0.01).tocsr()

i,j,v = sp.find(A)

for e in zip(i,j):
    print(e, A[e[0], e[1]])


(1, 98) 0.482478627511
(2, 77) 0.780503468703
(3, 10) 0.129636903524
(3, 56) 0.0238030773016
(4, 86) 0.547844111056
(6, 61) 0.379767533489
(7, 70) 0.442947789129
(8, 58) 0.893137788745
(8, 69) 0.885420817687
(9, 0) 0.0436475536379
(9, 9) 0.167701688863
(10, 52) 0.0388379303701
(11, 67) 0.363836152597
(13, 5) 0.873801303159
(13, 14) 0.873283984149
(13, 65) 0.947130647143
(13, 89) 0.266336679173
(15, 49) 0.276220442002
(16, 2) 0.692775817969
(18, 94) 0.727966684564
(21, 41) 0.465043554285
(22, 82) 0.500404058784
(23, 26) 0.385445046497
(25, 10) 0.255050656851
(28, 68) 0.28975034871
(31, 11) 0.500241501491
(31, 73) 0.381562135314
(31, 96) 0.537722394598
(33, 6) 0.783271703857
(33, 34) 0.564569188796
(34, 26) 0.782941268309
(34, 82) 0.0764826403935
(35, 5) 0.73335356236
(35, 80) 0.516201873738
(38, 44) 0.556231019933
(38, 66) 0.962131341498
(38, 93) 0.465016755212
(39, 50) 0.141255642373
(40, 6) 0.480557911102
(40, 31) 0.585381030478
(41, 0) 0.605291849906
(41, 77) 0.460539047698
(41, 89) 0.908021341366
(43, 21) 0.49001345112
(45, 17) 0.770821531083
(45, 70) 0.734685604175
(46, 44) 0.649229603703
(46, 62) 0.565652797583
(46, 76) 0.0824170313498
(49, 24) 0.536272282158
(49, 25) 0.661647330608
(53, 69) 0.0110608486041
(54, 29) 0.00236617749464
(57, 4) 0.580245790421
(57, 29) 0.308933436687
(57, 59) 0.296220319497
(58, 41) 0.876986562871
(61, 41) 0.939679890153
(62, 2) 0.966497790573
(62, 30) 0.387822903865
(62, 86) 0.905531971938
(63, 98) 0.92034357567
(67, 43) 0.97299861077
(68, 93) 0.555730425763
(69, 16) 0.669076766805
(69, 75) 0.148771207577
(70, 81) 0.369202306162
(71, 63) 0.654889178285
(72, 31) 0.59111914435
(74, 11) 0.121282113032
(74, 47) 0.586723345194
(76, 90) 0.499288714119
(76, 91) 0.838696186895
(77, 85) 0.722611018017
(77, 94) 0.10016417359
(78, 33) 0.5720646032
(79, 10) 0.646337697603
(79, 13) 0.691246331531
(80, 39) 0.930164610524
(81, 66) 0.987652935885
(82, 97) 0.0117052061336
(84, 41) 0.253380311509
(85, 15) 0.381760835677
(86, 59) 0.333963825969
(86, 87) 0.238720503021
(87, 34) 0.367601100286
(88, 2) 0.614006040851
(88, 19) 0.302064928052
(88, 24) 0.443828763885
(89, 31) 0.179795196813
(90, 79) 0.838903405196
(91, 61) 0.824288098874
(92, 71) 0.476441088267
(92, 85) 0.156639313604
(95, 26) 0.236166438652
(95, 28) 0.363998956031
(95, 90) 0.316171700731
(96, 23) 0.863186139559
(97, 44) 0.162834010199
(97, 82) 0.743845008841

In [66]:
e[0]
e[1]

A[e[0],e[1]]
#print(A[e[0], e[1]])


Out[66]:
0.47047145259696732

In [132]:
import pandas as pd

#unames = ['user_id', 'gender', 'age', 'occupation', 'zip']
#expedia_test = pd.read_csv('~/Downloads/test.csv')

expedia_test = pd.read_csv('~/Downloads/test.csv',nrows=5)
et = pd.read_csv('~/Downloads/train-expedia.csv',nrows=100000)

In [91]:
idx = expedia_train.columns

for i in idx:
    print(i)


date_time
site_name
posa_continent
user_location_country
user_location_region
user_location_city
orig_destination_distance
user_id
is_mobile
is_package
channel
srch_ci
srch_co
srch_adults_cnt
srch_children_cnt
srch_rm_cnt
srch_destination_id
srch_destination_type_id
is_booking
cnt
hotel_continent
hotel_country
hotel_market
hotel_cluster

In [97]:
expedia_train['hotel_cluster']


Out[97]:
0       1
1       1
2       1
3      80
4      21
5      92
6      41
7      41
8      69
9      70
10     98
11     10
12     18
13     28
14     25
15     25
16     25
17     25
18     25
19      2
20      2
21     16
22     16
23     94
24     77
25     24
26     58
27     58
28     36
29     82
       ..
970    62
971    59
972    29
973    29
974    36
975    81
976    29
977    36
978    36
979    29
980    66
981    66
982    42
983    32
984    99
985    32
986     7
987    32
988    51
989    32
990    51
991    51
992     8
993    66
994    96
995    80
996    80
997    80
998    80
999    45
Name: hotel_cluster, dtype: int64

In [133]:
N = 100000

In [105]:
for i in range(N):
    print(et.date_time[i], et.user_id[i], et.is_booking[i], et.hotel_cluster[i])


2014-08-11 07:46:59 12 0 1
2014-08-11 08:22:12 12 1 1
2014-08-11 08:24:33 12 0 1
2014-08-09 18:05:16 93 0 80
2014-08-09 18:08:18 93 0 21
2014-08-09 18:13:12 93 0 92
2014-07-16 09:42:23 501 0 41
2014-07-16 09:45:48 501 0 41
2014-07-16 09:52:11 501 0 69
2014-07-16 09:55:24 501 0 70
2014-07-16 10:00:06 501 0 98
2014-07-16 10:02:58 501 0 10
2014-01-17 06:24:56 756 0 18
2014-01-18 14:33:31 756 0 28
2014-01-21 06:39:08 756 0 25
2014-01-21 06:40:18 756 0 25
2014-01-22 06:10:02 756 0 25
2014-01-24 11:52:04 756 0 25
2014-01-24 17:26:24 756 0 25
2014-02-27 17:44:23 756 0 2
2014-02-27 18:01:32 756 1 2
2014-12-30 09:50:51 756 0 16
2014-12-30 09:55:43 756 0 16
2014-12-30 09:56:26 756 0 94
2014-10-22 12:20:56 776 0 77
2014-11-10 12:38:02 776 0 24
2013-06-15 15:10:49 1048 0 58
2013-06-15 15:38:05 1048 1 58
2014-11-22 14:32:46 1048 0 36
2014-11-22 14:37:05 1048 0 82
2014-11-22 16:55:21 1048 0 46
2014-11-22 16:59:09 1048 0 30
2014-11-22 17:02:39 1048 0 36
2014-11-22 17:04:34 1048 0 29
2014-11-22 17:05:34 1048 0 57
2014-11-22 17:07:20 1048 0 29
2014-11-22 19:56:54 1048 0 46
2014-11-22 20:38:49 1048 0 30
2014-11-22 20:43:22 1048 0 85
2014-11-22 20:45:05 1048 0 46
2014-11-22 20:47:19 1048 0 36
2014-11-22 20:50:34 1048 0 36
2014-11-22 20:53:27 1048 0 82
2014-11-22 20:55:38 1048 0 5
2014-11-22 21:00:06 1048 0 29
2014-11-22 21:01:38 1048 0 59
2014-11-22 21:10:53 1048 0 29
2014-11-22 21:12:22 1048 0 62
2014-11-22 21:15:06 1048 0 81
2014-11-22 21:55:37 1048 0 46
2014-11-22 22:00:24 1048 0 59
2014-11-22 22:06:27 1048 0 29
2014-11-22 22:09:20 1048 0 29
2014-11-22 22:20:13 1048 0 36
2014-11-22 22:27:39 1048 0 81
2014-11-22 22:29:15 1048 0 29
2014-11-23 16:42:42 1048 0 59
2014-11-23 16:48:34 1048 0 36
2014-11-23 16:50:47 1048 0 46
2014-11-23 16:56:16 1048 0 36
2014-11-23 17:00:51 1048 0 81
2014-11-23 17:06:12 1048 0 6
2014-11-23 17:10:17 1048 0 82
2014-11-23 17:16:36 1048 0 81
2014-11-23 17:17:42 1048 0 36
2014-11-23 17:18:41 1048 0 29
2014-11-23 17:21:21 1048 0 36
2014-11-23 17:38:24 1048 0 36
2014-11-23 17:39:02 1048 0 29
2014-11-23 17:41:08 1048 0 36
2014-11-23 17:48:10 1048 0 36
2014-11-23 17:48:52 1048 0 53
2014-11-23 18:02:20 1048 1 36
2014-12-28 21:43:49 1048 0 8
2013-02-15 13:18:43 1482 0 28
2013-02-16 11:57:50 1482 0 73
2013-02-16 12:03:45 1482 0 26
2013-02-16 12:23:57 1482 0 28
2014-01-03 16:19:15 1482 0 95
2014-01-03 16:30:17 1482 1 95
2014-01-03 16:34:26 1482 0 95
2014-01-03 16:44:56 1482 1 95
2014-01-03 16:58:19 1482 0 95
2014-01-03 17:11:36 1482 1 95
2014-01-04 14:57:08 1482 0 95
2014-01-04 15:01:54 1482 0 95
2014-01-04 15:02:07 1482 0 95
2014-01-08 13:28:56 1482 0 95
2014-01-08 13:31:34 1482 0 95
2014-01-08 13:38:03 1482 0 95
2014-01-08 13:42:16 1482 0 95
2014-01-08 13:46:42 1482 0 95
2014-01-08 13:57:04 1482 0 95
2014-01-08 13:58:04 1482 0 95
2014-01-08 14:03:36 1482 0 95
2014-01-08 14:09:47 1482 0 95
2014-01-08 14:15:40 1482 0 77
2014-01-08 14:18:31 1482 0 77
2014-01-08 14:30:25 1482 0 77
2014-05-14 14:57:51 1482 0 13
2014-05-14 14:58:59 1482 0 42
2014-08-14 20:50:04 1482 0 9
2014-08-14 21:10:56 1482 0 9
2014-08-16 19:42:12 1482 0 55
2014-08-16 19:42:57 1482 0 5
2014-08-16 19:44:47 1482 0 91
2014-08-16 19:46:54 1482 0 13
2014-08-16 19:49:05 1482 0 72
2014-08-16 19:50:30 1482 0 72
2014-10-10 17:01:59 1482 0 55
2014-10-10 17:18:14 1482 0 26
2014-11-28 07:54:16 1482 0 65
2014-09-15 14:53:17 1561 0 21
2014-09-15 14:55:35 1561 0 56
2014-09-15 14:57:40 1561 0 56
2014-09-15 14:58:24 1561 0 69
2014-09-15 15:02:20 1561 0 68
2014-09-15 15:08:49 1561 0 75
2014-09-15 18:28:49 1561 0 56
2014-09-15 19:07:14 1561 0 68
2014-10-24 11:36:56 1713 0 6
2014-10-24 11:43:49 1713 0 38
2014-10-29 14:09:39 1713 0 46
2014-10-29 14:09:51 1713 0 67
2014-10-29 14:12:29 1713 0 81
2014-10-29 14:14:11 1713 0 82
2014-10-29 14:14:40 1713 0 38
2014-10-29 14:15:20 1713 0 53
2014-10-29 14:32:19 1713 1 38
2014-12-05 09:49:53 1713 0 81
2014-12-05 09:51:18 1713 0 78
2014-12-05 09:51:47 1713 0 67
2014-12-05 09:54:55 1713 0 46
2014-12-05 09:58:15 1713 1 81
2013-01-10 18:04:37 2140 0 82
2013-01-10 18:24:37 2140 0 43
2013-01-10 18:26:40 2140 0 43
2013-01-10 18:30:08 2140 1 43
2013-01-10 18:30:27 2140 0 43
2013-12-01 21:59:08 2451 0 82
2013-12-01 21:59:58 2451 0 82
2013-12-01 22:00:44 2451 0 82
2013-12-01 22:14:52 2451 0 82
2013-12-02 01:46:54 2451 0 37
2013-12-02 01:48:57 2451 0 99
2013-12-02 02:04:08 2451 0 8
2013-12-02 02:05:21 2451 0 8
2013-12-02 02:08:28 2451 0 78
2013-12-02 02:15:55 2451 0 8
2013-12-02 02:22:05 2451 0 8
2013-12-02 02:22:24 2451 0 8
2013-12-02 02:25:52 2451 0 8
2013-12-02 02:29:44 2451 0 35
2013-12-02 02:31:37 2451 0 25
2013-12-02 03:06:16 2451 0 25
2013-12-02 03:06:49 2451 0 25
2013-12-02 03:07:37 2451 0 25
2013-12-02 03:08:12 2451 0 25
2013-12-02 04:30:54 2451 1 25
2013-12-02 04:42:45 2451 0 55
2013-12-02 04:43:21 2451 0 55
2014-01-25 23:50:48 2451 0 82
2014-01-25 23:53:08 2451 0 9
2014-01-25 23:54:43 2451 0 9
2014-01-26 00:00:22 2451 0 20
2014-02-23 20:54:40 2451 0 90
2014-07-17 23:59:01 2451 0 82
2014-07-18 00:24:15 2451 0 43
2014-07-18 00:50:04 2451 0 8
2014-07-18 00:55:09 2451 0 43
2014-07-18 01:00:38 2451 0 99
2014-07-18 01:02:17 2451 0 8
2014-07-18 01:30:54 2451 0 38
2014-07-18 01:32:26 2451 0 25
2014-07-18 01:33:35 2451 0 50
2014-07-18 01:36:40 2451 0 67
2014-07-18 01:45:12 2451 0 35
2014-07-18 01:47:01 2451 0 20
2014-07-18 01:51:02 2451 0 57
2014-07-18 01:56:25 2451 0 8
2014-07-18 02:02:04 2451 0 8
2014-07-18 02:09:17 2451 0 99
2014-07-18 02:12:54 2451 0 22
2014-07-18 02:13:49 2451 0 25
2014-07-18 02:18:23 2451 0 64
2014-07-18 02:24:43 2451 0 99
2014-08-03 02:26:07 2451 0 64
2014-08-03 02:42:08 2451 0 64
2014-08-03 02:53:13 2451 0 38
2014-08-09 03:11:39 2451 0 30
2014-08-09 03:18:47 2451 0 95
2014-08-09 03:23:10 2451 0 99
2014-08-09 03:24:25 2451 0 99
2014-08-09 03:37:51 2451 0 22
2014-08-09 03:48:37 2451 0 8
2014-08-12 01:00:18 2451 0 16
2014-08-12 01:16:01 2451 0 8
2014-08-12 01:30:06 2451 0 78
2014-08-17 15:06:49 2451 0 60
2014-08-17 15:08:38 2451 0 82
2014-08-19 05:46:35 2451 0 8
2014-11-09 21:05:35 2451 0 43
2014-11-09 21:21:06 2451 0 43
2014-11-15 18:34:24 2451 0 29
2014-11-15 18:38:39 2451 0 36
2014-11-15 18:56:23 2451 0 21
2014-12-16 18:15:25 2451 0 8
2014-12-16 19:35:04 2451 0 8
2014-12-17 02:37:10 2451 0 35
2014-12-20 05:22:02 2451 0 99
2014-12-20 05:23:53 2451 0 11
2014-12-23 02:33:01 2451 0 10
2014-12-23 02:36:20 2451 0 10
2014-12-23 02:37:22 2451 0 10
2014-12-23 02:41:05 2451 0 99
2014-12-23 02:42:36 2451 0 99
2014-12-23 02:43:34 2451 0 99
2014-12-23 02:51:30 2451 0 8
2014-12-23 02:54:06 2451 0 8
2014-12-23 02:56:53 2451 0 8
2014-12-23 03:02:55 2451 0 36
2014-12-23 03:04:08 2451 0 36
2014-12-23 03:04:48 2451 0 36
2014-12-23 03:05:38 2451 0 36
2014-12-23 03:14:46 2451 0 11
2014-12-23 03:26:32 2451 0 22
2014-12-23 03:33:36 2451 0 64
2014-12-23 03:35:53 2451 0 97
2014-12-23 04:05:53 2451 0 11
2014-12-23 19:15:34 2451 0 36
2014-12-23 19:16:22 2451 0 11
2014-12-23 19:19:47 2451 0 36
2014-12-23 19:21:24 2451 0 37
2014-12-23 19:22:12 2451 0 8
2014-12-23 19:32:23 2451 0 22
2014-12-25 03:03:12 2451 0 2
2014-12-25 03:18:37 2451 0 8
2014-12-25 03:25:58 2451 0 59
2014-12-25 03:28:41 2451 0 36
2014-12-25 03:31:21 2451 0 8
2014-12-25 03:34:34 2451 0 62
2014-12-25 15:17:59 2451 0 36
2014-12-25 15:19:49 2451 0 78
2014-12-25 15:30:52 2451 0 85
2014-12-25 15:32:48 2451 0 29
2014-12-25 15:35:37 2451 0 85
2014-12-25 15:38:08 2451 0 5
2014-12-25 15:39:35 2451 0 85
2014-12-26 18:07:23 2451 0 36
2014-12-26 18:08:11 2451 0 36
2014-12-26 18:15:36 2451 0 99
2014-12-26 18:19:27 2451 0 99
2014-12-26 18:24:16 2451 0 64
2014-12-26 18:27:42 2451 0 64
2014-12-26 18:29:41 2451 0 64
2014-12-26 18:38:03 2451 0 22
2014-12-26 18:42:15 2451 0 8
2014-12-26 18:56:31 2451 0 8
2014-12-26 18:57:17 2451 0 8
2014-12-26 19:01:36 2451 0 8
2014-12-26 19:05:13 2451 0 8
2014-12-28 19:29:08 2451 0 22
2014-12-28 19:35:08 2451 0 8
2014-12-28 19:36:53 2451 0 89
2014-12-28 19:57:37 2451 0 99
2014-12-28 20:07:08 2451 0 35
2014-12-28 20:17:17 2451 0 10
2014-12-28 20:21:47 2451 0 10
2014-12-28 20:38:09 2451 1 10
2014-12-28 23:47:30 2451 0 8
2014-12-28 23:50:31 2451 0 35
2014-12-29 00:02:47 2451 0 35
2014-12-29 00:06:53 2451 0 73
2014-12-29 00:12:39 2451 0 8
2014-12-29 00:19:14 2451 0 8
2014-12-29 00:49:51 2451 0 99
2014-12-29 01:11:43 2451 1 99
2014-12-29 01:18:50 2451 0 99
2014-12-29 03:49:56 2451 0 81
2014-12-29 03:54:53 2451 0 8
2014-12-29 03:57:45 2451 0 22
2014-12-29 04:00:54 2451 0 58
2014-12-29 04:04:02 2451 0 99
2014-12-29 04:14:18 2451 0 78
2014-12-29 04:20:22 2451 0 22
2014-12-29 04:26:03 2451 0 78
2014-12-29 04:30:58 2451 0 22
2014-12-29 04:36:18 2451 0 43
2014-12-29 04:55:10 2451 0 8
2014-12-29 04:57:18 2451 0 8
2014-12-29 04:59:04 2451 0 99
2014-12-29 05:04:33 2451 0 22
2014-12-30 00:54:57 2451 0 22
2014-12-30 01:01:01 2451 0 36
2014-12-30 01:03:51 2451 0 62
2014-12-30 01:08:58 2451 0 62
2014-12-30 01:13:33 2451 0 83
2014-12-30 01:17:18 2451 0 5
2014-12-30 01:19:53 2451 0 59
2014-12-30 01:23:53 2451 0 89
2014-12-30 01:40:53 2451 0 78
2014-12-30 01:46:29 2451 0 36
2014-12-30 03:05:55 2451 0 78
2014-12-30 03:12:28 2451 0 36
2014-12-30 04:27:51 2451 0 36
2014-12-30 04:28:26 2451 0 78
2014-12-30 04:51:53 2451 1 78
2014-12-30 04:54:46 2451 0 78
2014-12-30 05:36:56 2451 0 35
2014-12-30 05:41:44 2451 0 5
2014-12-30 05:49:01 2451 0 8
2014-12-30 05:51:52 2451 0 8
2014-12-30 05:57:36 2451 0 14
2014-12-30 06:01:18 2451 0 10
2014-12-30 06:04:13 2451 0 51
2014-12-30 06:08:20 2451 0 67
2014-12-30 06:13:23 2451 0 2
2014-12-30 06:21:14 2451 0 81
2014-12-30 06:30:29 2451 0 10
2014-12-30 06:34:50 2451 0 43
2014-12-30 06:40:52 2451 0 99
2014-12-30 06:50:02 2451 0 8
2014-12-30 06:52:58 2451 0 22
2014-12-30 07:03:24 2451 0 22
2014-12-30 07:11:52 2451 0 22
2014-12-30 07:16:35 2451 0 43
2014-12-30 07:22:52 2451 0 22
2014-12-30 07:28:19 2451 0 58
2014-12-30 07:35:54 2451 0 8
2014-12-30 08:09:46 2451 0 22
2014-12-30 08:17:36 2451 0 22
2014-12-30 08:56:35 2451 1 8
2014-12-30 09:28:02 2451 0 8
2014-12-30 09:30:09 2451 0 36
2014-12-30 09:32:00 2451 0 14
2014-12-30 09:53:39 2451 0 22
2014-12-30 10:01:12 2451 0 99
2014-12-30 10:16:27 2451 0 81
2014-12-30 10:20:06 2451 0 78
2014-12-30 10:21:32 2451 0 62
2014-12-30 10:25:42 2451 0 8
2014-12-30 10:29:53 2451 0 15
2014-12-30 10:36:00 2451 0 8
2014-12-30 10:43:34 2451 0 8
2014-12-30 10:49:13 2451 0 8
2014-12-30 10:54:55 2451 0 43
2014-12-30 11:10:27 2451 0 15
2014-12-30 11:20:31 2451 0 82
2014-12-30 11:27:02 2451 0 99
2014-12-30 11:29:22 2451 0 99
2014-12-30 11:48:30 2451 0 15
2014-12-30 12:43:43 2451 1 15
2014-12-30 12:51:34 2451 1 15
2014-12-30 12:59:26 2451 0 36
2014-12-30 12:59:46 2451 0 10
2014-06-03 10:38:09 2677 0 57
2014-06-03 10:41:10 2677 0 35
2014-06-03 10:42:21 2677 0 89
2014-06-03 10:42:41 2677 0 89
2014-06-03 10:54:05 2677 0 89
2014-06-03 10:56:21 2677 0 14
2014-06-03 10:56:50 2677 0 30
2014-06-03 10:58:45 2677 0 81
2014-06-03 10:59:52 2677 0 8
2014-06-03 11:09:00 2677 0 40
2014-06-03 12:03:25 2677 0 57
2014-06-03 14:48:37 2677 0 62
2014-06-06 15:23:10 2677 0 62
2014-04-18 16:36:09 3313 0 18
2014-04-18 16:39:06 3313 0 91
2014-04-18 16:39:33 3313 0 91
2014-04-19 09:15:46 3313 0 91
2014-04-19 09:44:32 3313 1 91
2014-04-29 16:32:53 3313 0 45
2014-06-17 05:41:31 3313 0 10
2014-06-17 05:47:16 3313 0 10
2014-06-17 05:50:10 3313 0 84
2014-06-19 23:00:47 3313 0 10
2014-06-19 23:02:14 3313 0 10
2014-07-31 22:34:54 3313 0 54
2014-10-05 04:20:01 3313 0 54
2014-10-05 20:45:36 3313 0 77
2014-10-05 20:46:38 3313 0 54
2014-10-05 20:47:17 3313 0 54
2014-10-05 20:52:31 3313 0 54
2014-10-05 20:53:10 3313 0 54
2014-10-06 17:08:20 3313 0 77
2014-10-06 17:09:42 3313 0 54
2014-10-06 17:10:48 3313 0 54
2014-10-09 20:21:17 3313 0 54
2014-10-12 08:00:06 3313 0 54
2014-10-13 15:20:55 3313 0 54
2014-10-13 15:22:10 3313 0 77
2014-10-13 15:24:05 3313 0 54
2014-10-13 15:24:40 3313 0 76
2014-10-13 15:25:05 3313 0 17
2014-10-13 15:25:37 3313 0 54
2014-10-18 18:24:10 3313 0 54
2014-10-18 18:28:51 3313 0 54
2014-10-18 18:30:10 3313 0 54
2014-10-18 18:30:59 3313 0 54
2014-10-18 18:35:06 3313 1 54
2014-11-15 12:51:28 3313 0 54
2014-11-15 12:55:27 3313 0 49
2014-12-21 16:19:34 3313 0 54
2014-12-21 16:21:54 3313 0 54
2014-12-21 16:46:38 3313 0 17
2013-11-09 07:43:56 3925 0 42
2013-11-09 07:45:52 3925 1 42
2013-11-09 07:47:05 3925 0 42
2013-11-09 07:48:54 3925 1 42
2014-05-07 14:23:23 3925 0 32
2014-05-07 14:27:45 3925 1 32
2014-05-10 10:12:38 3925 0 7
2014-05-10 10:17:00 3925 1 7
2014-09-20 15:29:59 3925 0 68
2014-09-20 15:34:26 3925 0 40
2014-09-20 15:38:02 3925 0 83
2014-09-20 15:43:33 3925 1 83
2014-09-20 15:50:13 3925 0 37
2014-09-20 15:53:12 3925 0 83
2014-09-20 15:54:18 3925 0 83
2014-09-20 16:20:21 3925 0 72
2014-09-20 16:28:31 3925 0 18
2014-09-20 16:33:13 3925 0 50
2014-09-20 16:43:37 3925 1 18
2014-11-06 17:42:05 3925 0 7
2013-06-18 19:06:42 3972 0 76
2013-06-18 19:08:38 3972 0 5
2013-06-18 19:11:48 3972 0 37
2013-06-18 19:26:44 3972 0 37
2013-06-18 19:40:07 3972 0 37
2013-06-18 19:43:20 3972 0 51
2013-06-24 23:59:15 3972 0 30
2013-06-25 00:00:57 3972 0 30
2013-06-25 00:02:16 3972 0 30
2013-06-25 00:07:09 3972 0 30
2013-06-25 00:07:30 3972 0 30
2013-06-25 00:07:53 3972 0 30
2013-06-25 00:09:38 3972 0 30
2013-06-25 00:10:18 3972 0 30
2013-06-25 00:14:23 3972 0 30
2014-05-02 20:36:57 3972 0 45
2014-05-02 20:38:59 3972 0 24
2014-05-02 20:39:51 3972 0 24
2014-05-04 23:00:09 3972 0 45
2014-05-04 23:02:18 3972 0 24
2014-05-04 23:03:28 3972 0 24
2014-05-04 23:04:38 3972 0 88
2014-05-08 17:26:09 3972 0 1
2014-05-08 17:26:34 3972 0 45
2014-05-08 17:27:23 3972 0 45
2014-05-08 17:36:20 3972 0 24
2014-05-08 17:36:37 3972 0 24
2014-05-08 17:39:28 3972 0 24
2014-05-08 17:39:40 3972 0 24
2014-05-08 17:44:06 3972 0 24
2014-05-08 17:44:59 3972 0 24
2014-05-08 17:47:19 3972 0 45
2014-05-08 17:48:13 3972 0 45
2014-05-08 17:50:09 3972 0 88
2014-05-08 17:54:13 3972 0 24
2014-05-08 17:54:36 3972 0 24
2014-05-09 12:40:54 3972 0 24
2014-05-09 13:04:53 3972 0 24
2014-05-09 18:17:11 3972 0 24
2014-05-09 18:26:19 3972 0 88
2014-05-09 21:15:44 3972 0 84
2014-05-09 21:45:57 3972 0 45
2014-05-09 23:45:29 3972 0 79
2014-05-09 23:52:44 3972 0 45
2014-07-08 23:32:22 3972 0 9
2014-07-08 23:35:28 3972 0 68
2014-07-08 23:38:29 3972 0 83
2014-07-08 23:39:13 3972 0 72
2014-07-08 23:41:13 3972 0 72
2014-07-08 23:42:18 3972 0 4
2014-07-08 23:59:44 3972 0 39
2014-07-09 00:00:17 3972 0 9
2014-07-09 00:12:25 3972 0 4
2014-07-09 00:13:02 3972 0 40
2014-07-09 00:15:39 3972 0 98
2014-07-09 00:20:52 3972 0 41
2014-07-09 00:23:10 3972 0 10
2014-07-09 00:23:24 3972 0 47
2014-07-09 00:53:00 3972 0 41
2014-07-09 01:11:04 3972 0 39
2014-07-09 01:12:31 3972 0 19
2014-07-09 01:13:14 3972 0 72
2014-07-09 01:29:21 3972 0 18
2014-07-09 01:31:17 3972 0 70
2014-07-09 01:33:25 3972 0 33
2014-07-09 01:34:53 3972 0 41
2014-07-09 01:37:50 3972 0 70
2014-07-09 01:40:37 3972 0 72
2014-07-09 01:43:12 3972 0 72
2014-07-09 01:45:59 3972 0 91
2014-07-09 01:49:02 3972 0 33
2014-07-09 01:49:50 3972 0 21
2014-07-09 01:52:31 3972 0 18
2014-07-09 01:56:37 3972 0 41
2014-07-09 12:06:45 3972 0 72
2014-07-09 13:37:38 3972 0 70
2014-07-09 13:38:42 3972 0 72
2014-07-09 13:40:10 3972 0 18
2014-07-09 13:42:05 3972 0 72
2014-07-09 13:45:54 3972 0 48
2014-07-09 13:52:03 3972 0 4
2014-07-09 13:52:58 3972 0 9
2014-07-09 13:55:28 3972 0 41
2014-07-09 13:57:03 3972 0 41
2014-07-09 14:14:27 3972 0 48
2014-07-09 14:15:47 3972 0 33
2014-07-09 23:46:27 3972 0 37
2014-07-09 23:47:49 3972 0 41
2014-07-09 23:52:06 3972 0 4
2014-07-09 23:54:23 3972 0 41
2014-07-09 23:55:25 3972 0 41
2014-07-09 23:56:50 3972 0 69
2014-07-09 23:59:11 3972 0 16
2014-07-10 00:02:08 3972 0 4
2014-07-10 00:02:55 3972 0 18
2014-07-10 00:05:21 3972 0 39
2014-07-10 00:06:55 3972 0 4
2014-07-10 00:13:33 3972 0 9
2014-07-10 00:24:00 3972 0 18
2014-07-10 00:25:56 3972 0 93
2014-07-10 00:34:59 3972 0 21
2014-07-10 00:40:08 3972 0 98
2014-07-10 00:42:00 3972 0 0
2014-07-10 00:44:50 3972 0 34
2014-07-10 00:47:34 3972 0 28
2014-07-10 00:48:13 3972 0 70
2014-07-10 00:50:38 3972 0 38
2014-07-10 00:51:14 3972 0 28
2014-07-10 01:08:54 3972 0 4
2014-07-10 01:10:07 3972 0 68
2014-07-10 01:12:46 3972 0 72
2014-07-10 01:16:43 3972 0 97
2014-07-10 01:18:24 3972 0 18
2014-07-10 01:19:12 3972 0 33
2014-07-10 01:20:01 3972 0 41
2014-07-10 01:21:52 3972 0 41
2014-07-10 01:22:28 3972 0 84
2014-07-10 01:23:20 3972 0 41
2014-07-10 01:26:32 3972 0 18
2014-07-10 01:27:43 3972 0 19
2014-07-10 01:28:44 3972 0 41
2014-07-10 01:29:25 3972 0 18
2014-07-10 01:41:48 3972 0 48
2014-07-10 01:43:34 3972 0 91
2014-07-10 01:44:33 3972 0 19
2014-07-10 01:46:49 3972 0 68
2014-07-10 23:20:44 3972 0 38
2014-07-10 23:24:19 3972 0 80
2014-07-10 23:26:18 3972 0 63
2014-07-10 23:28:54 3972 0 41
2014-07-10 23:43:22 3972 0 72
2014-07-10 23:59:59 3972 0 72
2014-07-11 00:11:07 3972 0 18
2014-07-11 00:11:37 3972 0 5
2014-07-11 00:17:47 3972 0 37
2014-07-11 00:19:53 3972 0 98
2014-07-11 00:21:50 3972 0 97
2014-07-11 00:22:51 3972 0 97
2014-07-11 00:26:03 3972 0 18
2014-07-11 00:41:31 3972 0 95
2014-07-11 00:42:31 3972 0 37
2014-07-11 00:52:47 3972 0 91
2014-07-11 00:53:30 3972 0 51
2014-07-11 00:55:51 3972 0 83
2014-07-11 14:27:07 3972 0 28
2014-07-11 14:32:13 3972 0 28
2014-07-12 11:45:13 3972 0 80
2014-07-12 11:47:27 3972 0 94
2014-07-12 11:48:13 3972 0 96
2014-07-12 11:53:28 3972 0 34
2014-07-12 11:54:42 3972 0 37
2014-07-12 11:57:59 3972 0 91
2014-07-12 11:59:58 3972 0 41
2014-07-12 12:00:56 3972 0 41
2014-07-12 12:03:10 3972 0 97
2014-07-12 12:04:39 3972 0 84
2014-07-12 12:06:13 3972 0 28
2014-07-12 12:06:37 3972 0 28
2014-07-12 19:15:02 3972 0 91
2014-07-12 19:22:37 3972 0 39
2014-07-12 19:23:21 3972 0 83
2014-07-12 19:25:40 3972 0 95
2014-07-12 19:28:31 3972 0 91
2014-07-12 19:29:47 3972 0 41
2014-07-12 19:32:58 3972 0 28
2014-07-12 19:34:10 3972 0 41
2014-07-12 19:36:15 3972 0 41
2014-07-12 19:39:25 3972 0 37
2014-07-12 19:39:57 3972 0 37
2014-07-12 19:51:44 3972 0 72
2014-07-12 19:54:07 3972 0 18
2014-07-12 19:54:54 3972 0 18
2014-07-12 19:58:16 3972 1 18
2014-07-12 19:58:41 3972 0 18
2014-07-12 20:02:54 3972 1 18
2014-07-12 20:05:34 3972 0 68
2014-07-12 20:07:30 3972 0 95
2014-07-12 20:10:29 3972 1 95
2014-07-12 20:12:09 3972 0 95
2014-07-12 20:14:12 3972 1 95
2014-07-12 20:59:07 3972 0 19
2014-07-12 21:01:16 3972 0 70
2014-07-12 21:02:01 3972 0 21
2014-07-12 21:06:25 3972 0 21
2014-07-13 00:52:06 3972 0 48
2014-07-13 00:54:37 3972 0 55
2014-07-13 00:56:52 3972 0 4
2014-07-13 00:58:22 3972 0 34
2014-07-13 01:02:27 3972 0 18
2014-07-13 01:04:08 3972 0 17
2014-07-13 01:05:53 3972 0 28
2014-07-13 01:08:00 3972 0 37
2014-07-13 01:11:53 3972 0 77
2014-07-13 01:14:43 3972 0 55
2014-07-13 01:24:05 3972 0 41
2014-07-13 01:28:34 3972 0 17
2014-07-13 01:31:16 3972 0 72
2014-07-13 01:43:57 3972 0 84
2014-07-13 01:44:48 3972 0 13
2014-07-13 01:52:10 3972 0 91
2014-07-13 01:53:57 3972 0 41
2014-07-13 01:57:21 3972 0 41
2014-07-13 02:07:51 3972 0 18
2014-07-13 02:18:43 3972 0 41
2014-07-13 02:23:43 3972 0 51
2014-07-13 02:35:15 3972 0 13
2014-07-13 02:38:28 3972 0 21
2014-07-13 03:21:14 3972 0 90
2014-07-13 03:33:21 3972 0 94
2014-07-13 03:34:56 3972 0 63
2014-07-13 03:36:39 3972 0 84
2014-07-13 03:44:16 3972 0 17
2014-07-13 03:46:03 3972 0 18
2014-07-13 03:47:33 3972 0 5
2014-07-13 03:48:46 3972 0 19
2014-07-13 04:04:28 3972 0 37
2014-07-13 04:08:51 3972 0 0
2014-07-13 17:05:34 3972 0 21
2014-07-13 17:05:52 3972 0 98
2014-07-13 17:07:30 3972 0 98
2014-07-13 17:08:10 3972 0 95
2014-07-13 17:09:06 3972 0 68
2014-07-13 17:20:13 3972 0 55
2014-07-13 17:23:12 3972 0 19
2014-07-13 18:30:21 3972 0 49
2014-07-13 18:40:16 3972 0 37
2014-07-13 18:42:41 3972 0 37
2014-07-13 18:46:37 3972 0 68
2014-07-13 18:50:14 3972 0 68
2014-07-13 18:55:30 3972 0 55
2014-07-13 19:28:28 3972 0 75
2014-07-13 19:28:55 3972 0 95
2014-07-13 19:29:23 3972 0 95
2014-07-13 19:53:23 3972 0 37
2014-07-14 11:05:20 3972 0 22
2014-07-14 11:08:34 3972 0 25
2014-07-14 11:11:14 3972 0 97
2014-07-14 11:13:34 3972 0 93
2014-07-14 11:14:23 3972 0 93
2014-07-14 11:15:49 3972 0 18
2014-07-14 11:16:49 3972 0 91
2014-07-14 11:17:16 3972 0 18
2014-07-14 23:16:14 3972 0 69
2014-07-15 00:46:32 3972 0 75
2014-07-15 00:48:46 3972 0 41
2014-07-15 00:51:25 3972 0 96
2014-07-15 09:39:53 3972 0 41
2014-07-15 09:41:43 3972 0 83
2014-07-15 09:43:20 3972 0 91
2014-07-15 09:44:21 3972 0 41
2014-07-15 09:47:55 3972 0 33
2014-07-15 09:50:04 3972 0 41
2014-07-15 09:52:13 3972 0 41
2014-07-15 09:53:15 3972 0 83
2014-07-15 10:32:26 3972 0 41
2014-07-15 10:35:17 3972 0 70
2014-07-15 10:36:50 3972 0 21
2014-07-15 10:38:13 3972 0 96
2014-07-15 10:39:55 3972 0 70
2014-07-15 10:41:30 3972 0 73
2014-07-15 11:06:31 3972 0 68
2014-07-15 11:08:16 3972 0 84
2014-07-15 11:30:36 3972 0 91
2014-07-15 11:40:00 3972 0 91
2014-07-15 12:16:56 3972 0 70
2014-07-15 12:17:35 3972 0 70
2014-07-15 12:37:30 3972 0 96
2014-07-15 18:51:19 3972 0 70
2014-07-15 18:55:49 3972 0 21
2014-07-15 18:58:26 3972 0 96
2014-07-15 19:04:52 3972 0 70
2014-07-15 19:12:53 3972 0 21
2014-07-15 19:25:01 3972 0 70
2014-07-15 19:27:16 3972 0 96
2014-07-15 22:42:09 3972 0 91
2014-07-15 22:52:39 3972 0 69
2014-07-15 22:53:48 3972 0 41
2014-07-15 22:55:31 3972 0 75
2014-07-15 23:08:25 3972 0 84
2014-07-15 23:09:58 3972 0 83
2014-07-15 23:27:44 3972 0 17
2014-07-15 23:49:26 3972 0 91
2014-07-15 23:55:01 3972 0 84
2014-07-15 23:59:46 3972 0 68
2014-07-16 00:07:25 3972 0 70
2014-07-16 00:10:30 3972 0 41
2014-07-16 00:13:06 3972 0 41
2014-07-16 00:13:30 3972 0 96
2014-07-16 00:23:02 3972 0 33
2014-07-16 00:23:25 3972 0 91
2014-07-16 00:31:28 3972 0 18
2014-07-16 00:34:12 3972 0 70
2014-07-16 00:35:35 3972 0 91
2014-07-16 00:41:27 3972 0 41
2014-07-16 00:56:13 3972 0 41
2014-07-16 00:58:00 3972 0 41
2014-07-16 00:58:19 3972 0 41
2014-07-16 01:10:50 3972 0 21
2014-08-26 19:02:51 3972 0 46
2014-10-05 15:24:33 3972 0 30
2014-10-05 15:27:03 3972 0 38
2014-10-05 15:29:32 3972 0 67
2014-10-05 15:33:12 3972 0 20
2014-10-05 15:34:20 3972 0 44
2014-10-05 15:36:40 3972 0 53
2014-10-05 15:39:26 3972 0 78
2014-08-07 11:17:59 3994 0 25
2014-09-14 08:55:38 3994 0 44
2014-09-21 18:08:47 3994 0 25
2014-09-21 18:20:35 3994 0 98
2014-09-23 17:37:14 3994 0 97
2014-09-23 17:38:23 3994 0 98
2014-09-23 17:38:44 3994 0 98
2014-11-27 19:42:00 3994 0 30
2014-11-27 19:43:51 3994 0 3
2014-12-26 19:59:44 3994 0 30
2014-12-26 20:00:23 3994 0 3
2014-12-26 20:01:14 3994 0 99
2013-04-04 23:10:33 4413 0 12
2013-04-04 23:18:14 4413 1 12
2013-04-05 01:34:28 4413 0 12
2013-01-11 13:15:32 4539 0 86
2013-01-28 10:45:10 4539 0 57
2013-01-28 10:45:58 4539 0 82
2013-01-28 10:46:43 4539 0 81
2013-03-14 15:12:01 4539 0 62
2013-03-14 15:16:57 4539 1 62
2013-04-09 18:06:34 4539 1 19
2013-06-07 13:34:25 4539 1 56
2013-06-12 11:58:14 4539 1 20
2013-06-12 16:45:01 4539 0 38
2013-08-21 15:15:34 4539 0 8
2013-08-21 15:23:09 4539 1 8
2013-09-04 11:19:14 4539 0 82
2013-09-04 11:21:36 4539 0 82
2013-09-27 17:18:31 4539 0 68
2013-09-27 17:36:20 4539 1 68
2013-09-27 17:36:55 4539 1 68
2013-10-09 11:29:17 4539 0 25
2013-10-17 09:10:25 4539 0 82
2013-11-17 08:29:26 4539 0 82
2013-11-17 08:32:18 4539 1 82
2013-11-20 10:27:40 4539 0 71
2013-11-20 10:29:39 4539 0 1
2013-11-20 10:48:41 4539 0 91
2013-11-20 10:51:13 4539 0 40
2013-11-20 12:00:08 4539 0 1
2013-11-20 12:03:02 4539 1 1
2013-11-21 11:13:27 4539 0 91
2013-11-21 11:15:09 4539 1 91
2013-11-26 16:29:22 4539 0 15
2014-01-07 14:46:27 4539 0 64
2014-01-07 14:49:32 4539 1 64
2014-02-08 12:58:03 4539 0 46
2014-02-08 13:03:02 4539 1 46
2014-03-06 11:00:27 4539 0 61
2014-03-06 11:03:15 4539 1 61
2014-03-07 16:02:07 4539 0 85
2014-03-07 16:03:39 4539 1 85
2014-03-14 11:27:08 4539 0 72
2014-03-14 11:32:05 4539 1 72
2014-03-25 15:52:44 4539 0 36
2014-03-25 15:53:28 4539 0 29
2014-03-25 15:53:56 4539 0 82
2014-03-25 15:54:55 4539 0 82
2014-03-25 16:06:56 4539 0 36
2014-03-25 16:08:52 4539 1 36
2014-04-09 09:56:12 4539 0 64
2014-04-28 11:46:46 4539 0 65
2014-04-28 12:16:48 4539 1 65
2014-06-16 10:41:47 4539 0 73
2014-06-16 11:24:44 4539 0 90
2014-06-16 11:26:49 4539 1 90
2014-07-23 15:58:12 4539 0 53
2014-07-23 15:58:52 4539 0 85
2014-07-23 15:59:43 4539 0 14
2014-07-23 16:19:05 4539 0 53
2014-07-23 16:41:28 4539 0 30
2014-07-31 09:09:40 4539 0 78
2014-07-31 16:00:56 4539 0 43
2014-07-31 16:01:59 4539 0 8
2014-07-31 16:05:22 4539 0 8
2014-07-31 16:05:47 4539 0 8
2014-08-01 09:37:02 4539 0 16
2014-08-01 09:44:07 4539 0 82
2014-08-01 09:48:00 4539 0 16
2014-08-01 09:48:57 4539 0 2
2014-08-01 09:49:30 4539 0 25
2014-08-01 11:24:51 4539 0 59
2014-08-01 11:26:11 4539 0 46
2014-08-01 12:20:09 4539 0 46
2014-08-01 12:22:27 4539 1 46
2014-08-09 12:10:26 4539 0 25
2014-08-09 12:12:35 4539 0 25
2014-08-09 12:15:15 4539 0 11
2014-08-11 09:46:28 4539 0 11
2014-08-11 09:51:49 4539 1 11
2014-08-11 09:52:57 4539 0 11
2014-08-11 09:54:11 4539 1 11
2014-08-25 15:12:07 4539 0 83
2014-08-25 15:17:31 4539 0 83
2014-08-25 15:18:44 4539 0 28
2014-08-25 15:22:59 4539 0 72
2014-08-25 15:37:43 4539 0 61
2014-08-25 16:42:57 4539 0 83
2014-09-03 11:01:14 4539 0 81
2014-09-03 12:18:09 4539 0 14
2014-09-03 12:19:32 4539 0 14
2014-09-15 17:46:51 4539 0 26
2014-09-15 17:49:24 4539 0 64
2014-09-17 16:44:00 4539 0 40
2014-09-17 18:02:52 4539 1 40
2014-09-29 16:35:33 4539 0 37
2014-09-29 17:16:00 4539 1 37
2014-10-07 15:15:58 4539 0 30
2014-10-07 15:16:55 4539 0 30
2014-10-09 09:03:07 4539 0 46
2014-10-09 09:03:25 4539 0 46
2014-10-15 18:06:02 4539 0 62
2014-10-15 18:08:08 4539 1 62
2014-11-03 17:21:24 4539 0 25
2014-11-03 17:22:14 4539 0 42
2014-11-04 11:38:39 4539 0 17
2014-11-04 11:40:50 4539 0 25
2014-11-04 11:42:47 4539 0 25
2014-11-04 11:43:40 4539 0 42
2014-11-10 17:22:53 4539 0 99
2014-11-13 12:56:29 4539 0 42
2014-12-04 13:21:09 4539 0 3
2014-12-04 13:21:53 4539 0 57
2014-09-14 14:31:20 4704 0 99
2014-09-14 14:35:02 4704 0 95
2013-06-23 23:38:56 5131 0 57
2013-06-24 20:57:59 5131 0 16
2013-06-24 21:00:03 5131 0 47
2013-06-24 21:01:23 5131 0 10
2013-06-24 21:04:56 5131 0 54
2013-06-24 21:05:59 5131 0 51
2014-10-24 18:00:44 5677 0 65
2014-10-24 18:12:29 5677 0 66
2014-10-24 18:13:17 5677 0 65
2014-11-08 02:22:40 5677 0 21
2013-09-05 11:54:48 5736 0 60
2013-09-05 16:34:20 5736 0 60
2013-09-10 10:54:13 5736 0 9
2014-03-06 11:12:19 5736 0 78
2014-04-18 10:21:50 5736 0 67
2014-04-18 10:26:33 5736 0 99
2014-01-10 21:47:59 5770 0 65
2014-01-10 22:31:11 5770 0 52
2014-01-10 22:32:13 5770 0 65
2014-07-20 13:42:28 5776 0 78
2014-07-20 13:42:34 5776 0 30
2014-07-20 13:42:38 5776 0 44
2014-07-27 09:59:21 5776 0 58
2014-07-27 10:01:07 5776 0 60
2014-08-02 01:13:37 5776 0 58
2014-10-07 13:54:08 6258 0 70
2014-10-07 14:02:36 6258 0 70
2014-10-07 14:08:21 6258 1 70
2014-10-26 15:12:09 6258 0 83
2014-10-26 15:13:37 6258 0 17
2014-10-30 09:32:07 6258 0 45
2014-10-30 09:37:32 6258 0 45
2014-10-30 09:37:40 6258 0 79
2014-10-30 09:55:36 6258 1 45
2014-10-30 09:58:40 6258 0 45
2013-06-18 08:17:00 6300 0 78
2014-06-09 10:55:52 6300 0 64
2014-06-10 12:43:04 6300 0 64
2014-06-10 12:46:40 6300 0 64
2014-06-18 08:59:17 6300 0 64
2014-06-18 09:07:21 6300 0 64
2014-10-06 19:30:21 6304 0 28
2014-10-06 19:30:50 6304 0 28
2014-10-07 18:12:18 6304 0 15
2014-10-07 18:13:40 6304 0 15
2014-10-07 18:22:32 6304 0 42
2014-10-07 18:22:42 6304 0 42
2014-10-07 20:25:52 6304 0 4
2014-10-07 20:26:03 6304 0 4
2014-10-08 19:11:36 6304 0 15
2014-10-08 19:18:41 6304 0 6
2014-10-08 19:18:52 6304 0 6
2014-10-08 19:24:53 6304 1 6
2014-10-11 17:26:12 6304 0 95
2014-10-11 17:26:23 6304 0 16
2014-10-11 17:26:37 6304 0 95
2014-10-11 17:26:46 6304 0 16
2014-10-12 08:49:42 6304 0 83
2014-10-12 08:52:35 6304 0 83
2014-10-12 09:26:14 6304 0 83
2014-10-12 09:33:27 6304 1 83
2013-09-06 16:22:31 6330 0 83
2013-09-10 18:17:35 6330 0 48
2013-09-10 18:53:11 6330 0 48
2013-09-10 20:08:11 6330 0 48
2013-09-10 20:47:19 6330 0 48
2014-04-09 15:31:18 6330 0 41
2014-04-09 15:34:20 6330 0 70
2014-04-09 15:35:31 6330 0 98
2014-04-09 15:36:48 6330 0 70
2014-04-09 15:38:57 6330 0 41
2014-04-09 15:45:41 6330 0 41
2014-04-09 15:48:28 6330 0 56
2014-04-09 15:50:15 6330 0 37
2014-04-09 16:17:24 6330 0 56
2014-04-09 16:26:35 6330 0 70
2014-04-09 17:23:20 6330 1 37
2014-06-09 13:18:28 6330 0 82
2014-06-12 16:20:57 6330 0 73
2014-06-12 16:27:31 6330 0 8
2014-07-01 09:55:34 6330 0 90
2014-07-01 11:35:39 6330 0 90
2014-07-02 16:49:59 6330 0 30
2014-07-02 16:53:32 6330 0 8
2014-07-09 16:24:41 6330 0 2
2014-07-09 16:32:12 6330 0 22
2014-12-12 11:20:21 6330 0 78
2014-12-12 11:22:54 6330 1 78
2014-12-15 12:00:32 6330 0 36
2014-12-15 12:01:17 6330 0 67
2014-12-15 12:03:21 6330 0 58
2013-09-06 09:28:40 6356 0 59
2013-09-06 09:33:34 6356 0 9
2013-09-06 09:33:54 6356 0 95
2013-09-06 10:31:13 6356 1 59
2014-09-15 16:29:02 6356 0 12
2014-09-15 16:32:09 6356 0 36
2014-09-15 16:35:42 6356 0 46
2014-09-15 17:06:34 6356 0 36
2014-09-15 17:49:37 6356 1 36
2014-12-15 12:16:49 6356 0 29
2014-12-15 12:21:04 6356 0 62
2014-12-15 12:24:51 6356 0 59
2014-12-15 12:27:58 6356 0 46
2014-12-16 14:35:50 6356 0 12
2014-12-16 14:39:38 6356 0 46
2014-12-17 12:21:52 6356 0 46
2014-12-17 12:28:19 6356 0 46
2014-12-30 10:29:15 6356 0 46
2014-12-30 10:33:27 6356 0 54
2014-12-30 10:36:36 6356 0 59
2014-12-30 10:38:59 6356 0 62
2014-12-30 10:47:39 6356 0 59
2014-12-30 10:54:41 6356 0 29
2014-12-30 11:04:05 6356 0 29
2014-12-30 11:13:15 6356 0 36
2014-12-30 12:32:19 6356 0 81
2014-12-30 12:33:47 6356 0 29
2014-12-30 14:48:16 6356 0 36
2014-12-30 14:49:09 6356 0 36
2014-12-31 14:02:49 6356 0 29
2014-06-05 11:06:04 6450 0 66
2014-06-05 11:07:31 6450 0 66
2014-06-11 13:43:39 6450 0 42
2014-06-11 13:44:26 6450 0 32
2014-06-11 13:45:01 6450 0 99
2014-06-20 09:59:37 6450 0 32
2014-07-02 13:58:28 6450 0 7
2014-07-02 13:59:58 6450 0 32
2014-07-02 14:00:10 6450 0 51
2014-07-02 14:00:36 6450 0 32
2014-07-03 13:26:09 6450 0 51
2014-07-03 13:33:06 6450 1 51
2014-07-08 14:15:08 6450 0 8
2014-07-09 07:25:37 6450 0 66
2014-07-09 07:32:53 6450 0 96
2014-07-28 09:04:12 6450 0 80
2014-08-05 11:50:33 6450 0 80
2014-08-06 06:15:41 6450 0 80
2014-08-06 06:54:29 6450 1 80
2014-08-08 10:50:39 6450 0 45

In [134]:
users = {z for z in et.user_id}

index1 = {u: e for e,u in enumerate(users)}


Out[134]:
453

In [135]:
len(users)


Out[135]:
3478

In [136]:
import numpy as np

nU = len(users)

X = np.zeros((nU, 100))

for i in range(N):
    X[index1[et.user_id[i]], et.hotel_cluster[i]] += 1

In [155]:
nU = len(users)

X = np.zeros((nU, 100))
for i in range(N):
    if et.is_booking[i]:
        X[index1[et.user_id[i]], et.hotel_cluster[i]] += 1

In [8]:
%matplotlib inline

import matplotlib as mpl
import matplotlib.pylab as plt

plt.figure(figsize=(35, 250))
plt.imshow(X, interpolation='nearest', vmin=0, vmax=10)
plt.show()


<matplotlib.figure.Figure at 0x1122ab7f0>

In [163]:
plt.plot((np.sum(X,axis=0)))


Out[163]:
[<matplotlib.lines.Line2D at 0x10acb4b10>]

In [158]:
U, S, V = np.linalg.svd(X, full_matrices=False)

In [159]:
plt.plot(S)


Out[159]:
[<matplotlib.lines.Line2D at 0x10b43ba90>]

In [161]:
F = np.dot(diag(S), V)

plt.plot(F[0,:], F[1,:], '.')
plt.show()



In [166]:
F = np.dot(X.T, X)

plt.figure(figsize=(20, 20))
plt.imshow(F, interpolation='nearest')


Out[166]:
<matplotlib.image.AxesImage at 0x10cf51e10>