In [6]:
import numpy as np
import pylab as pl
%matplotlib inline
pl.rcParams['font.family']='Serif'

High-level overview of the FLOW-MAP algorithm:

  • Cluster the dataset
  • Build a graph over the clusters
  • Apply force-directed layout

In [7]:
X = np.random.randn(1000,2)

In [8]:
# downsampling:
# 1. Estimating density
# 2. Choosing as a function of density

In [9]:
from sklearn import neighbors

In [10]:
k = 10

In [11]:
knn = neighbors.NearestNeighbors()

In [12]:
knn.fit(X)


Out[12]:
NearestNeighbors(algorithm='auto', leaf_size=30, metric='minkowski',
         metric_params=None, n_neighbors=5, p=2, radius=1.0)

In [12]:


In [13]:
def local_density_k(X,k=10,metric=None):
    if metric != None:
        bt = neighbors.BallTree(X,200,metric=metric)
        neighbor_graph = neighbors.kneighbors_graph(X,k,'distance')
    else:
        neighbor_graph = neighbors.kneighbors_graph(X,k,'distance')
    distances = np.array(neighbor_graph.mean(1))[:,0]
    return 1-((distances - distances.min())/(distances.max() - distances.min()))

In [14]:
def local_density_r(X,r=0.1,metric=None):
    if metric != None:
        bt = neighbors.BallTree(X,200,metric=metric)
        neighbor_graph = neighbors.radius_neighbors_graph(bt,r)
    else:
        neighbor_graph = neighbors.radius_neighbors_graph(X,r)
    counts = np.array(neighbor_graph.sum(1))[:,0]
    return ((counts - counts.min())/(counts.max() - counts.min()))

In [15]:
def compute_accept_prob(densities,
                        outlier_density_percentile=1.0,
                        target_density_percentile=3.0):
    ''' densities is a vector of densities '''
    OD = np.percentile(densities,outlier_density_percentile)
    TD = np.percentile(densities,target_density_percentile)
    
    #print(OD,TD)
    accept_prob = np.zeros(len(densities))
    
    for i,LD in enumerate(densities):
        if LD < OD:
            accept_prob[i] = 0
        elif LD > OD and LD <= TD:
            accept_prob[i] = 1
        elif LD > TD:
            accept_prob[i] = TD/LD
            
    # output 
    return accept_prob

In [16]:
x = np.random.randn(10000)

In [17]:
pl.hist(x,bins=50);



In [17]:


In [18]:
densities = np.random.randn(1000)+10

In [19]:
ap = compute_accept_prob(densities)

In [20]:
pl.scatter(densities,ap)


Out[20]:
<matplotlib.collections.PathCollection at 0x110a1ecd0>

In [21]:
densities[(densities<8.1631259434) * (densities>7.71169482942)]


Out[21]:
array([ 8.15851434,  8.12451417,  7.75186286,  7.95183983,  7.71602212,
        8.00087246,  7.85041777,  8.0032515 ,  8.05398745,  7.72760175,
        8.05316315,  7.78089859,  7.95665332,  7.78644069,  7.97201151,
        7.90523761,  7.72817021,  8.10680589,  8.06742309,  8.0375628 ,
        7.85417807,  7.89940928])

In [22]:
np.percentile(np.random.randn(1000),50.0)


Out[22]:
0.0038274552182344743

In [23]:
def accept_according_to_probs(accept_prob):
    ''' just output indices'''
    return accept_prob > np.random.rand(len(accept_prob))

In [24]:
from sklearn import neighbors
from sklearn.neighbors import KernelDensity

def generate_blobs(num_samples=5000,separation=8):
    centers = np.array([[0,0],[1,0],[0,1],[1,1]],dtype=float)
    centers -= 0.5
    centers = np.vstack((centers,#centers*2,centers*3,
                         #centers*4,centers*5,centers*6,
                         #centers*7,centers*8,centers*9,
                         #centers*10,centers*11,centers*12,
                         #centers*13,centers*14,
                         [0,0]))
    centers *= separation
    kde = KernelDensity()
    kde.fit(centers)
    samples = kde.sample(num_samples)
    density = kde.score_samples(samples)
    return samples,density

samples,density = generate_blobs(5000,10)

In [25]:
pl.scatter(samples[:,0],samples[:,1],linewidths=0,alpha=0.1)


Out[25]:
<matplotlib.collections.PathCollection at 0x110468d50>

In [26]:
est_density = local_density_k(samples)

In [27]:
pl.hist(est_density,bins=50);



In [28]:
accept_prob = compute_accept_prob(est_density)

In [29]:
accept_ind = accept_according_to_probs(accept_prob)

In [30]:
downsampled = samples[accept_ind]

In [31]:
pl.scatter(downsampled[:,0],downsampled[:,1],linewidths=0,alpha=0.1)


Out[31]:
<matplotlib.collections.PathCollection at 0x110c45510>

In [32]:
len(downsampled),len(samples)


Out[32]:
(3788, 5000)

In [32]:


In [33]:
from sklearn.cluster import AgglomerativeClustering

In [34]:
# compare with other clustering algorithms

In [35]:
target_clust_num = 200
cluster_model = AgglomerativeClustering(target_clust_num)
C = cluster_model.fit_predict(downsampled)

In [35]:


In [ ]:


In [36]:
min(C),max(C)


Out[36]:
(0, 199)

In [41]:
C==0


Out[41]:
array([False, False, False, ..., False, False, False], dtype=bool)

In [42]:
C.shape,X.shape,downsampled.shape


Out[42]:
((3788,), (1000, 2), (3788, 2))

In [43]:
len(set(C)),max(C)


Out[43]:
(200, 199)

In [44]:
X.T.shape


Out[44]:
(2, 1000)

In [45]:
# compute cluster centers given cluster assignments
def compute_cluster_centers(X,C):
    centers = np.zeros((len(set(C)),len(X.T)))
    for i in set(C):
        points = X[C==i]
        centers[i] = np.mean(points,0)
    return centers

In [46]:
centers = compute_cluster_centers(downsampled,C)

In [47]:
centers.shape


Out[47]:
(200, 2)

In [48]:
from scipy.spatial import distance
pdist = distance.pdist(centers)
distmat = distance.squareform(pdist)

In [49]:
pl.imshow(distmat,interpolation='none')


Out[49]:
<matplotlib.image.AxesImage at 0x1102f0410>

In [73]:
r = np.percentile(pdist,1.0)
r


Out[73]:
0.6943251677682194

In [51]:
adj = (distmat < r)

In [75]:
num_neighbors = local_density_r(centers,r)
num_neighbors.shape


Out[75]:
(200,)

In [82]:
pl.hist(num_neighbors,bins=len(set(num_neighbors)));



In [77]:
sorted_clust_id = sorted(range(len(num_neighbors)),key=lambda i:num_neighbors[i])

In [83]:
min_edges = 2
max_edges = 20

In [91]:
def num_edges(densities,min_edges=2,max_edges=20):
    ''' pass in an array of densities'''
    assert(len(densities)>1)
    min_density = np.min(densities)
    max_density = np.max(densities)
    lambdas = densities / (max_density - min_density)
    return np.array(min_edges + lambdas*(max_edges - min_edges),dtype=int)

In [98]:
num_edges_array = num_edges(num_neighbors)
num_edges_array


