Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier...

31
Functional Latent Block Model for functional data co-clustering Franc ¸ois-Xavier JOLLOIS Universit ´ e Paris Descartes, France joint work with C. Bouveyron (Univ. Nice), L. Bozzi (EDF) & J. Jacques (Univ. Lyon)

Transcript of Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier...

Page 1: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Functional Latent Block Modelfor functional data co-clustering

Francois-Xavier JOLLOISUniversite Paris Descartes, France

joint work withC. Bouveyron (Univ. Nice), L. Bozzi (EDF) & J. Jacques (Univ. Lyon)

Page 2: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

The data

I electricity consumption measured by Linky meters for EDFI 27 millions of customers / 730 daily consumption over 2 years

Figure: Sample of 20 consumptions for 20 days

Page 3: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

The data

I large data matrix x = (xij (t))1≤i≤n,1≤j≤p

I there is a need to summarize this data flowI both n and p are (very) large⇒ need for clustering of row (customers) and column (days of

consumption):need for co-clustering of functional data

Page 4: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Co-clustering ?

Simultaneous clustering of rows (individuals) and column (features)

legend: color level = 1T

∫T xij (t)

Page 5: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Electricity consumption = functional data

I xij (t) are not totally known but only observed at a finite number oftimes points xij (t1), xij (t2), . . .

I need to reconstruct the functional nature of data⇒ basis expansion assumption:

xij (t) =m∑

h=1

aijhφh(t), t ∈ [0,T ].

where (φh(t))h : spline, Fourier, wavelets...I aijh estimated by least square smoothing

Page 6: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Overview

The fLBM model

Inference with SEM-Gibbs algorithm

Numerical experiments

Application on EDF consumption curves

Page 7: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Plan

The fLBM model

Inference with SEM-Gibbs algorithm

Numerical experiments

Application on EDF consumption curves

Page 8: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Latent Block Model (LBM)

AssumptionsI row z = (zik )i,k and column w = (wh`)h,` partitions are

independentI conditionally on (z,w), xij are independent and generated by a

block-specific distribution:

p(θk`)

orginal data coclustering result

Page 9: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Latent Block Model

Latent Block Model (LBM)n × d random variables x are assumed to be independent once therow z = (zik )i,k and column w = (wh`)h,` partitions are fixed:

p(x; θ) =∑z∈V

∑w∈W

p(z; θ)p(w; θ)p(x|z,w; θ)

withI V (W ) set of possible partitions of rows (column) into K (L) groups,I p(z; θ) =

∏ik α

zikk and p(w; θ) =

∏h` β

wh``

I p(x|z,w; θ) =∏

ijk` p(aij ; θk`)vik wh`

I θ = (αk , β`, θk`)

Page 10: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

The functional Latent Block Model (fLBM)

p(aij ; θk`) is the funHDDC distribution (Bouveyron & Jacques, ADAC, 2011):

aij |(zik = 1,wj` = 1) ∼ N (Uk`µk`,Uk`Σk`U tk` + Ξk`)

whereI Uk` projects the aij into a low dimensional subspace for block k`I (µk`,Σk`): (mean,variance) into the low-dimensional subspace,

Qtk`(Uk`Σk`U t

k` + Ξk`)Qk` =

sk`1 0. . .

0 sk`d

0

0

bk` 0. . .

0 bk`

d

(m − d)

with sk`j > bk` for all j = 1, ..., d .

Page 11: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Plan

The fLBM model

Inference with SEM-Gibbs algorithm

Numerical experiments

Application on EDF consumption curves

Page 12: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

LBM inference

LBM inferenceI The aim is to estimate θ by maximizing the observed

log-likelihood

`(θ; x) =∑v,w

ln p(x,v,w; θ).

where functional data x are represented by their coefficient a,and v and w are missing row and column partitions

I EM is not computationally tractableI ⇒ variational or stochastic version should be used

Page 13: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

SEM-Gibbs algorithm for LBM inference

I init : θ(0), w(0)

I SE stepI generate the row and column parititon (v(q+1),w(q+1)) using a

Gibbs samplingI M step

I Estimate θ, conditionally on v(q+1),w(q+1) obtained at the SE step.

Page 14: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

SEM-Gibbs: SE step

1. generate the row partition z(q+1)i = (z(q+1)

i1 , . . . , z(q+1)iK )|a,w(q) for

all 1 ≤ i ≤ n according to z(q+1)i ∼M(1, zi1, . . . , ziK ) with for

1 ≤ k ≤ K

zik = p(zik = 1|a,w(q); θ(q)) =α(q)k fk (ai |w(q); θ(q))∑

k ′ α(q)k ′ fk ′(ai |w(q); θ(q))

where ai = (aij )j and fk (ai |w(q); θ(q)) =∏

j` p(aij ; θ(q)k` )w (q)

