The function draws a neural network plot as a neural
interpretation diagram using with the plotnet
function of the NeuralNetTools R package.
nplot(dnn.fit, bias = FALSE, ...)
nplot returns invisibly the graphical object representing the neural network architecture of NeuralNetTools.
The induced subgraph of the input graph mapped on data variables. Based on the estimated connection weights, if the connection weight W > 0, the connection is activated and it is highlighted in red; if W < 0, the connection is inhibited and it is highlighted in blue.
Beck, M.W. 2018. NeuralNetTools: Visualization and Analysis Tools for Neural Networks. Journal of Statistical Software. 85(11):1-20.
# \donttest{
if (torch::torch_is_installed()){
# load ALS data
ig<- alsData$graph
data<- alsData$exprs
data<- transformData(data)$data
dnn0 <- SEMdnn(ig, data, train=1:nrow(data), grad = FALSE,
#loss = "mse", hidden = 5*K, link = "selu",
loss = "mse", hidden = c(10, 10, 10), link = "selu",
validation = 0, bias = TRUE, lr = 0.01,
epochs = 32, device = "cpu", verbose = TRUE)
for (j in 1:length(dnn0$model)) {
nplot(dnn0$model[[j]])
Sys.sleep(5)
}
}
#> Conducting the nonparanormal transformation via shrunkun ECDF...done.
#> 1 : z10452 z84134 z836 z4747 z4741 z4744 z79139 z5530 z5532 z5533 z5534 z5535
#> epoch train_l valid_l
#> 32 32 0.2723679 NA
#>
#> 2 : z842 z1432 z5600 z5603 z6300
#> epoch train_l valid_l
#> 32 32 0.3420028 NA
#>
#> 3 : z54205 z5606 z5608
#> epoch train_l valid_l
#> 32 32 0.3112714 NA
#>
#> 4 : z596 z4217
#> epoch train_l valid_l
#> 32 32 0.3771096 NA
#>
#> 5 : z1616
#> epoch train_l valid_l
#> 32 32 0.3722838 NA
#>
#> DNN solver ended normally after 736 iterations
#>
#> logL: -43.66819 srmr: 0.1080962
#>
# }