Out[98]:
array([ 2,  8,  5,  8, 17,  2, 14,  8,  2,  2, 14,  5,  5,  2,  8,  2,  8,
        5,  5,  2,  2, 11, 14,  5,  5,  8,  8,  2, 11,  2, 14, 14,  2,  5,
        2,  2,  2,  8,  8, 14,  5,  2, 20, 14,  2,  2,  5,  2,  2, 14,  5,
        2,  8,  2, 14,  2, 14,  8, 20, 11,  2,  2, 17,  8, 20, 14, 14,  2,
        5,  5,  5,  5,  5,  5,  2, 11, 14,  8,  2,  5,  8,  8, 11,  5,  5,
        2, 17,  8, 11,  5,  2,  5,  5,  5, 14, 17, 11, 11,  8, 11, 14,  2,
        2,  2,  8,  2, 14,  8,  5,  8,  2, 17,  5, 17, 20,  2,  5,  8, 14,
       11,  5,  8,  2,  2, 14,  8, 14, 14, 17, 11,  2, 17, 11, 14, 11,  2,
        5, 17,  2, 14,  2,  2,  5,  5,  2, 14, 14,  5, 11,  2,  2, 17, 11,
       20,  2, 14,  2, 14, 14,  2,  2,  8,  2,  5,  2,  8,  8, 14, 11,  8,
       17,  8,  8, 11,  8,  2, 17,  2,  8, 11, 17, 14,  2,  5,  2,  8,  2,
       11,  5, 11,  5, 14, 14, 20,  8,  2, 17, 11,  8,  5])

In [95]:
nn = neighbors.NearestNeighbors(max_edges+1)
nn.fit(centers)


Out[95]:
NearestNeighbors(algorithm='auto', leaf_size=30, metric='minkowski',
         metric_params=None, n_neighbors=21, p=2, radius=1.0)

In [100]:
num_edges_array[0]


Out[100]:
2

In [123]:
nn.kneighbors(centers[0],num_edges_array[0]+1)


Out[123]:
(array([[ 0.        ,  0.77189023,  0.89534493]]), array([[  0, 107, 125]]))

In [ ]:


In [106]:
nn.kneighbors(centers[0],num_edges_array[0]+1)[1][0][1:]


Out[106]:
array([107, 125])

In [107]:
G = nx.Graph()

In [109]:
G.add_edge(0,107)

In [112]:
G.nodes()


Out[112]:
[0, 107]

In [138]:
i=0
dist,neigh = nn.kneighbors(centers[i],num_edges_array[i]+1)
dist,neigh


Out[138]:
(array([[ 0.        ,  0.77189023,  0.89534493]]), array([[  0, 107, 125]]))

In [139]:
for j in range(1,len(dist)):
    print(dist[j])

In [152]:
def construct_graph(centers,num_edges_array):
    G = nx.Graph()
    for i in range(len(centers)):
        distances,neighbors = nn.kneighbors(centers[i],num_edges_array[i]+1)
        distances = distances[0]
        neighbors = neighbors[0]
        for j in range(1,len(distances)):
            G.add_edge(i,neighbors[j],weight=distances[j])
    return G

In [153]:
G = construct_graph(centers,num_edges_array)

In [154]:
G.nodes()


Out[154]:
[0,
 1,
 2,
 3,
 4,
 5,
 6,
 7,
 8,
 9,
 10,
 11,
 12,
 13,
 14,
 15,
 16,
 17,
 18,
 19,
 20,
 21,
 22,
 23,
 24,
 25,
 26,
 27,
 28,
 29,
 30,
 31,
 32,
 33,
 34,
 35,
 36,
 37,
 38,
 39,
 40,
 41,
 42,
 43,
 44,
 45,
 46,
 47,
 48,
 49,
 50,
 51,
 52,
 53,
 54,
 55,
 56,
 57,
 58,
 59,
 60,
 61,
 62,
 63,
 64,
 65,
 66,
 67,
 68,
 69,
 70,
 71,
 72,
 73,
 74,
 75,
 76,
 77,
 78,
 79,
 80,
 81,
 82,
 83,
 84,
 85,
 86,
 87,
 88,
 89,
 90,
 91,
 92,
 93,
 94,
 95,
 96,
 97,
 98,
 99,
 100,
 101,
 102,
 103,
 104,
 105,
 106,
 107,
 108,
 109,
 110,
 111,
 112,
 113,
 114,
 115,
 116,
 117,
 118,
 119,
 120,
 121,
 122,
 123,
 124,
 125,
 126,
 127,
 128,
 129,
 130,
 131,
 132,
 133,
 134,
 135,
 136,
 137,
 138,
 139,
 140,
 141,
 142,
 143,
 144,
 145,
 146,
 147,
 148,
 149,
 150,
 151,
 152,
 153,
 154,
 155,
 156,
 157,
 158,
 159,
 160,
 161,
 162,
 163,
 164,
 165,
 166,
 167,
 168,
 169,
 170,
 171,
 172,
 173,
 174,
 175,
 176,
 177,
 178,
 179,
 180,
 181,
 182,
 183,
 184,
 185,
 186,
 187,
 188,
 189,
 190,
 191,
 192,
 193,
 194,
 195,
 196,
 197,
 198,
 199]

In [155]:
for line in nx.generate_edgelist(G):
    print(line)


