IR: Information Retrieval FIB, Master in Innovation and Research in - - PowerPoint PPT Presentation

ir information retrieval
SMART_READER_LITE
LIVE PREVIEW

IR: Information Retrieval FIB, Master in Innovation and Research in - - PowerPoint PPT Presentation

IR: Information Retrieval FIB, Master in Innovation and Research in Informatics Slides by Marta Arias, Jos Luis Balczar, Ramon Ferrer-i-Cancho, Ricard Gavald Department of Computer Science, UPC Fall 2018 http://www.cs.upc.edu/~ir-miri 1


slide-1
SLIDE 1

IR: Information Retrieval

FIB, Master in Innovation and Research in Informatics Slides by Marta Arias, José Luis Balcázar, Ramon Ferrer-i-Cancho, Ricard Gavaldá

Department of Computer Science, UPC

Fall 2018 http://www.cs.upc.edu/~ir-miri

1 / 72

slide-2
SLIDE 2
  • 7. Introduction to Network Analysis
slide-3
SLIDE 3

Network Analysis, Part I

Today’s contents

  • 1. Examples of real networks
  • 2. What do real networks look like?

◮ real networks exhibit small diameter ◮ .. and so does the Erdös-Rényi or random model ◮ real networks have high clustering coefficient ◮ .. and so does the Watts-Strogatz model ◮ real networks’ degree distribution follows a power-law ◮ .. and so does the Barabasi-Albert or preferential attachment

model

3 / 72

slide-4
SLIDE 4

Examples of real networks

◮ Social networks ◮ Information networks ◮ Technological networks ◮ Biological networks

4 / 72

slide-5
SLIDE 5

Social networks

Links denote social “interactions”

◮ friendship, collaborations, e-mail, etc.

5 / 72

slide-6
SLIDE 6

Information networks

Nodes store information, links associate information

◮ citation networks, the web, p2p networks, etc.

6 / 72

slide-7
SLIDE 7

Technological networks

Man-built for the distribution of a commodity

◮ telephone networks, power grids, transportation networks,

etc.

7 / 72

slide-8
SLIDE 8

Biological networks

Represent biological systems

◮ protein-protein interaction networks, gene regulation

networks, metabolic pathways, etc.

8 / 72

slide-9
SLIDE 9

Representing networks

◮ Network ≡ Graph ◮ Networks are just collections of “points” joined by “lines”

points lines vertices edges, arcs math nodes links computer science sites bonds physics actors ties, relations sociology

9 / 72

slide-10
SLIDE 10

Types of networks

From [Newman, 2003]

(a) unweighted, undirected (b) discrete vertex and edge types, undirected (c) varying vertex and edge weights, undirected (d) directed

10 / 72

slide-11
SLIDE 11

Small-world phenomenon

◮ A friend of a friend is also frequently a friend ◮ Only 6 hops separate any two people in the world

11 / 72

slide-12
SLIDE 12

Measuring the small-world phenomenon, I

◮ Let dij be the shortest-path distance between nodes i and

j

◮ To check whether “any two nodes are within 6 hops”, we

use:

◮ The diameter (longest shortest-path distance) as

d = m´ ax

i,j dij

◮ The average shortest-path length as

l = 2 n (n + 1)

  • i>j

dij

◮ The harmonic mean shortest-path length as

l−1 = 2 n (n + 1)

  • i>j

d−1

ij

12 / 72

slide-13
SLIDE 13

From [Newman, 2003]

13 / 72

slide-14
SLIDE 14

But..

◮ Can we mimic this phenomenon in simulated networks

(“models”)?

◮ The answer is YES!

14 / 72

slide-15
SLIDE 15

The (basic) random graph model

a.k.a. ER model

Basic Gn,p Erdös-Rényi random graph model:

◮ parameter n is the number of vertices ◮ parameter p is s.t. 0 ≤ p ≤ 1 ◮ Generate and edge (i, j) independently at random with

probability p

15 / 72

slide-16
SLIDE 16

Measuring the diameter in ER networks

Want to show that the diameter in ER networks is small

◮ Let the average degree be z ◮ At distance l, can reach zl nodes ◮ At distance log n log z , reach all n nodes ◮ So, diameter is (roughly) O(log n)

16 / 72

slide-17
SLIDE 17

ER networks have small diameter

As shown by the following simulation

17 / 72

slide-18
SLIDE 18

Measuring the small-world phenomenon, II

◮ To check whether “the friend of a friend is also frequently a

friend”, we use:

