Description Usage Arguments Details Value Author(s) Examples
View source: R/hilbertProjection.R
Starting from a Hilbert Index generated in a high dimensional space, returns a set of coordinates in a new (lower) dimensional space
1 | hilbertProjection(hc, target = 2)
|
hc |
the hilbert index returned by |
target |
the number of dimensions in the target space (defaults to 2) |
Based on the maximum index and the targeted number of dimensions the number of target bins is computed and used to generate a reference matrix and a reference index. The reference matrix is returned, ordered by the reference index.
a matrix with target
columns, corresponding to
the projection of each Hilbert index to target
dimensions
Marilisa Neri
Yann Abraham
John Skilling (for the original C
function)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # generate a random matrix
ncols <- 5
mat <- matrix(rnorm(ncols*5000),ncol=ncols)
dimnames(mat)[[2]] <- LETTERS[seq(ncols)]
# generate 4 bins with a minimum bin size of 5
horder <- 4
cuts <- make.cut(mat,n=horder+1,count.lim=5)
# Generate the cuts and compute the Hilbert index
cut.mat <- do.cut(mat,cuts,type='fixed')
hc <- do.hilbert(cut.mat,horder)
chc <- table(hc)
idx <- as.numeric(names(chc))
# project the matrix to 2 dimensions
proj <- hilbertProjection(hc)
# visualize the result
img <- matrix(0,ncol=max(proj[,2])+1,nrow = max(proj[,1])+1)
img[proj[idx,]+1] <- chc
image(img)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.