0 192 {'weight': 1.5313260669115492}
0 107 {'weight': 0.77189023040744298}
0 109 {'weight': 0.97956080290717518}
0 175 {'weight': 1.1859385044075383}
0 125 {'weight': 0.89534493238547386}
0 62 {'weight': 1.2665480396303497}
1 66 {'weight': 1.2023553450538875}
1 104 {'weight': 0.67255692798888189}
1 75 {'weight': 0.97190481639845383}
1 45 {'weight': 1.0250597256008278}
1 14 {'weight': 0.54207578212241758}
1 8 {'weight': 1.0143338678428608}
1 155 {'weight': 0.72323050134730493}
1 124 {'weight': 0.91826834660684564}
1 158 {'weight': 1.1873552523513102}
2 68 {'weight': 0.78413732476582965}
2 40 {'weight': 1.3262652440614036}
2 137 {'weight': 1.133860098622095}
2 171 {'weight': 1.1780802484453141}
2 111 {'weight': 1.5967641216331678}
2 178 {'weight': 0.95774309124779178}
2 56 {'weight': 1.1476617335990598}
2 157 {'weight': 1.0471242943115562}
2 94 {'weight': 1.4667422858956556}
2 127 {'weight': 0.60159680963572049}
3 131 {'weight': 1.4198482699079198}
3 196 {'weight': 0.80630200474442493}
3 133 {'weight': 1.2237304242306619}
3 70 {'weight': 0.92551471663620066}
3 108 {'weight': 0.6950700578273683}
3 145 {'weight': 0.68749452328453209}
3 114 {'weight': 0.4967198173365962}
3 180 {'weight': 1.1541127266315656}
3 181 {'weight': 0.72329270384511246}
3 31 {'weight': 1.2145606533425617}
3 188 {'weight': 0.81005900852207879}
3 95 {'weight': 0.98568706694085084}
4 193 {'weight': 0.6136115626326909}
4 99 {'weight': 1.198552772355238}
4 118 {'weight': 0.58774519422865112}
4 168 {'weight': 0.48651540514442665}
4 106 {'weight': 0.9557076482872493}
4 139 {'weight': 1.1938584140610105}
4 172 {'weight': 1.0441455223311713}
4 46 {'weight': 1.1754970321775231}
4 21 {'weight': 1.1852119135990273}
4 54 {'weight': 0.84460212722763373}
4 23 {'weight': 1.3290861863763717}
4 153 {'weight': 0.61107079388028296}
4 58 {'weight': 0.63178668451720055}
4 187 {'weight': 1.2435344609628662}
4 26 {'weight': 1.153084185031896}
4 126 {'weight': 0.91710172593248485}
4 63 {'weight': 0.89766906515317224}
5 66 {'weight': 1.0581618333849059}
5 14 {'weight': 0.71644113039649415}
5 79 {'weight': 0.74632100860288886}
5 16 {'weight': 0.72433160018335874}
5 51 {'weight': 0.79165853374735817}
5 148 {'weight': 1.1782762700482576}
5 155 {'weight': 1.1424394016546906}
6 66 {'weight': 0.80046759051879868}
6 179 {'weight': 1.2506627488687605}
6 7 {'weight': 0.89732753352886585}
6 137 {'weight': 0.52570183626668499}
6 94 {'weight': 1.2177596461256699}
6 111 {'weight': 0.56325804457372719}
6 147 {'weight': 1.2037611644687296}
6 158 {'weight': 0.46208813895024575}
6 56 {'weight': 1.0701144072684179}
6 155 {'weight': 0.94936938463861154}
6 124 {'weight': 0.95503864152199058}
6 157 {'weight': 0.78964847260846793}
6 30 {'weight': 0.67109555756342054}
6 127 {'weight': 1.03917313760494}
7 147 {'weight': 0.78170518660210508}
7 137 {'weight': 1.148661137573898}
7 75 {'weight': 1.052068852815637}
7 111 {'weight': 0.65240326410528005}
7 179 {'weight': 0.60215649614489397}
7 150 {'weight': 0.99270675572917078}
7 56 {'weight': 1.2639908369565065}
7 155 {'weight': 1.3016932316185921}
7 124 {'weight': 0.80456475070712163}
7 158 {'weight': 1.0070564431754248}
8 51 {'weight': 0.93872646733860077}
8 14 {'weight': 1.017178684942353}
9 144 {'weight': 0.80929656616130374}
9 75 {'weight': 1.0761014573412613}
9 179 {'weight': 1.003024376567812}
9 150 {'weight': 0.72843564274234984}
10 129 {'weight': 0.51214316240432056}
10 34 {'weight': 0.84034424782777439}
10 132 {'weight': 0.51225714910808284}
10 197 {'weight': 0.8983569372092205}
10 134 {'weight': 1.1931412065146707}
10 65 {'weight': 1.2348230693626803}
10 107 {'weight': 1.1730404668053513}
10 109 {'weight': 1.0811155414752029}
10 176 {'weight': 1.1639596487347059}
10 113 {'weight': 0.61139542652430012}
10 146 {'weight': 1.1723957798931302}
10 86 {'weight': 0.54518265555530632}
10 25 {'weight': 0.94650434618764689}
10 62 {'weight': 1.2057264033454067}
11 160 {'weight': 0.8497043420871071}
11 131 {'weight': 0.57191495384549751}
11 133 {'weight': 1.0243437630148731}
11 105 {'weight': 0.83651764420209962}
11 114 {'weight': 1.6083008944991768}
11 180 {'weight': 1.1337236915041198}
11 22 {'weight': 0.79087994916593285}
11 119 {'weight': 1.1847651495414739}
11 189 {'weight': 0.70604205998804004}
11 95 {'weight': 1.0269363889352303}
12 96 {'weight': 0.90971428493708406}
12 65 {'weight': 0.5691775591680901}
12 98 {'weight': 0.74153924457332954}
12 198 {'weight': 0.94899451439087823}
12 194 {'weight': 1.1000958779516476}
12 176 {'weight': 1.1864933028245861}
12 146 {'weight': 0.70924039830165997}
12 86 {'weight': 1.2241682129751315}
12 183 {'weight': 0.77893648589930653}
12 91 {'weight': 0.75244376223944731}
13 148 {'weight': 0.79762259492149534}
13 94 {'weight': 1.2218557380888273}
13 79 {'weight': 0.98626080395194082}
14 66 {'weight': 0.82472554124860886}
14 75 {'weight': 1.3695712522001124}
14 16 {'weight': 0.89144305258890799}
14 104 {'weight': 1.1988137731348179}
14 30 {'weight': 1.3395278497148662}
14 155 {'weight': 0.56127458901801419}
14 124 {'weight': 1.0890224876206636}
14 158 {'weight': 1.023809007715937}
15 50 {'weight': 0.87798348154006811}
15 71 {'weight': 0.81913538138979936}
16 66 {'weight': 0.50927947207923963}
16 158 {'weight': 1.0011368920692414}
16 79 {'weight': 0.70712344504012081}
16 148 {'weight': 0.69176831610898737}
16 94 {'weight': 0.8317514799325153}
16 155 {'weight': 0.91489514410767636}
16 157 {'weight': 1.19200263859308}
16 30 {'weight': 0.74314379695453936}
17 193 {'weight': 1.6054626018976419}
17 163 {'weight': 1.1040837806956469}
17 106 {'weight': 1.1525973294040157}
17 172 {'weight': 0.77345963924431438}
17 18 {'weight': 1.1758424484115244}
17 118 {'weight': 1.3847813091039018}
17 153 {'weight': 1.0890925246931502}
17 187 {'weight': 0.68163220969121485}
18 99 {'weight': 0.67624717991165206}
18 166 {'weight': 1.2222915929060307}
18 172 {'weight': 0.71042675865544758}
18 118 {'weight': 0.94560143257930596}
18 153 {'weight': 1.2482413133591073}
19 80 {'weight': 1.1035780476478301}
19 28 {'weight': 1.2020858041135021}
19 117 {'weight': 0.94678830523266932}
19 149 {'weight': 1.1503852186532952}
20 96 {'weight': 1.0846929122405282}
20 192 {'weight': 1.2968217081127806}
20 198 {'weight': 0.72003207014396042}
20 176 {'weight': 1.5474459893348127}
20 24 {'weight': 1.04737889298816}
20 91 {'weight': 1.0570792265856988}
21 193 {'weight': 0.81059517342568954}
21 168 {'weight': 1.1996587269055257}
21 169 {'weight': 0.61155655580229495}
21 106 {'weight': 1.2448502876763201}
21 139 {'weight': 0.71836412855401921}
21 90 {'weight': 1.0949037893583975}
21 153 {'weight': 1.4386083813657731}
21 120 {'weight': 0.83788704979858852}
21 185 {'weight': 1.1739491064383065}
21 58 {'weight': 0.66260886769353977}
21 26 {'weight': 0.74616784014578519}
21 126 {'weight': 0.4093145185359805}
22 165 {'weight': 1.2946585232817476}
22 131 {'weight': 0.68026450909202829}
22 100 {'weight': 0.69711852743941138}
22 133 {'weight': 1.1940652129568143}
22 105 {'weight': 0.83315780342416346}
22 114 {'weight': 1.1245452876204796}
22 43 {'weight': 1.3986662404311239}
22 82 {'weight': 1.0166622150620175}
22 180 {'weight': 0.47894939552292637}
22 181 {'weight': 1.0829814522078289}
22 119 {'weight': 0.52318284883406596}
22 88 {'weight': 0.96546076325829333}
22 196 {'weight': 1.0921651834806376}
22 189 {'weight': 1.2457755067711269}
22 95 {'weight': 0.67769256019525459}
23 33 {'weight': 0.91488666479079406}
23 166 {'weight': 1.0671778254199074}
23 168 {'weight': 0.95183338467187417}
23 46 {'weight': 0.84635274809565775}
23 112 {'weight': 0.7866522265796041}
23 54 {'weight': 0.54388814627345006}
23 58 {'weight': 1.4470501801187468}
23 92 {'weight': 0.83400506523607409}
23 63 {'weight': 0.70896140091215387}
24 192 {'weight': 0.45433983898016861}
24 96 {'weight': 0.94284875032431759}
24 101 {'weight': 0.77275071030121445}
24 198 {'weight': 1.0304483046288975}
24 176 {'weight': 1.0184656488956398}
24 113 {'weight': 1.4923134131203548}
24 125 {'weight': 0.82721108981779723}
24 62 {'weight': 0.93394936897385195}
25 65 {'weight': 0.67446494556609971}
25 194 {'weight': 0.69679381075984026}
25 37 {'weight': 1.0761274711906161}
25 134 {'weight': 1.0668710526414635}
25 161 {'weight': 0.89971709841464564}
25 129 {'weight': 0.77870130989342445}
25 98 {'weight': 1.0267880946035459}
25 176 {'weight': 1.3965784685859937}
25 113 {'weight': 1.1952763893083103}
25 146 {'weight': 1.0118898712200441}
25 86 {'weight': 0.61031085513166017}
25 197 {'weight': 1.2218344526195748}
26 193 {'weight': 1.1736691511596555}
26 168 {'weight': 0.86134987705784172}
26 169 {'weight': 1.0305416939070766}
26 139 {'weight': 1.3854029053575123}
26 46 {'weight': 0.71567871834776653}
26 54 {'weight': 1.0521321943364041}
26 89 {'weight': 0.99320630418875344}
26 120 {'weight': 0.75939280707788359}
26 185 {'weight': 0.50241092719315117}
26 58 {'weight': 0.55533495381421327}
26 126 {'weight': 0.96688453213068903}
27 81 {'weight': 0.87449257646044232}
27 130 {'weight': 0.87600375860136137}
27 131 {'weight': 1.4254754215046839}
27 189 {'weight': 0.82859493659989047}
27 133 {'weight': 1.2900060888572968}
28 128 {'weight': 0.91777131006059343}
28 64 {'weight': 1.6041044719850306}
28 136 {'weight': 0.62502836351967261}
28 170 {'weight': 1.0891158851995657}
28 80 {'weight': 0.67303491957028994}
28 49 {'weight': 1.3109396847975432}
28 50 {'weight': 1.2852359193553637}
28 52 {'weight': 1.0657069176956953}
28 149 {'weight': 1.2195412556785215}
28 152 {'weight': 0.58065193837553108}
28 117 {'weight': 1.3787852437048815}
28 42 {'weight': 1.4104885965237688}
28 191 {'weight': 1.2707488590705187}
29 89 {'weight': 0.71914975645452317}
29 185 {'weight': 0.90645625310319733}
30 66 {'weight': 0.517296164351846}
30 137 {'weight': 0.86408495072011315}
30 79 {'weight': 1.3449685894963983}
30 171 {'weight': 0.94844912778077517}
30 111 {'weight': 1.192060812678065}
30 148 {'weight': 0.98192123647893048}
30 158 {'weight': 0.70280158905741841}
30 56 {'weight': 1.4977130571348427}
30 155 {'weight': 1.0022160454468452}
30 124 {'weight': 1.3605563600762496}
30 157 {'weight': 0.4914834313984347}
30 94 {'weight': 0.57362789607214781}
30 127 {'weight': 1.1298499915302802}
31 97 {'weight': 1.1324114959357492}
31 100 {'weight': 0.58458813184687142}
31 70 {'weight': 1.2413343308806768}
31 38 {'weight': 0.69982523593283441}
31 43 {'weight': 1.3276596779031127}
31 173 {'weight': 0.45757362850760397}
31 142 {'weight': 1.1914856225193724}
31 145 {'weight': 0.5936221930391623}
31 114 {'weight': 0.88206511038496316}
31 180 {'weight': 0.90142362588549407}
31 87 {'weight': 1.1032185909957253}
31 88 {'weight': 0.74302186123756708}
31 196 {'weight': 0.46865300766389306}
31 95 {'weight': 1.1916336932069926}
32 56 {'weight': 1.5998062225796603}
32 147 {'weight': 0.84063222919556924}
32 150 {'weight': 0.70543860242466816}
32 111 {'weight': 1.3817605792618606}
33 99 {'weight': 1.3632011560619557}
33 166 {'weight': 0.78618096781067925}
33 135 {'weight': 1.2875953437919105}
33 92 {'weight': 0.58133550610002216}
33 63 {'weight': 1.0431436484144638}
34 129 {'weight': 0.92803736457225749}
34 132 {'weight': 0.70634251773831691}
34 197 {'weight': 0.80781925372055607}
34 134 {'weight': 1.3306988190750046}
34 109 {'weight': 0.86910177016942725}
34 143 {'weight': 0.91100360873878228}
34 113 {'weight': 1.2860167422326714}
34 86 {'weight': 1.3845003961813755}
34 123 {'weight': 1.0172456919757265}
35 81 {'weight': 0.76672274838676535}
35 108 {'weight': 0.80001279605405851}
35 133 {'weight': 1.0290763706162183}
35 189 {'weight': 1.3452781303089041}
35 181 {'weight': 1.2518757671430509}
36 98 {'weight': 0.96561480452831117}
36 183 {'weight': 0.76503545365933567}
37 161 {'weight': 0.65275490554873339}
37 194 {'weight': 1.1460703309406837}
37 197 {'weight': 1.2079940344741855}
37 134 {'weight': 0.6889551440978019}
37 129 {'weight': 1.1799626730323935}
37 53 {'weight': 0.97453281046913165}
37 154 {'weight': 0.83877565204418136}
38 97 {'weight': 1.2065091690843199}
38 196 {'weight': 1.0646581542956142}
38 70 {'weight': 1.1096259080018589}
38 173 {'weight': 0.58135091573710163}
38 142 {'weight': 0.62922684468257717}
38 141 {'weight': 1.1002246311120731}
38 145 {'weight': 0.89248805647295548}
38 114 {'weight': 1.4204688736596249}
38 87 {'weight': 0.84380836147084093}
39 64 {'weight': 0.53242754524630664}
39 128 {'weight': 1.4096186293306239}
39 167 {'weight': 1.0667170108798036}
39 44 {'weight': 0.96941092488760472}
39 42 {'weight': 0.9013279335998351}
39 76 {'weight': 0.63769106107361018}
39 77 {'weight': 0.95876888749074574}
39 174 {'weight': 0.47804858744032219}
39 116 {'weight': 0.9232572170612422}
39 151 {'weight': 0.60295340255863628}
39 57 {'weight': 1.1298334765199729}
39 52 {'weight': 1.424364251301923}
39 170 {'weight': 1.0488307634251681}
39 191 {'weight': 1.0445792690249684}
40 56 {'weight': 1.2436998448263612}
40 178 {'weight': 0.64690628840730591}
40 78 {'weight': 1.2083542098416171}
40 127 {'weight': 1.4317443306845925}
41 136 {'weight': 0.83067712965808005}
41 50 {'weight': 0.94236532035592124}
41 149 {'weight': 1.1077490589526173}
42 64 {'weight': 0.5421207580140377}
42 128 {'weight': 0.54434502002903029}
42 69 {'weight': 0.9674758111642261}
42 167 {'weight': 0.46607957196936128}
42 136 {'weight': 1.6333313463906165}
42 73 {'weight': 1.2524531383411388}
42 170 {'weight': 0.44785528913037337}
42 76 {'weight': 1.0160019239162232}
42 174 {'weight': 1.3615814283648247}
42 80 {'weight': 1.2077740981897072}
42 49 {'weight': 0.61213810834133175}
42 52 {'weight': 1.1692540506035161}
42 57 {'weight': 1.4827265530141345}
42 151 {'weight': 0.56225560306737266}
42 152 {'weight': 0.85818675045821224}
42 116 {'weight': 1.1876962988823307}
42 59 {'weight': 1.2558025761933223}
42 191 {'weight': 0.89123767400668663}
43 97 {'weight': 0.6600802596980252}
43 100 {'weight': 1.1548514567261914}
43 165 {'weight': 0.92923910827589806}
43 87 {'weight': 1.2018776988430144}
43 173 {'weight': 1.1109678417427333}
43 48 {'weight': 0.88031781625125394}
43 82 {'weight': 0.52097660551286029}
43 180 {'weight': 1.4797536910423756}
43 119 {'weight': 0.91396456299429396}
43 88 {'weight': 0.64813890034080146}
43 121 {'weight': 0.68097579890892157}
43 55 {'weight': 1.4786757777228106}
44 64 {'weight': 1.3155137325093347}
44 67 {'weight': 0.76178551145032192}
44 76 {'weight': 0.98318586004815223}
44 77 {'weight': 1.1506092528663501}
44 174 {'weight': 0.72907940599164878}
44 57 {'weight': 1.053731053319054}
44 61 {'weight': 0.76702924027420716}
45 104 {'weight': 0.86046935442571393}
46 193 {'weight': 1.518871853148678}
46 168 {'weight': 0.69502265226591586}
46 89 {'weight': 0.93893535160238017}
46 54 {'weight': 0.55035455887444029}
46 185 {'weight': 0.74513992454791622}
46 58 {'weight': 0.89434127440980182}
46 190 {'weight': 0.69832413853765107}
47 151 {'weight': 1.4307303253911254}
47 116 {'weight': 0.84357095295399465}
47 199 {'weight': 0.80797033940100804}
48 97 {'weight': 1.3763141666188681}
48 165 {'weight': 0.8470015300397008}
48 82 {'weight': 0.9802994677518756}
48 121 {'weight': 0.84702844351265238}
48 93 {'weight': 1.2067381779907105}
49 128 {'weight': 0.47535689766781641}
49 64 {'weight': 1.1489331132143714}
49 69 {'weight': 0.81855909376861813}
49 167 {'weight': 0.561337448949078}
49 73 {'weight': 0.71339618046659192}
49 80 {'weight': 0.8329375492859814}
49 117 {'weight': 1.2625419936167359}
49 151 {'weight': 1.003713329431432}
49 152 {'weight': 0.93903967403417321}
49 59 {'weight': 0.64807747826060813}
49 170 {'weight': 0.84920593356356877}
49 191 {'weight': 1.3694105450044824}
50 64 {'weight': 1.6009518796156579}
50 71 {'weight': 0.83472912085990847}
50 136 {'weight': 0.69433664987216959}
50 170 {'weight': 1.3905535031378338}
50 52 {'weight': 0.67032162780102411}
50 152 {'weight': 1.2332896083133051}
50 191 {'weight': 1.023921232233939}
52 64 {'weight': 0.94997744920323512}
52 128 {'weight': 1.085729349805661}
52 136 {'weight': 0.76635048207693912}
52 71 {'weight': 0.87966695746825718}
52 76 {'weight': 0.89350329193577527}
52 152 {'weight': 0.72759905136488767}
52 57 {'weight': 0.87931291009068546}
52 170 {'weight': 0.73298745786708086}
52 191 {'weight': 0.38044904350204817}
53 197 {'weight': 1.0874772693667973}
53 134 {'weight': 0.77862951163099547}
53 143 {'weight': 1.0906082942097077}
54 193 {'weight': 1.3632151528824428}
54 99 {'weight': 1.3718555921806901}
54 166 {'weight': 1.2230904622442051}
54 168 {'weight': 0.41351571304651435}
54 112 {'weight': 1.116429074543124}
54 118 {'weight': 1.1111799550509056}
54 153 {'weight': 1.4339726590107178}
54 185 {'weight': 1.2576753853725517}
54 58 {'weight': 0.90618111970484805}
54 190 {'weight': 1.1233284189643244}
54 63 {'weight': 0.64388070152030441}
55 97 {'weight': 0.94008680482030704}
55 121 {'weight': 0.99764583283204189}
55 87 {'weight': 0.82989127495358683}
56 137 {'weight': 0.6350882826921046}
56 78 {'weight': 1.2603236611106836}
56 111 {'weight': 0.67182426681322172}
56 178 {'weight': 0.61767478443057522}
56 147 {'weight': 0.76825121162538756}
56 158 {'weight': 1.5263726351935505}
56 157 {'weight': 1.1972159688700197}
56 127 {'weight': 0.67483111855011324}
57 64 {'weight': 0.97677453298172656}
57 67 {'weight': 0.87950319254005704}
57 71 {'weight': 0.51572649140364446}
57 76 {'weight': 0.52536353908030908}
57 60 {'weight': 0.93849527205312522}
57 170 {'weight': 1.2195740901777363}
57 191 {'weight': 0.73337261439260704}
58 193 {'weight': 0.65732100483878186}
58 118 {'weight': 1.2180590738697088}
58 168 {'weight': 0.5370900008888061}
58 169 {'weight': 1.2126812556340543}
58 106 {'weight': 1.1861073529760708}
58 139 {'weight': 1.0284981186482014}
58 190 {'weight': 1.5659046096592195}
58 89 {'weight': 1.5085802098447014}
58 153 {'weight': 1.1070214261153863}
58 120 {'weight': 1.1785332770725885}
58 185 {'weight': 1.0441400062563868}
58 187 {'weight': 1.6151895136615366}
58 126 {'weight': 0.60873281063976603}
58 63 {'weight': 1.3141438291924685}
59 128 {'weight': 0.93602673176707096}
59 69 {'weight': 1.1744746703710482}
59 167 {'weight': 1.1473861710428264}
59 73 {'weight': 0.55634010598257244}
59 80 {'weight': 0.73495333019599218}
59 83 {'weight': 0.83637462543442798}
59 117 {'weight': 0.68558140782900834}
59 152 {'weight': 1.2898396491049451}
59 122 {'weight': 1.2426126180848889}
60 67 {'weight': 0.78405023640966731}
60 71 {'weight': 0.71320379076487928}
61 77 {'weight': 1.0149418087571065}
61 174 {'weight': 1.0063287744703322}
62 192 {'weight': 0.49901440821804005}
62 96 {'weight': 0.9350159917893488}
62 132 {'weight': 1.0394988913941601}
62 198 {'weight': 1.3293566071708567}
62 65 {'weight': 1.4538623253140055}
62 107 {'weight': 0.61839792292036766}
62 109 {'weight': 1.2166242016953521}
62 110 {'weight': 1.3791158487836555}
62 176 {'weight': 0.48845845922047421}
62 113 {'weight': 0.60621668050618605}
62 146 {'weight': 1.0063085090211821}
62 86 {'weight': 1.1269848858058216}
62 125 {'weight': 0.66248693541825032}
62 101 {'weight': 1.6387426800220064}
63 99 {'weight': 0.75742213425671656}
63 118 {'weight': 0.75893212145846922}
63 166 {'weight': 0.60882198945034272}
63 193 {'weight': 1.5112140361431634}
63 168 {'weight': 0.79364923669281306}
63 153 {'weight': 1.2930041239560408}
64 128 {'weight': 0.94499146960819735}
64 116 {'weight': 1.2426558091653641}
64 69 {'weight': 1.3984482115912116}
64 167 {'weight': 0.91451246832192568}
64 76 {'weight': 0.47942140102558295}
64 77 {'weight': 1.4827873766216269}
64 174 {'weight': 1.003015000420078}
64 151 {'weight': 0.66212904370623848}
64 152 {'weight': 1.0276284059540359}
64 71 {'weight': 1.3869430705584065}
64 170 {'weight': 0.52735322105002314}
64 191 {'weight': 0.57733890287880063}
65 96 {'weight': 1.0121755437953877}
65 129 {'weight': 1.3207723638399895}
65 98 {'weight': 0.77230980690787032}
65 198 {'weight': 1.2641757190699949}
65 161 {'weight': 1.333238360419061}
65 194 {'weight': 0.83471113035000355}
65 176 {'weight': 1.0046138525035035}
65 113 {'weight': 1.1241710285857844}
65 146 {'weight': 0.48527940906495548}
65 86 {'weight': 0.69274001989942269}
65 183 {'weight': 1.1301517421795944}
65 91 {'weight': 1.2893702208687958}
66 137 {'weight': 1.2147480894309357}
66 111 {'weight': 1.3589351445782776}
66 94 {'weight': 0.94686786958262215}
66 79 {'weight': 1.2164024647131719}
66 148 {'weight': 1.0926857490051232}
66 158 {'weight': 0.4918949911019706}
66 155 {'weight': 0.53423520840401906}
66 124 {'weight': 1.0448939606175334}
66 157 {'weight': 1.0029445153709666}
67 76 {'weight': 1.187895610596138}
68 137 {'weight': 1.5149670747684498}
68 171 {'weight': 0.64991138426261419}
68 140 {'weight': 0.92955973029853389}
68 148 {'weight': 1.5219988521819383}
68 157 {'weight': 1.0622823617225947}
68 94 {'weight': 1.0994827289650309}
68 127 {'weight': 1.1229477985715111}
69 128 {'weight': 1.2293185780512057}
69 162 {'weight': 0.8875636589485848}
69 167 {'weight': 0.50328940637633435}
69 73 {'weight': 0.74704294228884971}
69 151 {'weight': 0.84278157697877876}
69 170 {'weight': 1.4013851771881609}
70 196 {'weight': 1.148299186431579}
70 156 {'weight': 0.93269827739195099}
70 142 {'weight': 0.78891258330908876}
70 145 {'weight': 0.74131081235816387}
70 114 {'weight': 1.1774942984271657}
70 188 {'weight': 0.6740361084903902}
71 76 {'weight': 0.99882372340761461}
71 191 {'weight': 0.95524460468991623}
72 193 {'weight': 1.2072936277678681}
72 106 {'weight': 1.0858363902122454}
72 139 {'weight': 0.64641466187629648}
72 177 {'weight': 0.72134624186116192}
72 84 {'weight': 0.79883829174599452}
72 153 {'weight': 1.6074543618441353}
72 90 {'weight': 0.91854184906620229}
72 126 {'weight': 1.0541137305537966}
73 128 {'weight': 1.1712121405419149}
73 162 {'weight': 1.0648749246956475}
73 167 {'weight': 0.94616635293540696}
73 83 {'weight': 1.0255956445069871}
73 117 {'weight': 1.1864193042702156}
73 151 {'weight': 1.4313662919722441}
73 122 {'weight': 1.0406677226528787}
74 123 {'weight': 1.3086875960757838}
74 197 {'weight': 1.3908115199787265}
74 143 {'weight': 0.74290232554800906}
75 104 {'weight': 0.56141297175590832}
75 144 {'weight': 0.76136875372584711}
75 179 {'weight': 0.47836628779450319}
75 150 {'weight': 1.2921434966570302}
75 155 {'weight': 1.0731822619897098}
75 124 {'weight': 0.56126885917004288}
75 158 {'weight': 1.2179072821876684}
76 128 {'weight': 1.341819560946512}
76 174 {'weight': 0.96341155583139326}
76 151 {'weight': 1.0656155087322396}
76 152 {'weight': 1.2829948483546976}
76 170 {'weight': 0.86579166133478769}
76 191 {'weight': 0.55500599398503636}
77 102 {'weight': 0.87443407541658036}
77 199 {'weight': 0.64105622838712828}
77 174 {'weight': 0.57320432217906692}
77 116 {'weight': 0.83673017667197147}
77 151 {'weight': 1.1868949803807551}
78 178 {'weight': 1.1815884046703224}
78 147 {'weight': 1.124450750895545}
79 148 {'weight': 0.58877144242070389}
79 94 {'weight': 1.1268190193162249}
80 128 {'weight': 0.67427715390120757}
80 83 {'weight': 1.3712959145382999}
80 167 {'weight': 1.3719349974525388}
80 117 {'weight': 0.80187105187939478}
80 152 {'weight': 0.74659359753739696}
80 170 {'weight': 1.1030224621082916}
81 133 {'weight': 0.64372991935116441}
81 108 {'weight': 1.1287199449568202}
81 131 {'weight': 1.0860281525984627}
81 181 {'weight': 1.1472900600320131}
81 189 {'weight': 0.64420242580733467}
81 95 {'weight': 1.342445781799201}
82 97 {'weight': 1.1395538245173704}
82 100 {'weight': 1.0449540797884849}
82 165 {'weight': 0.53611004477978419}
82 105 {'weight': 1.0215441739369484}
82 180 {'weight': 1.2457428650425253}
82 119 {'weight': 0.4935311582213664}
82 88 {'weight': 0.69626243646048736}
82 121 {'weight': 1.1587231110505534}
82 93 {'weight': 1.17213531237274}
83 122 {'weight': 0.75692280535997825}
83 117 {'weight': 0.68985245213567337}
84 193 {'weight': 1.2065441085500941}
84 163 {'weight': 0.69318843947715025}
84 106 {'weight': 0.76165677341452453}
84 139 {'weight': 0.94685411191766011}
84 177 {'weight': 0.9000049044378351}
84 153 {'weight': 1.2583784844437553}
84 187 {'weight': 0.75716793497213508}
85 108 {'weight': 0.97694887532691455}
85 188 {'weight': 0.87828774569185064}
86 96 {'weight': 1.2128788271039912}
86 194 {'weight': 1.2286613157174333}
86 132 {'weight': 0.94880831285718237}
86 197 {'weight': 1.2639377269763032}
86 134 {'weight': 1.3609697113007009}
86 129 {'weight': 0.76500944665976633}
86 107 {'weight': 1.3657880536458662}
86 176 {'weight': 0.86721323269140027}
86 113 {'weight': 0.58602099920508777}
86 146 {'weight': 0.67783185399797841}
86 98 {'weight': 1.390238781399018}
86 192 {'weight': 1.4481253100144005}
87 97 {'weight': 0.55281767627708556}
87 173 {'weight': 0.64961283570957218}
87 141 {'weight': 0.88943730577471825}
87 88 {'weight': 1.1547558259444561}
87 121 {'weight': 1.1480790560005116}
88 97 {'weight': 0.81566283376467774}
88 100 {'weight': 0.51893224633721291}
88 114 {'weight': 1.3182434810172692}
88 165 {'weight': 1.2310021278161034}
88 95 {'weight': 1.2937512579128105}
88 173 {'weight': 0.71805274922646023}
88 145 {'weight': 1.2876305604164482}
88 180 {'weight': 0.88809301713543021}
88 196 {'weight': 0.97714135577914951}
88 121 {'weight': 1.2447323282811718}
88 119 {'weight': 0.67102219422177556}
89 185 {'weight': 0.50261447281807392}
89 190 {'weight': 0.70217681348965821}
90 169 {'weight': 0.81837984652990148}
90 139 {'weight': 1.1082850030752975}
90 182 {'weight': 0.81599080656275202}
90 126 {'weight': 1.2580711386176817}
91 96 {'weight': 0.97863238194612745}
91 198 {'weight': 0.6648602326684907}
91 138 {'weight': 0.89483494270706643}
91 176 {'weight': 1.4774468226916173}
91 146 {'weight': 1.2083652885988525}
92 112 {'weight': 0.92733751002832854}
92 195 {'weight': 1.0306802591151123}
92 184 {'weight': 1.2843252109411634}
93 105 {'weight': 0.98626468440877157}
93 164 {'weight': 0.99058611097551774}
93 165 {'weight': 0.64524947132952626}
94 137 {'weight': 1.244926912870409}
94 171 {'weight': 0.46943870372229696}
94 148 {'weight': 0.58565687848178172}
94 158 {'weight': 1.2652561553326145}
94 157 {'weight': 0.62942646147806824}
94 127 {'weight': 1.278565499134932}
95 196 {'weight': 0.79173603882078203}
95 133 {'weight': 0.69968165969474816}
95 145 {'weight': 1.1184050103132075}
95 108 {'weight': 1.0710484738060471}
95 114 {'weight': 0.58201838247843463}
95 131 {'weight': 0.50222508493649121}
95 180 {'weight': 0.40626705648366523}
95 181 {'weight': 0.40804771190102707}
95 119 {'weight': 1.1432670844187787}
95 100 {'weight': 0.79901236518876506}
95 189 {'weight': 1.0426849589533371}
96 192 {'weight': 0.71962213124794294}
96 198 {'weight': 0.43995882008045573}
96 176 {'weight': 0.5324721705578972}
96 113 {'weight': 1.1150592436336717}
96 146 {'weight': 0.58561703701301104}
97 100 {'weight': 1.2746577467770415}
97 173 {'weight': 0.7324321075042165}
97 121 {'weight': 0.68889676384727239}
98 194 {'weight': 0.5058374693622546}
98 161 {'weight': 1.057910017833378}
98 146 {'weight': 1.2148529708995186}
98 183 {'weight': 0.54834023184800984}
98 186 {'weight': 1.1192668622255912}
99 166 {'weight': 0.57818228600067534}
99 135 {'weight': 1.0367223774470573}
99 168 {'weight': 1.3765893347475997}
99 172 {'weight': 0.94414535375769926}
99 118 {'weight': 0.66378166654134574}
99 153 {'weight': 1.222145929542128}
100 131 {'weight': 1.1582211698919147}
100 196 {'weight': 0.5453994120852026}
100 114 {'weight': 0.81795366292691429}
100 173 {'weight': 0.87107276972561953}
100 145 {'weight': 0.9324646328274786}
100 180 {'weight': 0.40881536390486634}
100 181 {'weight': 1.1172261383715951}
100 119 {'weight': 0.73922389950137601}
101 192 {'weight': 1.2089207063762248}
101 110 {'weight': 1.0618936742139822}
102 199 {'weight': 0.78987559688205855}
103 120 {'weight': 0.94838236716262136}
103 169 {'weight': 1.1164076797591187}
103 182 {'weight': 0.84884351220597321}
104 144 {'weight': 0.77071299060059373}
104 179 {'weight': 1.0382029317650698}
104 155 {'weight': 1.151864492291623}
104 124 {'weight': 0.91874022431607294}
105 160 {'weight': 0.71197482021547309}
105 131 {'weight': 1.2193372937884062}
105 165 {'weight': 0.8921358139515837}
105 180 {'weight': 1.3101113510563223}
105 119 {'weight': 0.77972751933854301}
106 193 {'weight': 0.53131724371572375}
106 163 {'weight': 1.2790229973949849}
106 139 {'weight': 0.68553131804233425}
106 172 {'weight': 0.99929325149447401}
106 118 {'weight': 1.1320309267484883}
106 153 {'weight': 0.53871882418286443}
106 187 {'weight': 0.48293324611265026}
106 126 {'weight': 0.83798588359193604}
107 192 {'weight': 1.0517864748287269}
107 132 {'weight': 0.76594273201288687}
107 109 {'weight': 0.66330751819947109}
107 176 {'weight': 1.0574119162644182}
107 113 {'weight': 0.7878178698861027}
107 125 {'weight': 0.73273217538095659}
108 181 {'weight': 0.66308477431565038}
108 131 {'weight': 1.2876481088632561}
108 133 {'weight': 0.84841929874233946}
108 114 {'weight': 0.94148459946938723}
108 196 {'weight': 1.3519116160366993}
109 132 {'weight': 0.57252000566807237}
109 113 {'weight': 1.0648272021623708}
109 123 {'weight': 1.103746946688376}
109 159 {'weight': 0.75875083984054825}
110 192 {'weight': 1.2597682829061359}
110 175 {'weight': 1.0100579094176039}
110 125 {'weight': 0.72107530113185203}
111 179 {'weight': 1.2125360216508556}
111 137 {'weight': 0.53045985229808124}
111 178 {'weight': 1.2890555155069299}
111 147 {'weight': 0.64616157173221644}
111 158 {'weight': 0.95179322857910009}
111 150 {'weight': 1.5645329983797391}
111 155 {'weight': 1.40999179600071}
111 124 {'weight': 1.1727094572758656}
111 157 {'weight': 1.1258615446368885}
111 127 {'weight': 1.0010475617155117}
112 115 {'weight': 0.97086984248827546}
112 184 {'weight': 0.82839058609156513}
112 190 {'weight': 0.6063931046732739}
113 132 {'weight': 0.62575143353428431}
113 197 {'weight': 1.509716704136796}
113 129 {'weight': 1.0932064565349067}
113 192 {'weight': 1.0380178978131469}
113 176 {'weight': 0.59884794142237308}
113 146 {'weight': 0.82707039298842977}
113 125 {'weight': 1.2248772102662684}
114 133 {'weight': 1.0740670316060965}
114 173 {'weight': 1.3392042243499391}
114 145 {'weight': 0.57854951449741543}
114 131 {'weight': 1.0752270696572968}
114 180 {'weight': 0.66233205017177565}
114 181 {'weight': 0.53247569933784289}
114 119 {'weight': 1.4545587292854045}
114 196 {'weight': 0.4146708191070142}
114 188 {'weight': 1.2728678530586055}
114 189 {'weight': 1.5497716161521033}
115 184 {'weight': 0.87441806721483117}
115 190 {'weight': 0.73871998731287492}
116 199 {'weight': 0.80760400502540808}
116 174 {'weight': 0.95853298942738807}
116 151 {'weight': 0.63902263360466538}
116 167 {'weight': 0.93581139595455487}
117 128 {'weight': 1.3689826168336914}
118 193 {'weight': 1.0505093590844847}
118 166 {'weight': 1.0560192560054082}
118 168 {'weight': 0.92596526949790348}
118 172 {'weight': 0.62287526353782285}
118 153 {'weight': 0.59720998006963233}
118 187 {'weight': 1.1865404137269226}
119 165 {'weight': 0.83556627178009912}
119 131 {'weight': 1.2009388715145186}
119 180 {'weight': 0.81022092181403582}
119 196 {'weight': 1.2741253681472706}
120 193 {'weight': 1.6085239542167826}
120 169 {'weight': 0.55361436394134689}
120 185 {'weight': 0.7681109210857987}
120 126 {'weight': 1.2402448794096441}
121 165 {'weight': 1.3997993818673857}
123 159 {'weight': 0.81615488793096158}
124 137 {'weight': 1.4510684237873819}
124 144 {'weight': 1.32260864353851}
124 179 {'weight': 0.5541031450018975}
124 155 {'weight': 0.62351992717743177}
124 158 {'weight': 0.65809523733133124}
125 192 {'weight': 0.68435970853818551}
125 176 {'weight': 1.0987398722062409}
126 193 {'weight': 0.42009114035308276}
126 169 {'weight': 0.99085321984228014}
126 139 {'weight': 0.4298894812224196}
126 168 {'weight': 1.0889918030598067}
126 153 {'weight': 1.0526129115842269}
126 187 {'weight': 1.3204250964036464}
127 137 {'weight': 0.53657557490045849}
127 171 {'weight': 1.1895011327735807}
127 158 {'weight': 1.4675638028383715}
127 178 {'weight': 0.84015856226843322}
127 147 {'weight': 1.3902887906167174}
127 157 {'weight': 0.68554531777381245}
128 136 {'weight': 1.2826743499453164}
128 167 {'weight': 0.82424599426843448}
128 151 {'weight': 1.0977347752960542}
128 152 {'weight': 0.4668267569011309}
128 170 {'weight': 0.48340167188398941}
128 191 {'weight': 0.97956880613675257}
129 132 {'weight': 0.96195972700119825}
129 134 {'weight': 0.6823591305159471}
129 143 {'weight': 1.1515613469331583}
129 197 {'weight': 0.5038319073555747}
130 160 {'weight': 1.0846804636248828}
130 189 {'weight': 1.2284122038389862}
131 160 {'weight': 1.4149461408824568}
131 133 {'weight': 0.55273660404930058}
131 180 {'weight': 0.75831669231628962}
131 181 {'weight': 0.71478244222991394}
131 196 {'weight': 1.2824074109278796}
131 189 {'weight': 0.60499490884826435}
132 197 {'weight': 1.1903897740603628}
132 176 {'weight': 1.2109830511028603}
132 159 {'weight': 1.3159572316624883}
133 196 {'weight': 1.4190972785916514}
133 180 {'weight': 1.0964048529280079}
133 181 {'weight': 0.54733551255444757}
133 189 {'weight': 0.55927253961449175}
134 197 {'weight': 0.52817112340215766}
134 161 {'weight': 1.2011479323948129}
134 143 {'weight': 1.0022875644098905}
134 154 {'weight': 1.4962612480229189}
135 166 {'weight': 0.90408686578594544}
136 152 {'weight': 0.81910293774033582}
136 170 {'weight': 1.2068739708665699}
136 191 {'weight': 1.1115115579598054}
137 171 {'weight': 1.3532454359792703}
137 158 {'weight': 0.98015345197373049}
137 178 {'weight': 1.1316910434977121}
137 147 {'weight': 1.083045841100603}
137 155 {'weight': 1.4647020869883161}
137 157 {'weight': 0.63604063030770608}
138 183 {'weight': 0.93605955855557954}
139 193 {'weight': 0.58368978799425852}
139 169 {'weight': 1.1505534638724648}
139 177 {'weight': 1.3315094780965318}
139 153 {'weight': 1.1027180481514769}
139 187 {'weight': 1.1360022132473375}
140 171 {'weight': 1.147584607508237}
142 196 {'weight': 1.3916790534921626}
142 173 {'weight': 1.2038046233518063}
142 145 {'weight': 1.0527898372550415}
143 197 {'weight': 0.66062560832795814}
144 179 {'weight': 1.0670055900016413}
145 173 {'weight': 0.99644404052579771}
145 180 {'weight': 1.0274174015751663}
145 181 {'weight': 1.1052669089659453}
145 196 {'weight': 0.40981075633885489}
145 188 {'weight': 1.1272304137190026}
146 198 {'weight': 0.94071952505350975}
146 194 {'weight': 1.3185039867163515}
146 176 {'weight': 0.53232261348849275}
146 192 {'weight': 1.078898123686469}
147 178 {'weight': 1.2587104870672481}
148 171 {'weight': 0.88554412986857667}
148 158 {'weight': 1.5447591080041796}
148 157 {'weight': 1.202856793835553}
150 179 {'weight': 0.9345394206876374}
151 167 {'weight': 0.49332602707347167}
151 174 {'weight': 0.95149356064254065}
151 152 {'weight': 1.4091715266803269}
151 170 {'weight': 0.94136147775560663}
151 199 {'weight': 1.4047138418182037}
151 191 {'weight': 1.2208222505061967}
152 167 {'weight': 1.2456326663559536}
152 170 {'weight': 0.50852630693187617}
152 191 {'weight': 0.78045254623627947}
153 193 {'weight': 0.63279465241503507}
153 166 {'weight': 1.653188867023174}
153 168 {'weight': 1.0974923959013121}
153 172 {'weight': 0.5834016094239165}
153 163 {'weight': 1.638004101470536}
153 187 {'weight': 0.65395951784627671}
154 161 {'weight': 0.93345556287838249}
155 179 {'weight': 1.1776081888571794}
155 158 {'weight': 0.48728239815935998}
156 188 {'weight': 1.0317003561391187}
157 171 {'weight': 0.7351615997612807}
157 158 {'weight': 1.0556912370219587}
158 179 {'weight': 1.1199528201506859}
160 164 {'weight': 0.854152670377755}
161 194 {'weight': 0.57883007399242503}
161 186 {'weight': 0.73251054086034983}
163 177 {'weight': 1.2190810768035227}
163 187 {'weight': 0.98961975171487515}
167 170 {'weight': 0.90751253491980655}
167 191 {'weight': 1.3513572848702007}
168 193 {'weight': 0.95146208999829684}
169 193 {'weight': 1.4085087389661293}
169 182 {'weight': 0.76922465095608983}
170 191 {'weight': 0.5204304401396378}
172 193 {'weight': 1.2161538815329074}
172 187 {'weight': 0.7913869620098658}
173 180 {'weight': 1.260201323050796}
173 196 {'weight': 0.92497656442943443}
174 199 {'weight': 1.1676589958142893}
176 198 {'weight': 0.96934764133121232}
176 192 {'weight': 0.59661925743216548}
180 181 {'weight': 0.77502764019430481}
180 196 {'weight': 0.62586072862476194}
180 189 {'weight': 1.3583069803379269}
181 196 {'weight': 0.90780270790618878}
181 189 {'weight': 1.060940451979703}
183 194 {'weight': 1.0449582942974602}
184 195 {'weight': 1.1358000410758997}
185 190 {'weight': 0.93106205212563442}
186 194 {'weight': 0.90819726847865556}
187 193 {'weight': 0.98397565270675791}
192 198 {'weight': 0.99631546184114483}