◮ The transitivity or clustering coefficient, which basically

measures the probability that two of my friends are also friends

18 / 72

slide-19
SLIDE 19

Global clustering coefficient

C = 3 × number of triangles number of connected triples C = 3 × 1 8 = 0.375

19 / 72

slide-20
SLIDE 20

Local clustering coefficient

◮ For each vertex i, let ni be the number of neighbors of i ◮ Let Ci be the fraction of pairs of neighbors that are

connected within each other Ci = nr. of connections between i’s neighbors

1 2ni (ni − 1) ◮ Finally, average Ci over all nodes i in the network

C = 1 n

  • i

Ci

20 / 72

slide-21
SLIDE 21

Local clustering coefficient example

◮ C1 = C2 = 1/1 ◮ C3 = 1/6 ◮ C4 = C5 = 0 ◮ C = 1 5(1 + 1 + 1/6) = 13/30 = 0.433

21 / 72

slide-22
SLIDE 22

From [Newman, 2003]

22 / 72

slide-23
SLIDE 23

ER networks do not show transitivity

◮ C = p, since edges are added independently ◮ Given a graph with n nodes and e edges, we can

“estimate” p as ˆ p = e 1/2 n (n − 1)

◮ We say that clustering is high if C ≫ ˆ

p

◮ Hence, ER networks do not have high clustering coefficient

since for them C ≈ ˆ p

23 / 72

slide-24
SLIDE 24

ER networks do not show transitivity

24 / 72

slide-25
SLIDE 25

So ER networks do not have high clustering, but..

◮ Can we mimic this phenomenon in simulated networks

(“models”), while keeping the diameter small?

◮ The answer is YES!

25 / 72

slide-26
SLIDE 26

The Watts-Strogatz model, I

From [Watts and Strogatz, 1998]

Reconciling two observations from real networks:

◮ High clustering: my friend’s friends are also my friends ◮ small diameter

26 / 72

slide-27
SLIDE 27

The Watts-Strogatz model, II

◮ Start with all n vertices arranged on a ring ◮ Each vertex has intially 4 connections to their closest

nodes

◮ mimics local or geographical connectivity

◮ With probability p, rewire each local connection to a

random vertex

◮ p = 0 high clustering, high diameter ◮ p = 1 low clustering, low diameter (ER model)

◮ What happens in between?

◮ As we increase p from 0 to 1 ◮ Fast decrease of mean distance ◮ Slow decrease in clustering 27 / 72

slide-28
SLIDE 28

The Watts-Strogatz model, III

For an appropriate value of p ≈ 0.01 (1 %), we observe that the model achieves high clustering and small diameter

28 / 72

slide-29
SLIDE 29

Degree distribution

Histogram of nr of nodes having a particular degree fk = fraction of nodes of degree k

29 / 72

slide-30
SLIDE 30

Scale-free networks

The degree distribution of most real-world networks follows a power-law distribution fk = ck−α

◮ “heavy-tail” distribution, implies

existence of hubs

◮ hubs are nodes with very high

degree

30 / 72

slide-31
SLIDE 31

Random networks are not scale-free!

For random networks, the degree distribution follows the binomial distribution (or Poisson if n is large) fk = n k

  • pk(1 − p)(n−k) ≈ zke−z

k!

◮ Where z = p(n − 1) is the mean degree ◮ Probability of nodes with very large degree becomes

exponentially small

◮ so no hubs 31 / 72

slide-32
SLIDE 32

So ER networks are not scale-free, but..

◮ Can we obtained scale-free simulated networks? ◮ The answer is YES!

32 / 72

slide-33
SLIDE 33

Preferential attachment

◮ “Rich get richer” dynamics

◮ The more someone has, the more she is likely to have

◮ Examples

◮ the more friends you have, the easier it is to make new ones ◮ the more business a firm has, the easier it is to win more ◮ the more people there are at a restaurant, the more who

want to go

33 / 72

slide-34
SLIDE 34

Barabási-Albert model

From [Barabási and Albert, 1999]

◮ “Growth” model

◮ The model controls how a network grows over time

◮ Uses preferential attachment as a guide to grow the

network

◮ new nodes prefer to attach to well-connected nodes

◮ (Simplified) process:

◮ the process starts with some initial subgraph ◮ each new node comes in with m edges ◮ probability of connecting to existing node i is proportional to

i’s degree

◮ results in a power-law degree distribution with exponent

α = 3

34 / 72

slide-35
SLIDE 35

ER vs. BA

