cluster analysis 2 - unina.it · cluster analysis 2 m.b. ferraro + l.tardella clusteranalysis2...

55
Cluster analysis 2 M.B. Ferraro + L.Tardella Cluster analysis 2 Maria Brigida Ferraro + Luca Tardella e-mail: [email protected], [email protected] Lezione #3: Cluster Analysis

Upload: others

Post on 18-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Cluster analysis 2

Maria Brigida Ferraro + Luca Tardellae-mail: [email protected],

[email protected]

Lezione #3: Cluster Analysis

Page 2: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Classificazione non gerarchica

Supponiamo di avere a disposizione un insieme di dati relativoa n unità statistiche su cui sono state rilevate p caratteristiche(di natura quantitativa).

A differenza dei metodi gerarchici in cui il numero dei clustervaria dal caso estremo e banale pari a 1 (1 gruppo composto datutte le n unità) all’altro caso estremo e banale pari a n (ngruppi composti da 1 unità ciascuno), nei metodi NONgerarchici, il numero di gruppi k deve essere fissato a priori (!)dal ricercatore (ovviamente deve essere 1 < k < n)

Nota: i gruppi ottenuti soddisfano particolari criteri diottimalità, fissato il numero di gruppi k.

Page 3: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Perché la necessità dei metodi nongerarchici?

Si possono proporre una serie di motivazioni che spieganoperché l’utilizzo di metodi non gerarchici è estremamente utilee vantaggioso.

In alcuni casi, per motivazioni di natura pratica, i metodi nongerarchici rappresentano l’unico strumento che consente dideterminare una classificazione delle unità statistiche.

Vediamo di seguito, in dettaglio, quali sono queste motivazioni

Page 4: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Formalizzazione del problema diclassificazione

I metodi gerarchici consentono di formalizzare la procedura diclassificazione attraverso la definizione di una esplicita funzioneobiettivo. Le unità statistiche vengono pertanto allocate neivari gruppi in maniera tale da minimizzare una specificafunzione di perdita. Molto spesso, tale funzione si esprime intermini della scomposizione della devianza totale:

T = W + B.

In particolare, la partizione ottimale ottenuta garantisce che siosservi la massima coesione all’interno dei gruppi: Min(W ).Equivalentemente si ricerca Max(B).

Page 5: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Non ci sono "vincoli di inclusione"

Nei metodi gerarchici (aggregativi), se in corrispondenza di kgruppi, due unità appartengono allo stesso gruppo, nelmomento in cui si ricerca la partizione relativa a k − 1 gruppi,non si può verificare che le due unità in questione appartenganoa gruppi distinti. Esempio (n = 6, k = 3):

!"#$%&#'(#)%&%#*+(&'%,(#-(#(&',.)(%&/0##$/(#1/2%-(#3/454'6('(#75334/352(+(89#)/#(&#'%44():%&-/&;5#-(#<#34.::(9#-./#.&(2=#5::542/&3%&%#5,,%#)2/))%#34.::%9#&/,#1%1/&2%#(&#'.(#)(#4('/4'5#,5#:542(;(%&/#4/,52(+5#5#<#>#?#34.::(9#&%&#)(#:.@#+/4(A('54/#'6/#,/#-./#.&(2=#(&#B./)2(%&/#5::542/&35&%#5#34.::(#-()2(&2("##

