randp: Random projection for sparse matrix

Description Usage Arguments Value Examples

View source: R/rcoclust.R

Description

Implementation of the reduction of matrix via a right multiplication with a generated Gaussian random matrix. The data vectors for the columns are not required for the input parameters in envrdata.

Usage

1
randp(envrdata,dimr,sgr,vect_Ar,transfrm,debug)

Arguments

envrdata

environment with data.

dimr

reduced dimension for random projection.

sgr

standard deviation for random projection.

vect_Ar

vector with the transformed matrix after random projection.

transfrm

transformation of the data (0:none, 1:binarization, 2:tf-idf, 3:tf-idf+rows normalization).

debug

flag for debug, if equal to 1 shows some informations to user.

Value

The function alters the matrix in vect_Ar with the result of the reduction.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  library(Rcoclust);
  
  #load data
  data(data_cstr);
  envrdata=get_envrdata(A_ijx,lbs,name,0);
  
  #retrieve matrix size and number of classes
  n=envrdata$n;
  d=envrdata$d;
  g=length(unique(envrdata$lbs));
  
  #random projection
  dimr    = min(500,envrdata$d); #reduced dimension
  sgr     = 1;                   #std for projection
  vect_Ar = rep(0,n*dimr);       #reduced matrix in vector form
  Rcoclust::randp(envrdata,dimr,sgr,vect_Ar,3,0);
  Ar=matrix(vect_Ar,nrow=n,byrow = TRUE);
  
  #kmeans+random projection
  km=kmeans(Ar,g);
  table(km$cluster,envrdata$lbs);

Rcoclust documentation built on May 6, 2017, 3:34 a.m.

Related to randp in Rcoclust...