Experiment with 1000 nodes, 999 edges (m0 = 1 in BA model). random preferential attachment

35 / 72

slide-36
SLIDE 36

In summary..

phenomenon real networks ER WS BA small diameter yes yes yes yes high clustering yes no yes yes1 scale-free yes no no yes

1clustering coefficient is higher than in random networks, but not as high

as for example in WS networks

36 / 72

slide-37
SLIDE 37

Network Analysis, Part II

Today’s contents

  • 1. Centrality

◮ Degree centrality ◮ Closeness centrality ◮ Betweenness centrality

  • 2. Community finding algorithms

◮ Hierarchical clustering ◮ Agglomerative ◮ Girvan-Newman ◮ Modularity maximization: Louvain method 37 / 72

slide-38
SLIDE 38

Centrality in Networks

Centrality is a node’s measure w.r.t. others

◮ A central node is important and/or powerful ◮ A central node has an influential position in the network ◮ A central node has an advantageous position in the

network

38 / 72

slide-39
SLIDE 39

Degree centrality

Power through connections

degree_centrality(i)

def

= k(i)

39 / 72

slide-40
SLIDE 40

Degree centrality

Power through connections

in_degree_centrality(i)

def

= kin(i)

40 / 72

slide-41
SLIDE 41

Degree centrality

Power through connections

  • ut_degree_centrality(i)

def

= kout(i)

41 / 72

slide-42
SLIDE 42

Degree centrality

Power through connections

By the way, there is a normalized version which divides the centrality of each degree by the maximum centrality value possible, i.e. n − 1 (so values are all between 0 and 1). But look at these examples, does degree centrality look OK to you?

42 / 72

slide-43
SLIDE 43

Closeness centrality

Power through proximity to others

closeness_centrality(i)

def

=

  • j=i d(i, j)

n − 1 −1 = n − 1

  • j=i d(i, j)

Here, what matters is to be close to everybody else, i.e., to be easily reachable or have the power to quickly reach others.

43 / 72

slide-44
SLIDE 44

Betweenness centrality

Power through brokerage

A node is important if it lies in many shortest-paths

◮ so it is essential in passing information through the network

44 / 72

slide-45
SLIDE 45

Betweenness centrality

Power through brokerage

betweenness_centrality(i)

def

=

  • j<k

gjk(i) gjk Where

◮ gjk is the number of shortest-paths between j and k, and ◮ gjk(i) is the number of shortest-paths through i

Oftentimes it is normalized: norm_betweenness_centrality(i)

def

= betweenness_centrality(i) n−1

2

  • 45 / 72
slide-46
SLIDE 46

Betweenness centrality

Examples (non-normalized)

46 / 72

slide-47
SLIDE 47

What is community structure?

47 / 72

slide-48
SLIDE 48

Why is community structure important?

48 / 72

slide-49
SLIDE 49

.. but don’t trust visual perception

it is best to use objective algorithms

49 / 72

slide-50
SLIDE 50

Main idea

A community is dense in the inside but sparse w.r.t. the outside

No universal definition! But some ideas are:

◮ A community should be densely connected ◮ A community should be well-separated from the rest of the

network

◮ Members of a community should be more similar among

themselves than with the rest

Most common..

  • nr. of intra-cluster edges > nr. of inter-cluster edges

50 / 72

slide-51
SLIDE 51

Some definitions

Let G = (V, E) be a network with |V | = n nodes and |E| = m

  • edges. Let C be a subset of nodes in the network (a “cluster” or

“community”) of size |C| = nc. Then

◮ intra-cluster density:

δint(C) = nr. internal edges of C nc(nc − 1)/2

◮ inter-cluster density:

δext(C) = nr. inter-cluster edges of C nc(n − nc) A community should have δint(C) > δ(G), where δ(G) is the average edge density of the whole graph G, i.e. δ(G) = nr. edges in G n(n − 1)/2

51 / 72

slide-52
SLIDE 52

Most algorithms search for tradeoffs between large δint(C) and small δext(C)

◮ e.g. optimizing C δint(C) − δext(C) over all communities

C Define further:

◮ mc = nr. edges within cluster C = |{(u, v)|u, v ∈ C}| ◮ fc = nr. edges in the frontier of C = |{(u, v)|u ∈ C, v ∈ C}| ◮ nc1 = 4, mc1 = 5, fc1 = 2 ◮ nc2 = 3, mc2 = 3, fc2 = 2 ◮ nc3 = 5, mc3 = 8, fc3 = 2

52 / 72

slide-53
SLIDE 53

