Description Usage Arguments Value Author(s) Examples
Uses information about RED and NOT RED memberships to nominate RED vertices.
1 2 |
adj |
Adjacency matrix |
embeddingDim |
Scalar dimension to embed the adjacency matrix into |
knownRed |
indices of the vertices that are known to be red |
knownNotRed |
indices of the vertices that are known NOT to be red |
initializationStrategy |
currently only accepts "kpp" for semi-supervised k-means++ |
Grange |
number of classes to consider (2 minimum for red and a single not red class) |
redRanking |
vector of posterior probabilities of being red. Supervised points are easy money (0 or 1, respectively) |
redDist |
vector of mahalanobis distance to red center |
ss |
object as returned by the call to ssClust (see documentation in this package) |
Jordan Yoder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | library(ssClust)
library(igraph)
n=500
MCR=100
numNumKnownNotRed <- 5
numKnownNotRedPerJ <- 20
j=6
numKnownNotRed <- (j-1)*numKnownNotRedPerJ
###### FORM ADJ MATRIX #####
#matching Li's simulation parameters
rho <- c(0.4,0.3,.3)
B1 <- matrix(c(0.5,0.3,.4,
0.3,0.8,.6,
.4,0.6, .3), nrow = 3,ncol=3)
B2 <- matrix(.5 ,nrow = 3,ncol=3)
if(n==10)
nu=1
if(n==500)
nu = .3
if(n==10000)
nu = .1
B = nu*B1 + (1-nu)*B2
blockSizes <- n*rho
#simulate graph
A.igraph<- sbm.game(n, pref.matrix = B, block.sizes = blockSizes,
directed = FALSE, loops = FALSE)
###### END FORM ADJ MATRIX ########
#shovel into obj we need
A <- NULL
A$adj <- get.adjacency(A.igraph)
#tau is actual labels
A$tau <- rep(1,blockSizes[1])
A$tau <- c(A$tau, rep(2, blockSizes[2]))
A$tau <- c(A$tau, rep(3, blockSizes[3]))
redGroup = min(A$tau)
#semi-supervise
if(n ==10)
knownRed <- sample(which(A$tau==redGroup),4)
if(n ==500)
knownRed <- sample(which(A$tau==redGroup),20)
if(n ==10000)
knownRed <- sample(which(A$tau==redGroup),40)
#more semi-supervision
knownNotRed <- sample(which(A$tau!=1),
numKnownNotRed)
#cluster and nominate
ss = ssVN(adj=A$adj,
embeddingDim=3,
knownRed = knownRed,
knownNotRed = knownNotRed,
initializationStrategy = "kpp",
Grange=2:5)
library(ROCR)
pred = prediction(ss$redRanking, A$tau==redGroup)
perf = performance(pred, 'tpr','fpr')
plot(perf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.