j` ,

2. generate the column partitionw (q+1)

j = (w (q+1)j1 , . . . ,w (q+1)

jL )|a, z(q+1) for all 1 ≤ j ≤ p according

to w (q+1)j ∼M(1, wj1, . . . , zjL) with for 1 ≤ ` ≤ L

wj` = p(wj` = 1|a, z(q+1); θ(q)) =β(q)` f`(aj |z(q+1); θ(q))∑

`′ β(q)`′ f`′(aj |z(q+1); θ(q))

where f`(xj |z(q+1); θ(q)) =∏

ik p(aij ; θ(q)k` )z(q+1)

ik .

Page 15: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

SEM-Gibbs: M step

same M step than for FunHDDC (Bouveyron & Jacques, ADAC,2011):

I α(q+1)k = 1

n

∑i z(q+1)

ik and β(q+1)` = 1

p

∑j w (q+1)

j` ,

I µ(q+1)k` = 1

n(q+1)k`

∑i∑

j az(q+1)

ik w (q+1)j`

ij with n(q+1)k` =

∑i∑

j z(q+1)ik w (q+1)

j` ,

I for the model parameters sk`j , bk` and Qk`j :I d first columns of Qk : first eigenvectors of Ω

12 C(q)

k` Ω12 ,

I sk`j , j = 1, ..., d : largest eigenvalues of Ω12 C(q)

k` Ω12 ,

I bk : trace(Ω12 C(q)

k` Ω12 )−

∑dj=1 s(q)

k`j ,

where C(q)k` is the sample covariance matrix of block k`:

C(q)k` =

1

n(q)k`

n∑i=1

p∑j=1

z(q+1)ik ω

(q+1)j` (aij − µ(q)

k` )t (aij − µ(q)k` ),

and Ω = (ωjk )1≤j,k≤m with ωjk =∫ T

0 φj (t)φk (t)dt .

Page 16: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

LBM inference

SEM-Gibbs algorithm for LBM inferenceI θ is obtained by mean of the sample distribution (after a burn in

period)I final bipartition (v, w) estimated by MAP conditionally on θ

Page 17: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

LBM inference

Choosing K and LWe use the ICL-BIC criterion developed in (Lomet 2012) forcontinuous data co-clustering.Thus, K and L can be chosen by maximizing

ICL-BIC(K ,L) = log p(x, v, w; θ)− K − 12

log n − L− 12

log p − KLν2

log(np)

where ν = md + d + 1 is the number of continuous parameters perblock and

log p(x, v, w; θ) =∏ik

zik logαk +∏j`

wj` log β` +∑ijk`

zik wj` log p(aij ; θk`).

Page 18: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Plan

The fLBM model

Inference with SEM-Gibbs algorithm

Numerical experiments

Application on EDF consumption curves

Page 19: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Simulation setting

I f1(t), ..., f4(t) are defined as block means

0.0 0.2 0.4 0.6 0.8 1.0

−1.

0−

0.5

0.0

0.5

1.0

Function 1

0.0 0.2 0.4 0.6 0.8 1.0

0.3

0.4

0.5

0.6

0.7

Function 2

0.0 0.2 0.4 0.6 0.8 1.0

0.0

0.2

0.4

0.6

0.8

1.0

Function 3

0.0 0.2 0.4 0.6 0.8 1.0

−1.

0−

0.5

0.0

0.5

1.0

Function 4

I all curves are sampled as follows:

xij (t)|Zik Wjl = 1 ∼ N (µkl (t), σ2),

where σ = 0.3, µ11 = µ21 = µ33 = µ42 = f1, µ12 = µ22 = µ31 = f2,µ13 = µ32 = f3 and µ23 = µ41 = µ43 = f4.

I noise is added by adding τ% of curves from other blocks.

Page 20: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

3 scenarios of simulation

Table: Parameter values for the three simulation scenarios.

Scenario A B Cn (nb. of rows) 100p (nb. of columns) 100T (length of curves) 30K (row groups nb.) 3 4 4L (col. groups nb.) 3 3 3α (row group prop.) (0.333, ..., 0.333) (0.2, 0.4, 0.1, 0.3) (0.2, 0.4, 0.1, 0.3)

β (col. group prop.) (0.333, ..., 0.333) (0.4, 0.3, 0.3) (0.4, 0.3, 0.3)τ (simulation noise) 0 0.1 0.3

Page 21: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

ICL performance for choosing (K ,L)

Scenario A (K = 3, L = 3)K\L 1 2 3 4 5 6

1 0 0 0 0 0 02 0 0 0 0 0 03 0 0 100 0 0 04 0 0 0 0 0 05 0 0 0 0 0 06 0 0 0 0 0 0

Scenario B (K = 4, L = 3)K\L 1 2 3 4 5 6

1 0 0 0 0 0 02 0 0 0 0 0 03 0 0 0 0 0 04 0 0 70 0 1 05 0 0 26 1 0 06 0 0 2 0 0 0

Scenario C (K = 4, L = 3)K\Q 1 2 3 4 5 6

1 0 0 0 0 0 02 0 0 17 0 0 03 0 0 77 0 0 04 0 0 5 0 0 05 0 0 1 0 0 06 0 0 0 0 0 0

Page 22: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Co-clustering results for scenario B

True partition FunLBM partition

Page 23: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Co-clustering results

random kmeans functional

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

ARI on rows

random kmeans functional

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

ARI on columns

random kmeans functional

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

ARI on rows

random kmeans functional

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

ARI on columns

(a) scenario A (b) scenario B

random kmeans functional

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

ARI on rows

random kmeans functional

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1.0

ARI on columns

(c) scenario C

Figure: Adjusted Rand index values for the different initialization procedureson the three simulation scenarios.

Page 24: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Plan

The fLBM model

Inference with SEM-Gibbs algorithm

Numerical experiments

Application on EDF consumption curves

Page 25: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

The data

I electricity consumption measured by Linky meters for EDFI 27 millions of customers / 730 daily consumption over 2 years

Figure: Sample of 20 consumptions for 20 days

Page 26: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

ICL values (choice of (K ,L))

MAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAXMAX

2

3

4

5

6

7

8

9

10

2 3 4 5 6 7 8 9 10

L

K

−1.62e+08

−1.61e+08

−1.60e+08

BIC

Page 27: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Clustering of columns (dates)

20102011

2012

classe

1

2

3

4

5

Page 28: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Average consumption curves of each block

Page 29: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Geographical clusters distributions

Figure: Proportions on households per French departments in each of the 10clusters found by FunLBM.

Page 30: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

Conclusions

ResultsI real data application needs development of a co-clustering

algorithm for functional dataI co-clustering algorithm has been developed based on a

functional Latent Block modelI numerical experiments show the efficiency of SEM-Gibbs for

model estimation as well as ICL-BIC for selecting of the numberof blocks

I Results on EDF data are significant

ReferencesI Bouveyron, C. and Jacques, J. (2011), Model-based Clustering

of Time Series in Group-specific Functional Subspaces,Advances in Data Analysis and Classification, 5[4], 281-300.

I Govaert, G. and Nadif, M. (2013). Co-Clustering. Wiley-ISTE.

Page 31: Functional Latent Block Model Latent Block Model for functional data co-clustering Franc¸ois-Xavier JOLLOIS Universite Paris Descartes, France´ joint work with C. Bouveyron (Univ

R Package

funLBMI Available on CRAN :https://cran.r-project.org/package=funLBM

Example

l i b r a r y ( funLBM )data ( Ve l i b )# Co−c l u s t e r i n gout = funLBM ( Ve l ib $data , K = 4 , L = 2)# V i s u a l i z a t i o n o f r e s u l t splot ( out , type = ’ b locks ’ )plot ( out , type = ’ p ropo r t i ons ’ )plot ( out , type = ’means ’ )