Community quality criteria

◮ conductance: fraction of edges leaving the cluster fc 2mc+fc ◮ expansion: nr of edges per node leaving the cluster fc nc ◮ internal density: a.k.a. “intra-cluster density” mc nc(nc−1)/2 ◮ cut ratio: a.k.a. “inter-cluster density” fc nc(n−nc) ◮ modularity: difference between nr. of edges in C and the

expected nr. of edges E[mc] of a random graph with the same degree distribution 1 4m(mc − E[mc])

53 / 72

slide-54
SLIDE 54

Methods we will cover

◮ Hierarchical clustering

◮ Agglomerative ◮ Divisive (Girvan-Newman algorithm)

◮ Modularity maximization algorithms

◮ Louvain method 54 / 72

slide-55
SLIDE 55

Hierarchical clustering

From hairball to dendogram

55 / 72

slide-56
SLIDE 56

Suitable if input network has hierarchical structure

56 / 72

slide-57
SLIDE 57

Agglomerative hierarchical clustering [Newman, 2010]

Ingredients

◮ Similarity measure between nodes ◮ Similarity measure between sets of nodes

Pseudocode

  • 1. Assign each node to its own cluster
  • 2. Find the cluster pair with highest similarity and join them

together into a cluster

  • 3. Compute new similarities between new joined cluster and
  • thers
  • 4. Go to step 2 until all nodes form a single cluster

57 / 72

slide-58
SLIDE 58

Example

  • 20

40 60 80 −20 20 40 60 80

Data

  • D. Blei

Clustering 02 5 / 21

slide-59
SLIDE 59

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 001

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-60
SLIDE 60

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 002

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-61
SLIDE 61

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 003

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-62
SLIDE 62

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 004

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-63
SLIDE 63

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 005

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-64
SLIDE 64

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 006

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-65
SLIDE 65

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 007

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-66
SLIDE 66

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 008

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-67
SLIDE 67

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 009

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-68
SLIDE 68

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 010

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-69
SLIDE 69

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 011

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-70
SLIDE 70

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 012

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-71
SLIDE 71

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 013

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-72
SLIDE 72

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 014

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-73
SLIDE 73

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 015

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-74
SLIDE 74

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 016

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-75
SLIDE 75

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 017

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-76
SLIDE 76

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 018

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-77
SLIDE 77

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 019

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-78
SLIDE 78

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 020

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-79
SLIDE 79

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 021

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-80
SLIDE 80

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 022

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-81
SLIDE 81

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 023

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-82
SLIDE 82

Example

  • 20

40 60 80 −20 20 40 60 80

iteration 024

V1 V2

  • D. Blei

Clustering 02 5 / 21

slide-83
SLIDE 83

Similarity measures wij for nodes I

Let A be the adjacency matrix of the network, i.e. Aij = 1 if (i, j) ∈ E and 0 otherwise.

◮ Jaccard index:

wij = |Γ(i) ∩ Γ(j)| |Γ(i) ∪ Γ(j)| where Γ(i) is the set of neighbors of node i

◮ Cosine similarity:2

wij =

  • k AikAkj
  • k A2

ik

  • k A2

jk

= nij

  • kikj

where:

◮ nij = |Γ(i) ∩ Γ(j)| =

k AikAkj, and

◮ ki =

k Aik is the degree of node i

58 / 72

slide-84
SLIDE 84

Similarity measures wij for nodes II

◮ Euclidean distance: (or rather Hamming distance since A

is binary) dij =

  • k

(Aik − Ajk)2

◮ Normalized Euclidean distance:3

dij =

  • k(Aik − Ajk)2

ki + kj = 1 − 2 nij ki + kj

◮ Pearson correlation coefficient

rij = cov(Ai, Aj) σiσj =

  • k(Aik − µi)(Ajk − µj)

nσiσj where µi = 1

n

  • k Aik and σi =
  • 1

n

  • k(Aik − µi)2

2From the equation xy = |x||y| cos θ 3Uses the idea that the maximum value of dij is when there are no

common neighbors and then dij = ki + kj

59 / 72

slide-85
SLIDE 85

Similarity measures for sets of nodes

◮ Single linkage: sXY =

m´ ax

x∈X,y∈Y sxy ◮ Complete linkage: sXY =

m´ ın

x∈X,y∈Y sxy ◮ Average linkage: sXY =

  • x∈X,y∈Y sxy

|X| × |Y |

60 / 72

slide-86
SLIDE 86

Agglomerative hierarchical clustering on Zachary’s network

