CreateDataSet: Create data set

Description Usage Arguments Value Author(s) See Also Examples

View source: R/CreateDataSet.R

Description

This function generates toy data that can be used to run the l1-spectal clustering algorithm: the adjacency matrix of a graph with n nodes and its perturbed version.

Usage

1
CreateDataSet(k, n, p, print.plot = TRUE, ClustersLength = NULL)

Arguments

k

True number of clusters.

n

Number of nodes.

p

List of probabilities of perturbations (inside and outside clusters).

print.plot

TRUE/FALSE indicated whether the graph should be plotted.

ClustersLength

Length of the k clusters (not necessary needed). If not provided, randomly chosen in such a way that sum(ClustersLength)=n.

Value

A list with the following elements:

Author(s)

Camille Champion, Magali Champion

See Also

l1_spectralclustering, l1spectral.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 #############################################################
 # Generating toy data
 #############################################################
 Data <- CreateDataSet(k=3, n=20, p=list(p_inside=0.1,p_outside=0.1))

 # Data is a list of three objects:
 # - Data$A is an nxn matrix corresponding to the adjacency matrix of a graph
 # with n nodes and k clusters,
 # - Data$A_hat is a perturbed version of this graph with a probability
 # p_inside of removing an edge inside clusters and
 # p_outside of adding an edge between clusters,
 # - Data$ClustersLength is a vector indicating the length of the clusters.

 Data <- CreateDataSet(k=3, n=20, p=list(p_inside=0.1,p_outside=0.1), print.plot=TRUE)

 # The same as above but the true graph and its perturbed version are both plotted.

l1spectral documentation built on Jan. 27, 2022, 1:07 a.m.