In [130]:
# replace adj as desired

In [53]:
w = 1/(distmat)
w


Out[53]:
array([[        inf,  0.08159144,  0.09236838, ...,  0.39128011,
         0.3966579 ,  0.12500569],
       [ 0.08159144,         inf,  0.31449429, ...,  0.08738769,
         0.10266771,  0.16143097],
       [ 0.09236838,  0.31449429,         inf, ...,  0.09366613,
         0.11955155,  0.29057512],
       ..., 
       [ 0.39128011,  0.08738769,  0.09366613, ...,         inf,
         0.3481389 ,  0.11791671],
       [ 0.3966579 ,  0.10266771,  0.11955155, ...,  0.3481389 ,
                inf,  0.1734665 ],
       [ 0.12500569,  0.16143097,  0.29057512, ...,  0.11791671,
         0.1734665 ,         inf]])

In [54]:
w*adj


Out[54]:
array([[ inf,   0.,   0., ...,   0.,   0.,   0.],
       [  0.,  inf,   0., ...,   0.,   0.,   0.],
       [  0.,   0.,  inf, ...,   0.,   0.,   0.],
       ..., 
       [  0.,   0.,   0., ...,  inf,   0.,   0.],
       [  0.,   0.,   0., ...,   0.,  inf,   0.],
       [  0.,   0.,   0., ...,   0.,   0.,  inf]])

