knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(xnet) slotsToRmd <- function(class){ slots <- getSlots(class) txt <- paste0(" * `",names(slots), "` : object of type **", slots, "**") cat(txt, sep = "\n") }
This document describes the S4 class structure used in the xnet
package.
It's mainly a reference for package developers. Users are advised to
use the appropriate functions for extracting the information they need.
The xnet
package has three virtual classes that each define a
number of slots necessary for that specific type of model:
tskrr
for general two step kernel ridge regressionstskrrTune
for tuned two step kernel ridge regressionstskrrImpute
for two step kernel ridge regressions with
imputed data.Each of these classes defines the necessary slots for that specific
type of action. The actual classes returned by the functions tskrr()
,
tune()
and impute()
inherit from (a combination of) these virtual
classes.
After using the function tskrr()
, one of the following classes is
returned:
tskrrHomogeneous
: for homogeneous networkstskrrHeterogeneous
: for heterogeneous networksThese classes have similar slots, but the homogeneous models don't need information on the column kernel matrix. The slots are listed below. In general the following design principles hold:
y
contains the adjacency matrix used to fit the model. This
goes for all different classes, including the tskrrTune
and tskrrImpute
classes. has.hat = TRUE
, the hat matrices Hk and possibly Hg are stored
in the object as well. This can speed up calculations but comes at
a memory cost.pred
holds the predicted values.lambda.k
and lambda.g
store the tuning parameters.labels
store the labels attached to the rows and the
columns in a list with elements k
and g
. If no labels were present,
the single element k
will have one NA
value. The function labels()
will still construct default labels when required.slotsToRmd("tskrrHomogeneous")
slotsToRmd("tskrrHeterogeneous")
Both classes inherit directly from the class tskrr
. But these
classes also function as parent classes from which tune()
related
and impute()
related classes inherit.
When using the function tune()
, you get one of the following classes:
tskrrTuneHomogeneous
: for tuned homogeneous networks. Inherits also from tskrrHomogeneous
.tskrrTuneHeterogeneous
: for tuned heterogeneous networks. Inherits also from tskrrHeterogeneous
.Apart from the slots of the respective tskrr
class, the inheritance
from tskrrTune
adds the following slots:
slotsToRmd("tskrrTune")
These slots use the following design principles:
lambda_grid
is a list with one or two elements named k
and g
,
similar to the labels
slot of the tskrr
classes. These elements
contain the lambda values tested for that dimension. If the grid search
was one-dimensional (and onedim
contains TRUE
), there's only one
element called k
. loss_values
is always a matrix, but when onedim = TRUE
it's a
matrix with a single column. In that matrix, the values are arranged in
such a way that the rows correspond with the lambdas for the row kernel,
and the columns with the lambdas for the column kernel.exclusion
and replaceby0
follow the same rules as the
arguments of the function get_loo_fun()
. When using the function impute()
, you get one of the following
classes:
tskrrImputeHomogeneous
: for homogeneous networks with imputed data.tskrrImputeHeterogeneous
: for heterogeneous networks with imputed data.Apart from the slots of the respective tskrr
class, the inheritance
from tskrrImpute
adds the following slots:
slotsToRmd("tskrrImpute")
The slot imputeid
treats the Y matrix as a vector and stores the
position of the imputed values as a integer vector. The other two slots
just store the settings used during imputation.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.