
Helper function for initialising a neural estimator.
The estimator is couched in the DeepSets framework so that it can be applied to data with an arbitrary number of independent replicates (including the special case of a single replicate).
initialise_estimator(
p,
architecture,
d = 1,
estimator_type = "point",
depth = 3,
width = 32,
activation = "relu",
activation_output = "identity",
variance_stabiliser = NULL,
kernel_size = NULL,
weight_by_distance = TRUE,
probs = c(0.025, 0.975)
)
the initialised neural estimator, a JuliaProxy object
number of unknown parameters in the statistical model
a string: for unstructured data, one may use a fully-connected MLP ("MLP"); for data collected over a grid, a convolutional neural network ("CNN"); and for graphical or irregular spatial data, a graphical neural network ("GNN").
for unstructured multivariate data (i.e., when architecture = "MLP"
), the dimension of the data (e.g., d = 3
for trivariate data); otherwise, if architecture
is "CNN"
or "GNN"
, the argument d
controls the number of input channels (e.g., d = 1
for univariate spatial processes).
the type of estimator; either "point" or "interval".
the number of hidden layers. Either a single integer or an integer vector of length two specifying the depth of inner (summary) and outer (inference) network of the DeepSets framework. Since there is an input and an output layer, the total number of layers is sum(depth) + 2
.
a single integer or an integer vector of length sum(depth)
specifying the width (or number of convolutional filters/channels) in each layer.
the (non-linear) activation function of each hidden layer. Accepts a string of Julia code (default "relu"
).
the activation function of the output layer layer. Accepts a string of Julia code (default "identity"
).
a function that will be applied directly to the input, usually to stabilise the variance.: a string ('log' for the natural logarithm, or 'cbrt' for the cube-root function), or a string of Julia code that will be converted to a Julia function using juliaEval()
.
(applicable only to CNNs) a list of length depth[1]
containing lists of integers of length D, where D is the dimension of the convolution (e.g., D = 2 for two-dimensional convolution).
(applicable only to GNNs) flag indicating whether the estimator will weight by spatial distance; if true (default), a WeightedGraphConv
layer is used in the propagation module; otherwise, a regular GraphConv
layer is used.
(applicable only if estimator_type = "interval"
) probability levels defining the lower and upper endpoints of the posterior credible interval.
if (FALSE) {
library("NeuralEstimators")
p = 2
initialise_estimator(p, architecture = "MLP")
initialise_estimator(p, architecture = "GNN")
## 1D convolution
initialise_estimator(p, architecture = "CNN", kernel_size = list(10, 5, 3))
## 2D convolution
initialise_estimator(p, architecture = "CNN",
kernel_size = list(c(10, 10), c(5, 5), c(3, 3)))}
Run the code above in your browser using DataLab