Using average linkage

61 / 72

slide-87
SLIDE 87

The Girvan-Newman algorithm

A divisive hierarchical algorithm [Girvan and Newman, 2002]

Edge betweenness

The betweenness of an edge is the nr. of shortest-paths in the network that pass through that edge It uses the idea that “bridges” between communities must have high edge betweenness

62 / 72

slide-88
SLIDE 88

The Girvan-Newman algorithm

Pseudocode

  • 1. Compute betweenness for all edges in the network
  • 2. Remove the edge with highest betweenness
  • 3. Go to step 1 until no edges left

Result is a dendogram

63 / 72

slide-89
SLIDE 89

Definition of modularity [Newman, 2010]

Using a null model

Random graphs are not expected to have community structure, so we will use them as null models. Q = (nr. of intra-cluster communities) − (expected nr of edges) In particular: Q = 1 2m

  • ij

(Aij − Pij) δ(Ci, Cj) where Pij is the expected number of edges between nodes i and j under the null model, Ci is the community of vertex i, and δ(Ci, Cj) = 1 if Ci = Cj and 0 otherwise.

64 / 72

slide-90
SLIDE 90

How do we compute Pij?

Using the “configuration” null model

The “configuration” random graph model choses a graph with the same degree distribution as the original graph uniformly at random.

◮ Let us compute Pij ◮ There are 2m stubs or half-edges available in the

configuration model

◮ Let pi be the probability of picking at random a stub

incident with i pi = ki 2m

◮ The probability of connecting i to j is then pipj = kikj 4m2 ◮ And so Pij = 2mpipj = kikj 2m

65 / 72

slide-91
SLIDE 91

Properties of modularity

Q = 1 2m

  • ij
  • Aij − kikj

2m

  • δ(Ci, Cj)

◮ Q depends on nodes in the same clusters only ◮ Larger modularity means better communities (better than

random intra-cluster density)

◮ Q ≤ 1 2m

  • ij Aij δ(Ci, Cj) ≤

1 2m

  • ij Aij ≤ 1

◮ Q may take negative values

◮ partitions with large negative Q implies existence of cluster

with small internal edge density and large inter-community edges

66 / 72

slide-92
SLIDE 92

The Louvain method [Blondel et al., 2008]

Considered state-of-the-art

Pseudocode

  • 1. Repeat until local optimum reached

1.1 Phase 1: partition network greedily using modularity 1.2 Phase 2: agglomerate found clusters into new nodes

67 / 72

slide-93
SLIDE 93

The Louvain method

Phase 1: optimizing modularity

Pseudocode for phase 1

  • 1. Assign a different community to each node
  • 2. For each node i

◮ For each neighbor j of i, consider removing i from its

community and placing it to j’s community

◮ Greedily chose to place i into community of neighbor that

leads to highest modularity gain

  • 3. Repeat until no improvement can be done

68 / 72

slide-94
SLIDE 94

The Louvain method

Phase 2: agglomerating clusters to form new network

Pseudocode for phase 2

  • 1. Let each community Ci form a new node i
  • 2. Let the edges between new nodes i and j be the sum of

edges between nodes in Ci and Cj in the previous graph (notice there are self-loops)

69 / 72

slide-95
SLIDE 95

The Louvain method

Observations

◮ The output is also a hierarchy ◮ Works for weighted graphs, and so modularity has to be

generalized to Qw = 1 2W

  • ij
  • Wij − sisj

2W

  • δ(Ci, Cj)

where Wij is the weight of undirected edge (i, j), W =

ij Wij and si = k Wik.

70 / 72

slide-96
SLIDE 96

References I

Barabási, A.-L. and Albert, R. (1999). Emergence of scaling in random networks. science, 286(5439):509–512. Blondel, V. D., Guillaume, J.-l., Lambiotte, R., and Lefebvre,

  • E. (2008).

Fast unfolding of community hierarchies in large networks. Networks, pages 1–6. Girvan, M. and Newman, M. E. J. (2002). Community structure in social and biological networks. Proceedings of the National Academy of Sciences of the United States of America, 99:7821–7826. Newman, M. (2010). Networks: An Introduction. Oxford University Press, USA, 2010 edition.

71 / 72

slide-97
SLIDE 97

References II

Newman, M. E. (2003). The structure and function of complex networks. SIAM review, 45(2):167–256. Watts, D. J. and Strogatz, S. H. (1998). Collective dynamics of small-world networks. nature, 393(6684):440–442.

72 / 72