Description Usage Arguments Details Value See Also Examples

View source: R/cosnet.cross.validation.R

This function applies the function `COSNet`

to the input data with a cross validation procedure.

1 | ```
cosnet.cross.validation(labels, W, nfolds, cost)
``` |

`labels` |
named matrix of node labels. The (i-j)-th component contains the label (1 for positive examples, -1 for negative examples) of node i for j-th functional class to be predicted |

`W` |
square symmetric named matrix. The (i,j)-th component is a similarity index between node i and node j. The components of the diagonal of W are zero. |

`nfolds` |
integer corresponding to the number of desired folds |

`cost` |
real value that corresponds to the cost parameter of |

`cosnet.cross.validation`

runs the function `COSNet`

on the input data through a cross validation procedure. For each class to be predicted (column of "labels"), both "W" and "labels" are partitioned into "nfolds" subsets and at each iteration the labels of a fold are hidden and predicted with function `COSNet`

. When possible, input data are partitioned by ensuring the same proportion of positive and negative instances in each fold.

List with three elements:

`labels` |
1/-1 named input label matrix, in which rows correspond to nodes and columns to classes |

`predictions` |
named 1/-1 prediction matrix, in which rows correspond to nodes and columns to classes. The position i-j-th is 1 if the node i has been predicted as positive for the class j, -1 otherwise |

`scores` |
named real score matrix, in which rows correspond to nodes and columns to classes. The position i-j-th is a real number corresponding to the internal energy at equlibrium for node i when predicting class j. This score is a "degree" of membership of node i to the class j |

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
library(bionetdata);
data(Yeast.STRING.data)
data(Yeast.STRING.FunCat) # "Yeast.STRING.FunCat"
## excluding the dummy "00" root
Yeast.STRING.FunCat <-
Yeast.STRING.FunCat[, -which(colnames(Yeast.STRING.FunCat) == "00")];
nfolds <- 5;
res <- cosnet.cross.validation(Yeast.STRING.FunCat[, 1:50], Yeast.STRING.data,
nfolds, 0.0001);
## computing performances
library(PerfMeas);
perf <- F.measure.single.over.classes(res$labels, res$predictions);
cat(perf$average);
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.