In [55]:
w[w==np.inf]=0

In [56]:
w


Out[56]:
array([[ 0.        ,  0.08159144,  0.09236838, ...,  0.39128011,
         0.3966579 ,  0.12500569],
       [ 0.08159144,  0.        ,  0.31449429, ...,  0.08738769,
         0.10266771,  0.16143097],
       [ 0.09236838,  0.31449429,  0.        , ...,  0.09366613,
         0.11955155,  0.29057512],
       ..., 
       [ 0.39128011,  0.08738769,  0.09366613, ...,  0.        ,
         0.3481389 ,  0.11791671],
       [ 0.3966579 ,  0.10266771,  0.11955155, ...,  0.3481389 ,
         0.        ,  0.1734665 ],
       [ 0.12500569,  0.16143097,  0.29057512, ...,  0.11791671,
         0.1734665 ,  0.        ]])

In [57]:
weighted_adj_mat = w*adj

In [58]:
# compute density cluster

In [59]:
import networkx as nx


Couldn't import dot_parser, loading of dot files will not be possible.

In [60]:
G = nx.Graph(weighted_adj_mat)

In [156]:
pos = nx.graphviz_layout(G)

In [157]:
positions = np.array(pos.values())

In [158]:
density.shape,positions.shape


Out[158]:
((5000,), (200, 2))

In [158]:


In [159]:
pl.scatter(positions[:,0],positions[:,1])


Out[159]:
<matplotlib.collections.PathCollection at 0x119d9f710>

In [161]:
nx.draw(G,pos=positions)



In [162]:
nx.draw_networkx_edges(G,pos=positions)


Out[162]:
<matplotlib.collections.LineCollection at 0x11a0d0ad0>

In [ ]:
# compute r

In [ ]:


In [ ]:
class FlowMap():