sparsify3 {netDx} | R Documentation

## cleaner sparsification routine - faster, matrix-based version

### Description

cleaner sparsification routine - faster, matrix-based version

### Usage

    sparsify3(W, outFile = sprintf("%s/tmp.txt", tempdir()), cutoff = 0.3,
      maxInt = 50, EDGE_MAX = Inf, includeAllNodes = TRUE,
      verbose = TRUE)

### Arguments

`W` | (matrix) similarity matrix
`outFile` | (char) path to file to write sparsified network
`cutoff` | (numeric) edges with weight smaller than this are set to NA
`maxInt` | (numeric) max num edges per node.
`EDGE_MAX` | (numeric) max num edges in network
`includeAllNodes` | (logical) if TRUE, ensures at least one edge is present for each patient. This feature is required when sparsification excludes test patients that are required to be classified. If the sparsification rules exclude all edges for a patient and this flag is set, then the strongest edge for each missing patient is added to the net. Note that this condition results in the total number of edges potentially exceeding EDGE_MAX
`verbose` | (logical) print detailed messages, useful for debugging

### Details

Sparsifies similarity matrix to keep strongest edges. Sets diagonal and edges < cutoff to NA. Keeps strongest maxInt edges per node. Ties are ignored. Keeps a max of EDGE_MAX edges in the network.

### Value

writes SIF content to text file (node1,node2,edge weight)

### Examples

    m <- matrix(runif(500*500),nrow=500)
    y <- sparsify2(m)
    m <- matrix(runif(500*500),nrow=500)
    y <- sparsify2(m)

[Package netDx version 1.0.3 Index]