R/generate_points.R

Defines functions generate_points

Documented in generate_points

generate_points <-
function(W, unlabeled, labeling) {
	n <- nrow(W);
	N <- length(labeling[-unlabeled]);
	N_pos <- length(which(labeling[-unlabeled] == 1));
	pos_rate <- N_pos/N;					
	p <- length(unlabeled);
	# generating random labels for unlabeled nodes according to the distribution B(p, N_pos/N) 			
	y_rand <- generate_labels(p, pos_rate);		
	labeling[unlabeled] <- y_rand;			
	labeling[labeling <=0] <- 0;
	pos_vect <- W %*% labeling;	
	neg_vect <- W %*% (1-labeling)
	res <- list(pos_vect = pos_vect, neg_vect = neg_vect);
	return (res);
}

Try the COSNet package in your browser

Any scripts or data that you put into this service are public.

COSNet documentation built on Nov. 8, 2020, 8:12 p.m.