NN {criticality}R Documentation

NN Function

Description

This function trains an ensemble of deep neural networks to predict keff values (imports Tabulate, Scale, Model, Fit, Plot, and Test functions).

Usage

NN(
  batch.size = 8192,
  code = "mcnp",
  dataset,
  ensemble.size = 5,
  epochs = 1500,
  layers = "8192-256-256-256-256-16",
  loss = "sse",
  opt.alg = "adamax",
  learning.rate = 0.00075,
  val.split = 0.2,
  overwrite = FALSE,
  remodel = FALSE,
  replot = TRUE,
  verbose = FALSE,
  ext.dir,
  training.dir = NULL
)

Arguments

batch.size

Batch size

code

Monte Carlo radiation transport code (e.g., "cog", "mcnp")

dataset

Training and test data

ensemble.size

Number of deep neural networks in the ensemble

epochs

Number of training epochs

layers

String that defines the deep neural network architecture (e.g., "64-64")

loss

Loss function

opt.alg

Optimization algorithm

learning.rate

Learning rate

val.split

Validation split

overwrite

Boolean (TRUE/FALSE) that determines if files should be overwritten

remodel

Boolean (TRUE/FALSE) that determines if an existing metamodel should be reused

replot

Boolean (TRUE/FALSE) that determines if .png files should be replotted

verbose

Boolean (TRUE/FALSE) that determines if TensorFlow and Fit function output should be displayed

ext.dir

External directory (full path)

training.dir

Training directory (full path)

Value

A list of lists containing an ensemble of deep neural networks and weights

Examples


ext.dir <- paste0(tempdir(), "/criticality/extdata")
dir.create(ext.dir, recursive = TRUE, showWarnings = FALSE)

extdata <- paste0(.libPaths()[1], "/criticality/extdata")
file.copy(paste0(extdata, "/facility.csv"), ext.dir, recursive = TRUE)
file.copy(paste0(extdata, "/mcnp-dataset.RData"), ext.dir, recursive = TRUE)

config <- FALSE
try(config <- reticulate::py_config()$available)
try(if (config == TRUE) {
  NN(
    batch.size = 128,
    ensemble.size = 1,
    epochs = 10,
    layers = "256-256-16",
    loss = "sse",
    replot = FALSE,
    ext.dir = ext.dir
  )
})


[Package criticality version 0.9.3 Index]