# Extracting sets of representative objects using a dissimilarity matrix

### Description

The function extracts a set of representative objects that exhibits the key features of the whole data set, the goal being to get easy sounded interpretation of the latter. The user can set either the desired coverage level (the proportion of objects having a representative in their neighborhood) or the desired number of representatives.

### Usage

1 2 3 |

### Arguments

`diss` |
A dissimilarity matrix or a |

`criterion` |
the representativeness criterion for sorting the
candidate list. One of |

`score` |
an optional vector containing the representativeness scores used for sorting the objects in the candidate list. The length of the vector must be equal to the number of rows/columns in the distance matrix, i.e the number of objects. |

`decreasing` |
if a score vector is provided, indicates whether the objects in the candidate list must be sorted in ascending or decreasing order of this score. The first object in the candidate list is supposed to be the most representative. |

`trep` |
controls the size of the representative set by setting
the desired coverage level, i.e the proportion of objects having a
representative in their neighborhood. Neighborhood radius is defined
by |

`nrep` |
number of representatives. If |

`tsim` |
neighborhood
radius as a percentage of the maximum (theoretical)
distance |

`dmax` |
maximum theoretical distance. Used to derive the neighborhood radius as |

`weights` |
vector of weights of length equal to the number of rows of the dissimilarity matrix. If |

### Details

The representative set is obtained by an heuristic. Representatives are selected by successively extracting from the sequences sorted by their representativeness score those which are not redundant with already retained representatives. The selection stops when either the desired coverage or the wanted number of representatives is reached. Objects are sorted either by the values provided as `score`

argument, or by specifying one of the following as `criterion`

argument: `"freq"`

(*sequence frequency*), `"density"`

(*neighborhood density*), `"dist"`

(*centrality*).

The *frequency* criterion uses the frequencies as
representativeness score. The frequency of an object in the data is
computed as the number of other objects with whom the dissimilarity
is equal to 0. The more frequent an object the more representative it
is supposed to be. Hence, objects are sorted in decreasing frequency
order. Indeed, this criterion is the neighborhood (see below)
criterion with the neighborhood diameter set to 0.

The *neighborhood density* is the
number—density—of sequences in the neighborhood of the object. This requires to set the neighborhood radius `tsim`

. Objects are
sorted in decreasing density order.

The *centrality* criterion is the sum of distances to all other objects. The
smallest the sum, the most representative the sequence.

Use `criterion="dist"`

and `nrep=1`

to get the medoid and `criterion="density"`

and `nrep=1`

to get the densest object pattern.

For more details, see Gabadinho et al., 2011.

### Value

An object of class `diss.rep`

. This is a vector containing
the indexes of the representative objects with the following additional attributes:

`Scores` |
a vector with the representative score of each object given the chosen criterion. |

`Distances` |
a matrix with the distance of each object to its nearest representative. |

`Statistics` |
a data frame with quality measures for each representative: number of objects attributed to the representative, number of object in the representative's neighborhood, mean distance to the representative. |

`Quality` |
overall quality measure. |

Print and summary methods are available.

### Author(s)

Alexis Gabadinho (with Gilbert Ritschard for the help page)

### References

Gabadinho A, Ritschard G (2013). "Searching for typical life trajectories applied to child birth histories", In R Lévy, E. Widmer (eds.), *Gendered Life Courses*, pp. 287-312. Vienna: LIT.

Gabadinho A, Ritschard G, Studer M, Müller NS (2011). "Extracting and Rendering Representative Sequences", In A Fred, JLG Dietz, K Liu, J Filipe (eds.), *Knowledge Discovery, Knowledge Engineering and Knowledge Management*, volume 128 of *Communications in Computer and Information Science (CCIS)*, pp. 94-106. Springer-Verlag.

### See Also

`seqrep`

, `disscenter`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
## Defining a sequence object with the data in columns 10 to 25
## (family status from age 15 to 30) in the biofam data set
data(biofam)
biofam.lab <- c("Parent", "Left", "Married", "Left+Marr",
"Child", "Left+Child", "Left+Marr+Child", "Divorced")
biofam.seq <- seqdef(biofam, 10:25, labels=biofam.lab)
## Computing the distance matrix
costs <- seqsubm(biofam.seq, method="TRATE")
biofam.om <- seqdist(biofam.seq, method="OM", sm=costs)
## Representative set using the neighborhood density criterion
biofam.rep <- dissrep(biofam.om)
biofam.rep
summary(biofam.rep)
``` |