C)/1:(%#7&DE9#<DF8G##

H4.::%#?G#.&(2=#?9#.&(2=#!## # <DF#34.::(# # # # # H4.::%#!G#.&(2=#F9#.&(2=#I## # # # # # # # # H4.::%#FG#.&(2=#J9#.&(2=#E## #

H4.::%#?G#.&(2=#?9#.&(2=#!9#.&(2=#F## # <D!#34.::(# # # # # # # # # # # # # # # $K## # # # # # # # # H4.::%#!G#.&(2=#I9#.&(2=#J9#.&(2=#E##

H4.::%#?G#.&(2=#?9#.&(2=#!9#.&(2=#F9#.&(2=#I## # <D!#34.::(# # # # # # # # # # # # # # # KL## # # # # # # # # H4.::%#!G#.&(2=#J9#.&(2=#E###

F

Page 6: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Ne segue che il metodo non risente di fusioni effettuate neiprimi passi della procedura di aggregazione. Vediamo unapossibile fusione che crea risultati in un certo senso anomali.Seguendo l’esempio precedente, considerando il caso con p = 2caratteristiche.

!"# $"%&"# '("# )*#+",-.-#/-/# 0)$"/,"#.)# 1&$)-/)#"11",,&2,"#/")# 30)+)# 32$$)# ."**2# 30-'".&02#.)#2%%0"%24)-/"5##6".)2+-#&/2#3-$$)7)*"#1&$)-/"#'("#'0"2#0)$&*,2,)#)/#&/#'"0,-#$"/$-#2/-+2*)5##8"%&"/.-#*9"$"+3)-#30"'"."/,":#'-/$)."02/.-#)*#'2$-#'-/#3#;#<#'202,,"0)$,)'("5##

2X

1X

u1

u2u3 u4

u5

u6

=#;#<#>!?@#####

2X

1X

u1

u2u3 u4

u5

u6

= ;#A####

2X

1X

u1

u2u3 u4

u5

u6

=#;#<#>?B@#######C2#320,)4)-/"#'-00",,2#'-/.&'"#2#'-/'*&$)-/)#D&2/,-+"/-#.)$'&,)7)*)5## E

Page 7: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Bassa complessità computazionale

Fissato il numero di gruppi k, la partizione ottimale deve esseredeterminata tra tutte quelle possibili.

Sfortunatamente, l’insieme delle soluzioni possibili è dielevatissime dimensioni (se n = 20 e k = 4, le soluzionipossibili sono più di 45 miliardi ! )

Comunque, il problema è facilmente risolvibile attraverso unaprocedura iterativa che si compone dei seguenti passi:

1 Individuazione di una partizione iniziale.2 Nuova allocazione delle unità ai gruppi in maniera tale che

W = min.3 Regola di arresto per la conclusione della procedura.

Page 8: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Bassa complessità computazionale

Tale procedura ha il pregio di NON rendere necessaria lacostruzione della matrice delle dissimilarità tra unità che haordine (n × n).

Tuttavia, l’impossibilità di enumerare tutte le possibilisoluzioni, comporta il rischio di incorrere in un ottimo (minimo)locale e, dunque, non sempre globale.

Page 9: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Cosa significa incorrere in ottimi(minimi) locali?

Tra una iterazione e la successiva, ci troviamo in una situazionein cui la funzione obiettivo da minimizzare non decrescesignificativamente ma si stabilizza su di un minimo, chepurtroppo è locale.

Page 10: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Centroidi

I metodi non gerarchici consentono la determinazione di unitàfittizie che sono rappresentative dei gruppi ottenuti.

Tali unità fittizie prendono il nome di centroidi. I centroidiconsentono di caratterizzare con estrema facilità i gruppievidenziandone le peculiarità.

Page 11: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

IL METODO DELLE k-MEDIE

Il più comune metodo di classificazione non gerarchica è ilmetodo delle k-medieminU,H

JFkM =n∑

i=1

k∑g=1

uigd2 (xi ,hg )

s.t. uig ∈ {0, 1}, i = 1, · · · , n g = 1, · · · , kk∑

g=1uig = 1, i = 1, · · · , n

L’informazione relativa all’appartenenza delle unità ai gruppi èdata dalla cosiddetta matrice di allocazione U, il cui elementogenerico è uig (i = 1, n; g =, 1, k). H indica la matrice deiprototipi (detti centroidi), cioè gli elementi rappresentativi deigruppi.

Page 12: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

IL METODO DELLE k-MEDIE

Ciascuna riga si riferisce ad una osservazione e ciascunacolonna ad un gruppo.

In particolare, poiché gli elementi di U possono essere nulli ounitari, ciascuna riga è formata da un solo uno e da k − 1 valorinulli (GRUPPI DISGIUNTI).

kmeans(x, centers, iter.max = 10, nstart = 1, algorithm =

c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"),

trace=FALSE)

Page 13: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k

Una possibilità è fornita dall’analisi della Somma dei quadratiwithin. È una informazione che R ci fornisce nell’output(withinss)

kmeans(...)$withinss

• Il numero ottimale di gruppi k si può determinareosservando che withinss decresce al crescere di k.

• Il numero ottimale di gruppi k deve compendiare leesigenze contrapposte di buona omogeneità interna deigruppi e di buona sintesi della classificazione.

• Questo comporta il fatto che k deve essere tale per cui ilpassaggio da k − 1 a k gruppi comporta una diminuzionerilevante di withinss ed il passaggio da k a k + 1 gruppicomporta, invece, una diminuzione piuttosto ridotta diwithinss.

Page 14: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

IL METODO DEI k-MEDOIDI -Partitioning Around Medoids (PAM)

minU,H

JFkM =n∑

i=1

k∑g=1

uigd2 (xi ,mg )

s.t. uimg ∈ {0, 1}, i = 1, · · · , n mg = 1, · · · , kk∑

g=1uimg = 1, i = 1, · · · , n {m1, · · · ,mk} ⊆ {1, · · · , n}

La differenza sostanziale rispetto al metodo delle k-medie è chei prototipi dei cluster non è più una osservazione fittizia comeerano i centroidi, ma una osservazione reale (tra le n unitàosservate) detta medoide. Questo è molto utile per finiinterpretativi in quanto consente di interpretare i gruppi sullabase di prototipi reali.

pam(x, k, diss = inherits(x, "dist"), metric = "euclidean",

medoids = NULL, stand = FALSE, cluster.only = FALSE, do.swap

= TRUE, keep.diss = !diss !cluster.only n < 100, keep.data

= !diss !cluster.only, pamonce = FALSE, trace.lev = 0)

Page 15: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k

Si può usare il metodo precedente basato sulla somma deiquadrati within. In alternativa:

Silhouette

s(i) =b(i)− a(i)

max(b(i), a(i))∈ [−1, 1]

dove• a(i) è la dissimilarità media dell’unità i calcolata rispetto atutte le altre unità assegnate allo stesso cluster

• b(i) è la minima dissimilarità media dell’unità i calcolatarispetto a tutti gli altri cluster

Page 16: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

• s(i) ≈ 1 l’unità i è correttamente assegnata al cluster• s(i) ≈ −1 l’unità i non è assegnata al cluster giusto• s(i) ≈ 0 l’unità i non è chiaramente assegnabile ad unodei due cluster

Il numero ottimale di gruppi k si ha in corrispondenza delmassimo della media delle silhouette s(i) calcolata su tutte le nunità (... Average silhouette width)

pam(...)$silinfo

Page 17: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

IL METODO DEI k-MEDOIDI -Clustering LARge Applications (CLARA)

• Il problema è lo stesso di PAM (quindi non è riportato).• Quello che cambia è l’algoritmo risolutivo.• Il limite di PAM è che si applica solo a data set didimensione medio-piccola (n < 200).

• CLARA cerca di superare tale limite.

Page 18: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Come?

• La Fase 1 consiste nell’individuare un campione di unità(di numerosità sampsize) la cui numerosità permette diapplicare PAM con k medoidi.

• Nella Fase 2 si assegna ciascuna delle rimanenti unità alcluster caratterizzato dal medoide avente la distanzaminima rispetto all’unità in questione.

• Questa procedura viene ripetuta per diverse volte(samples) e la soluzione ritenuta ottimale è quella per cuila distanza media calcolata tra tutte le unità e i rispettivimedoidi è minima.

clara(x, k, metric = "euclidean", stand = FALSE, samples = 5,

sampsize = min(n, 40 + 2 * k), trace = 0, medoids.x = TRUE,

keep.data = medoids.x, rngR = FALSE, pamLike = FALSE)

Page 19: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

LA LOGICA FUZZY: UN ESEMPIO

Cosa è?

Page 20: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

E adesso? È sempre una mela?

Page 21: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Ancora più dubbi si hanno con la seguente immagine:

Page 22: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

E, infine, abbiamo la situazione estrema (o quasi):

Page 23: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

LOGICA FUZZY: CONCETTIINTRODUTTIVI

La logica classica è quella dicotomica aristotelica secondo cuiogni asserzione è o vera o falsa (o è bianco o è nero). In altreparole, non esistono vie di mezzo.

La logica dicotomica si riduce ad una sola legge: A o non A.Secondo questa logica, alla domanda se le immagini precedentirappresentano una mela, le uniche risposte consentite sono:

• si, è vero (A)• no, è falso (non A)

La logica fuzzy cerca di oltrepassare questo bivalenza del vero edel falso (del bianco e del nero).

Page 24: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Logica fuzzy

La logica fuzzy si basa sull’evidenza secondo cui il mondo realeè talmente complesso da non poter essere trattato attraversoproposizioni nette (o bianco o nero). In altre parole sonoconsentite anche proposizioni "contraddittorie" in cui è lecitoassumere che possa verificarsi congiuntamente A e non A.

Alla logica del bianco o nero si contrappone la logica dellagradazione di grigi. In questo modo abbiamo tutti gli strumentiper rispondere coerentemente alle immagini della mela.

Page 25: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY - FANNY

Nell’approccio fuzzy non si ha più che una unità appartiene onon appartiene ad un generico cluster. Dal bianco o nero sipassa alla gradazione di grigi nel senso che una unità appartienead un certo gruppo secondo un certo grado che varia tra

• 0 (completa non appartenenza) e• 1 (completa appartenenza).

L’appartenenza di una unità ad un gruppo non è soltanto datadall’insieme {0, 1} ma dall’insieme [0, 1]. Si parla di grado diappartenenza di una unità ad un gruppo.

Page 26: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY - FANNY

minU

J =k∑

g=1

n∑i=1

n∑j=1

umig um

jgd2 (i , j)

2n∑

i=1um

ig

s.t. uig ∈ [0, 1], i = 1, · · · , n g = 1, · · · , kk∑

g=1uig = 1, i = 1, · · · , n

Nell’approccio fuzzy, appare il parametro di ’fuzziness’ m (> 1)che regola il livello di sfocatura (o, appunto ’fuzziness’) delmetodo.

Page 27: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY - FANNY

• Se m aumenta, aumenta anche il livello di fuzziness.• Se m→ 1, i risultati tendono a essere simili a quelli delmetodo delle k-medie.

• Spesso si pone m = 2.

fanny(x, k, diss = inherits(x, "dist"), memb.exp = 2, metric

= c("euclidean", "manhattan", "SqEuclidean"), stand = FALSE,

iniMem.p = NULL, cluster.only = FALSE, keep.diss = !diss

!cluster.only n < 100, keep.data = !diss !cluster.only,

maxit = 500, tol = 1e-15, trace.lev = 0)

Page 28: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY - fclust

• Il pacchetto di R fclust contiene funzioni per effettuareuna analisi dei gruppi con approccio fuzzy.

• Il noto algoritmo k-Medie Fuzzy, assieme ad alcune suevarianti, è disponibile nel pacchetto.

• Il pacchetto contiene anche alcune funzioni per calcolareindici fuzzy per la scelta del numero ottimale di gruppi.

Page 29: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY - FkM

La versione fuzzy del metodo delle k-Medie è definita nelseguente modo:

minU,H

JFkM =n∑

i=1

k∑g=1

umig d2 (xi ,hg ) =

n∑i=1

k∑g=1

umig ‖xi − hg‖2

s.t. uig ∈ [0, 1] ,k∑

g=1uig = 1

dove• m è il parametro di sfocatura (fuzziness).

FKM (X, k, m, RS, stand, startU, conv, maxit)

Page 30: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Gaussian distributed clusters

[µ1µ2

]=

[0 00 3

]Σ1 = Σ2 =

[4 00 0.3

]

-4 -2 0 2 4

-10

12

34

X[,1]

X[,2]

Page 31: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Gruppi "lineari"

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

−10 0 10 20 30 40 50−

100

1020

30

X[,1]

X[,2

]

Σ =

[302 146.3146.3 185.1

]cor(X1,X2) = 0.62

• forma non sferica....alta correlazione!!!

Page 32: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Risultati ottenuti con FkM

-4 -2 0 2 4

-10

12

34

X[,1]

X[,2]

FkM non riesce a riconoscere gruppi di forma non sferica,caratterizzati da alti valori di correlazione tra variabili.

Page 33: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Risultati ottenuti con FkM

−10 0 10 20 30 40 50

−10

010

2030

X[,1]

X[,2

]

Page 34: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY -GK

Una variante dell’algoritmo FkM è quello di Gustafson-Kessel(GK), che riesce a riconoscere le diverse forme dei gruppiusando la matrice di covarianza per ogni cluster.

minU,H,F1···Fk

JFkM =n∑

i=1

k∑g=1

umig d2 (xi ,hg )

s.t. uig ∈ [0, 1] ,k∑

g=1uig = 1, |Fg | = ρg > 0

dove• d2 (xi ,hg ) = (xi − hg )

′Fg (xi − hg ) è la distanza di

Mahalanobis• Fg : simmetrica e definita positiva• ρg : parametro legato al volume (di solito pari a 1)

FKM.gk (X, k, m, vp, RS, stand, startU, conv, maxit)

Page 35: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY -ENTROPICO

minU,H

Jent =n∑

i=1

k∑g=1

uigd2 (xi ,hg ) + pn∑

i=1

k∑g=1

uig log uig

s.t. uig ∈ [0, 1] ,k∑

g=1uig = 1

dove• p: è il grado di entropia fuzzy

FKM.ent (X, k, ent, RS, stand, startU, conv, maxit)

Page 36: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY -Entropico-GK

minU,H,F1···Fk

Jent =n∑

i=1

k∑g=1

uigd2 (xi ,hg ) + pn∑

i=1

k∑g=1

uig log uig

s.t. uig ∈ [0, 1] ,k∑

g=1uig = 1, |Fg | = ρg > 0

dove

• d2 (xi ,hg ) = (xi − hg )′Fg (xi − hg ) è la distanza di

Mahalanobis

FKM.gk.ent (X, k, ent, vp, RS, stand, startU, conv, maxit)

Page 37: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Risultati - Entropico GK

-4 -2 0 2 4

-10

12

34

X[,1]

X[,2]

Page 38: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Risultati - Entropico GK

−10 0 10 20 30 40 50

−10

010

2030

X[,1]

X[,2

]

Page 39: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY -FkMedoid

Il problema di ottimizzazione è:

minU,X

JFkMed =n∑

i=1

k∑g=1

umig d2 (xi , xg )

s.t. uig ∈ [0, 1] ,k∑

g=1uig = 1, {xg , l = 1, . . . , k} ⊂ {xi , i = 1, . . . , n} .

È noto che l’algoritmo dei k-Medoidi fuzzy è più robustodell’algortimo delle k-Medie Fuzzy quando sono presenti datianomali.

FKM.med (X, k, m, RS, stand, startU, conv, maxit)

Page 40: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

CLUSTER ANALYSIS FUZZY -FkM-noise

In presenza di dati anomali, un approccio alternativo èconsiderare un ulteriore gruppo, chiamato gruppo "noise". Seun oggetto è riconosciuto come dato anomalo, sarà assegnatoal gruppo "noise" con grado di appartenenza alto. Il problemadi ottimizzazione è il seguente:

minU,H

JNoise =n∑

i=1

k∑g=1

umig d2 (xi ,hg ) +

n∑i=1

δ2(1−

k∑g=1

uig

)m

s.t. uig ∈ [0, 1] ,k+1∑g=1

uig = 1.

dove• δ2 è un parametro non negativo.

FKM.noise (X, k, m, delta, RS, stand, startU, conv, maxit)

Page 41: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k:PC

Il coefficiente di partizione è un indice molto noto usato perscegliere il numero ottimale di cluster. Dipende dalla matricedei gradi di appartenenza U ed è definito come

PC(k) =n∑

i=1

k∑g=1

(uig )2

n . (1)

PC assume valori nell’intervallo [1/k, 1]. Il numero ottimale dicluster k è ottenuto quando il valore dell’indice è massimizzatorispetto a k. Purtroppo decresce in modo monotono con k.

PC(U)

Page 42: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k:MPC

Una variante di PC è una la seguente trasformazione lineare:

MPC(k) = 1− kk − 1 (1− PC(k)) . (2)

MPC varia nell’intervallo [0, 1].

MPC(U)

Page 43: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k:PE

Come per l’indice PC, anche l’indice di entropia della partizione(PE) è solo basato su U ed è definito nel seguente modo:

PE (k) = −n∑

i=1

k∑g=1

uig loga(uig )

n . (3)

Il numero ottimale di gruppi k è ottenuto minimizzando taleindice. Anche in questo caso, vi è un’apparente monotonicità.

PE(U, b)

Page 44: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k:

Per tener conto del diverso grado di appartenenza, moltoutilizzato è l’indice di Xie e Beni (da minimizzare):

XB(k) =

n∑i=1

k∑g=1

umig d2 (xi ,hg )

ming ,g ′

d2(hg ,hg ′).

XB(Xca, U, H, m)

Page 45: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Scelta del numero ottimale di gruppi k:FS

Come abbiamo visto in precedenza un indice di "clustervalidity" molto usato è la silhouette (SIL(Xca, U)). Poichétale indice non usa la matrice dei gradi di appartenenza U, laversione fuzzy (FS) è stata introdotta. Formalmente è definitocome

FS(k) =

n∑i=1

(uig − uig ′)αsi (k)

n∑i=1

(uig − uig ′)α(4)

dove uig e uig ′ sono il primo e il secondo elemento più grandedell’i-esima riga di U e α è un peso (di solito α = 1). Il numeroottimale di gruppi k è ottenuto massimizzando tale indice.

SIL.F(Xca, U, alpha)

Page 46: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Cenni all’estensione dei metodi nongerarchici probabilistici

Distribuzioni mistura: le misture di normali

Rappresentazione di una mistura di normali univariata con Gcomponenti:

G∑g=1

wg f (x ;µg , σ2g )

Interpretazione probabilistica della nozione di gruppo e delleunità ad esso appartenenti: le unità del gruppo hanno valorinumerici della variabile (delle variabili nel caso multivariato)concepite come campione casuale da una particolaredistribuzione teorica caratterizzata da parametri che ladistinguono dalle distribuzioni teoriche caratterizzanti gli altrigruppi.

Page 47: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Misture di normali

La nozione di appartenenza ad un gruppo e la possibilità diriconoscere tale appartenenza non è necessariamente garantita.

• Pacchetto di R mclust

Mclust(data, G=NULL, modelNames=NULL, prior=NULL,

control=emControl(), initialization=NULL, warn=FALSE, ...)

Page 48: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Misture di normali multivariate

In effetti nella generalità dei casi abbiamo a che fare con piùvariabili e dunque è necessario ricorrere alle normalimultivariate.Rappresentazione di una mistura di normali multivariate con Gcomponenti:

44/46

P �i ?

�����������

Misture di normali multivariate

In effetti nella generalità dei casi abbiamo a che fare con più variabili e dunque ènecessario ricorrere alle normali multivariate

Rappresentazione di una mistura di normali multivariate con G componenti:

A Appendix: Clustering Models

MCLUST usually assumes a normal or Gaussian mixture model

n�

i=1

G�

k=1

τk φk(xi | µk,Σk),

where where x represents the data, G is the number of components, τk is the probabilty thatan observation belongs to the kth component (τk ≥ 0;

�Gk=1 τk = 1) , and

φk(x | µk,Σk) = (2π)−p2 |Σk|−

12 exp

�−1

2(xi − µk)

TΣ−1k (xi − µk)

�. (1)

The exception is for model-based hierarchical clustering, for which the model used is theclassification likelihood with a parameterized normal distribution assumed for each class:

n�

i=1

φ�i (xi | µ�i ,Σ�i ),

where the �i are labels indicating a unique classification of each observation: �i = k if xi

belongs to the kth component.The components or clusters in both these models are ellipsoidal, centered at the means

µk. The covariances Σk determine their other geometric features. Each covariance matrix isparameterized by eigenvalue decomposition in the form

Σk = λkDkAkDTk ,

where Dk is the orthogonal matrix of eigenvectors, Ak is a diagonal matrix whose elementsare proportional to the eigenvalues of Σk, and λk is a scalar (Banfield and Raftery 1993).The orientation of the principal components of Σk is determined by Dk, while Ak determinesthe shape of the density contours; λk specifies the volume of the corresponding ellipsoid,which is proportional to λd

k |Ak|, where d is the data dimension. Characteristics (orientation,volume and shape) of distributions are usually estimated from the data, and can be allowedto vary between clusters, or constrained to be the same for all clusters [19, 2, 6]. Thisparameterization includes but is not restricted to well-known models such as equal-volumespherical variance (Σk = λI) which gives the sum of squares criterion [24], constant variance[15], and unconstrained variance [22].

In one dimension, there are just two models: E for equal variance and V for varyingvariance. In more than one dimension, the model identifiers code geometric characteristicsof the model. For example, EVI denotes a model in which the volumes of all clusters areequal (E), the shapes of the clusters may vary (V), and the orientation is the identity (I).Clusters in this model have diagonal covariances with orientation parallel to the coordinateaxes. Parameters associated with characteristics designated by E or V are determined fromthe data. Table 1 shows the various multivariate model options currently available in MCLUST

for hierarchical clustering (denoted HC) and EM. These are a subset of the parameterizationsdiscussed in [6], which gives details of the EM algorithm for maximum likelihood estimationfor these models.

50

Densità normale multivariata:

A Appendix: Clustering Models

MCLUST usually assumes a normal or Gaussian mixture model

n�

i=1

G�

k=1

τk φk(xi | µk,Σk),

where where x represents the data, G is the number of components, τk is the probabilty thatan observation belongs to the kth component (τk ≥ 0;

�Gk=1 τk = 1) , and

φk(x | µk,Σk) = (2π)−p2 |Σk|−

12 exp

�−1

2(xi − µk)

TΣ−1k (xi − µk)

�. (1)

The exception is for model-based hierarchical clustering, for which the model used is theclassification likelihood with a parameterized normal distribution assumed for each class:

n�

i=1

φ�i (xi | µ�i ,Σ�i ),

where the �i are labels indicating a unique classification of each observation: �i = k if xi

belongs to the kth component.The components or clusters in both these models are ellipsoidal, centered at the means

µk. The covariances Σk determine their other geometric features. Each covariance matrix isparameterized by eigenvalue decomposition in the form

Σk = λkDkAkDTk ,

where Dk is the orthogonal matrix of eigenvectors, Ak is a diagonal matrix whose elementsare proportional to the eigenvalues of Σk, and λk is a scalar (Banfield and Raftery 1993).The orientation of the principal components of Σk is determined by Dk, while Ak determinesthe shape of the density contours; λk specifies the volume of the corresponding ellipsoid,which is proportional to λd

k |Ak|, where d is the data dimension. Characteristics (orientation,volume and shape) of distributions are usually estimated from the data, and can be allowedto vary between clusters, or constrained to be the same for all clusters [19, 2, 6]. Thisparameterization includes but is not restricted to well-known models such as equal-volumespherical variance (Σk = λI) which gives the sum of squares criterion [24], constant variance[15], and unconstrained variance [22].

In one dimension, there are just two models: E for equal variance and V for varyingvariance. In more than one dimension, the model identifiers code geometric characteristicsof the model. For example, EVI denotes a model in which the volumes of all clusters areequal (E), the shapes of the clusters may vary (V), and the orientation is the identity (I).Clusters in this model have diagonal covariances with orientation parallel to the coordinateaxes. Parameters associated with characteristics designated by E or V are determined fromthe data. Table 1 shows the various multivariate model options currently available in MCLUST

for hierarchical clustering (denoted HC) and EM. These are a subset of the parameterizationsdiscussed in [6], which gives details of the EM algorithm for maximum likelihood estimationfor these models.

50

Densità normale multivariata:

44/46

P �i ?

�����������

Misture di normali multivariate

In effetti nella generalità dei casi abbiamo a che fare con più variabili e dunque ènecessario ricorrere alle normali multivariate

Rappresentazione di una mistura di normali multivariate con G componenti:

A Appendix: Clustering Models

MCLUST usually assumes a normal or Gaussian mixture model

n�

i=1

G�

k=1

τk φk(xi | µk,Σk),

where where x represents the data, G is the number of components, τk is the probabilty thatan observation belongs to the kth component (τk ≥ 0;

�Gk=1 τk = 1) , and

φk(x | µk,Σk) = (2π)−p2 |Σk|−

12 exp

�−1

2(xi − µk)

TΣ−1k (xi − µk)

�. (1)

The exception is for model-based hierarchical clustering, for which the model used is theclassification likelihood with a parameterized normal distribution assumed for each class:

n�

i=1

φ�i (xi | µ�i ,Σ�i ),

where the �i are labels indicating a unique classification of each observation: �i = k if xi

belongs to the kth component.The components or clusters in both these models are ellipsoidal, centered at the means

µk. The covariances Σk determine their other geometric features. Each covariance matrix isparameterized by eigenvalue decomposition in the form

Σk = λkDkAkDTk ,

where Dk is the orthogonal matrix of eigenvectors, Ak is a diagonal matrix whose elementsare proportional to the eigenvalues of Σk, and λk is a scalar (Banfield and Raftery 1993).The orientation of the principal components of Σk is determined by Dk, while Ak determinesthe shape of the density contours; λk specifies the volume of the corresponding ellipsoid,which is proportional to λd

k |Ak|, where d is the data dimension. Characteristics (orientation,volume and shape) of distributions are usually estimated from the data, and can be allowedto vary between clusters, or constrained to be the same for all clusters [19, 2, 6]. Thisparameterization includes but is not restricted to well-known models such as equal-volumespherical variance (Σk = λI) which gives the sum of squares criterion [24], constant variance[15], and unconstrained variance [22].

In one dimension, there are just two models: E for equal variance and V for varyingvariance. In more than one dimension, the model identifiers code geometric characteristicsof the model. For example, EVI denotes a model in which the volumes of all clusters areequal (E), the shapes of the clusters may vary (V), and the orientation is the identity (I).Clusters in this model have diagonal covariances with orientation parallel to the coordinateaxes. Parameters associated with characteristics designated by E or V are determined fromthe data. Table 1 shows the various multivariate model options currently available in MCLUST

for hierarchical clustering (denoted HC) and EM. These are a subset of the parameterizationsdiscussed in [6], which gives details of the EM algorithm for maximum likelihood estimationfor these models.

50

Densità normale multivariata:

A Appendix: Clustering Models

MCLUST usually assumes a normal or Gaussian mixture model

n�

i=1

G�

k=1

τk φk(xi | µk,Σk),

where where x represents the data, G is the number of components, τk is the probabilty thatan observation belongs to the kth component (τk ≥ 0;

�Gk=1 τk = 1) , and

φk(x | µk,Σk) = (2π)−p2 |Σk|−

12 exp

�−1

2(xi − µk)

TΣ−1k (xi − µk)

�. (1)

The exception is for model-based hierarchical clustering, for which the model used is theclassification likelihood with a parameterized normal distribution assumed for each class:

n�

i=1

φ�i (xi | µ�i ,Σ�i ),

where the �i are labels indicating a unique classification of each observation: �i = k if xi

belongs to the kth component.The components or clusters in both these models are ellipsoidal, centered at the means

µk. The covariances Σk determine their other geometric features. Each covariance matrix isparameterized by eigenvalue decomposition in the form

Σk = λkDkAkDTk ,

where Dk is the orthogonal matrix of eigenvectors, Ak is a diagonal matrix whose elementsare proportional to the eigenvalues of Σk, and λk is a scalar (Banfield and Raftery 1993).The orientation of the principal components of Σk is determined by Dk, while Ak determinesthe shape of the density contours; λk specifies the volume of the corresponding ellipsoid,which is proportional to λd

k |Ak|, where d is the data dimension. Characteristics (orientation,volume and shape) of distributions are usually estimated from the data, and can be allowedto vary between clusters, or constrained to be the same for all clusters [19, 2, 6]. Thisparameterization includes but is not restricted to well-known models such as equal-volumespherical variance (Σk = λI) which gives the sum of squares criterion [24], constant variance[15], and unconstrained variance [22].

In one dimension, there are just two models: E for equal variance and V for varyingvariance. In more than one dimension, the model identifiers code geometric characteristicsof the model. For example, EVI denotes a model in which the volumes of all clusters areequal (E), the shapes of the clusters may vary (V), and the orientation is the identity (I).Clusters in this model have diagonal covariances with orientation parallel to the coordinateaxes. Parameters associated with characteristics designated by E or V are determined fromthe data. Table 1 shows the various multivariate model options currently available in MCLUST

for hierarchical clustering (denoted HC) and EM. These are a subset of the parameterizationsdiscussed in [6], which gives details of the EM algorithm for maximum likelihood estimationfor these models.

50

Page 49: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Diversa impostazione e soluzione deiproblemi

• Per un numero di componenti fissato a priori• Stimare i parametri del modello → ML + EM• Come classificare le unità → probabilità/densità

condizionate

• Per un numero di componenti non fissato a priori• Come scegliere il numero di componenti (cluster)

Page 50: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Pacchetto di R fclust

� Algoritmi per l’analisi dei gruppi con un approccio fuzzy eindici per la scelta ottimale di gruppi

Funzioni• cl.memb: Cluster membership

• Produce una sintesi dell’informazione sui gradi diappartenenza.

• cl.memb.H: Cluster membership• Produce una sintesi dell’informazione sui gradi di

appartenenza nel caso non fuzzy (hard, crisp).• cl.memb.t: Cluster membership

• Produce una sintesi dell’informazione sui gradi diappartenenza secondo una soglia.

Page 51: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Funzioni• cl.size: Cluster size

• Produce la dimensione del gruppo.• cl.size.H: Cluster size

• Produce la dimensione del gruppo nel caso non fuzzy(hard, crisp).

• Fclust: Interactive fuzzy clustering analysis• Esegue un’analisi dei gruppi con un approccio fuzzy usando

gli algoritmi disponibili nel pacchetto.• Fclust.index: Clustering indices

• Calcola alcuni indici per la scelta del numero ottimale digruppi k.

Page 52: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Funzioni• FKM: Fuzzy k-means

• Esegue l’algoritmo delle k-medie fuzzy.• FKM.ent: Fuzzy k-means with entropy regularization

• Esegue l’algoritmo delle k-medie fuzzy con unaregolarizzazione entropica.

• FKM.gk: Gustafson and Kessel - like fuzzy k-means• Esegue l’algoritmo delle k-medie fuzzy di tipo

Gustafson-Kessel.• FKM.gk.ent: Gustafson and Kessel - like fuzzy k-meanswith entropy regularization

• Esegue l’algoritmo delle k-medie fuzzy di tipoGustafson-Kessel con una regolarizzazione entropica.

Page 53: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Funzioni

• FKM.med: Fuzzy k-medoids• Esegue l’algoritmo dei k-medoidi.

• FKM.noise: Fuzzy k-means with noise cluster• Esegue l’algoritmo delle k-medie con gruppo "noise".

• Hraw: Raw prototypes• Produce i prototipi usando le unità originali di X (utile se

l’algoritmo è eseguito con dati standardizzati).

Page 54: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Funzioni• MPC: Modified partition coefficient

• Produce il coefficiente di partizione modificato.• PC: Partition coefficient

• Produce il coefficiente di partizione.• PE: Partition entropy

• Produce l’indice di entropia di partizione.

Page 55: Cluster analysis 2 - unina.it · Cluster analysis 2 M.B. Ferraro + L.Tardella Clusteranalysis2 MariaBrigidaFerraro+LucaTardella e-mail: mariabrigida.ferraro@uniroma1.it, ferraromb@gmail.com

Clusteranalysis 2

M.B. Ferraro+ L.Tardella

Funzioni• SIL: Silhouette index

• Produce l’indice silhouette.• SIL.F: Fuzzy silhouette index

• Produce l’indice silhouette fuzzy.• XB: Xie and Beni index

• Produce l’indice di Xie e Beni.