Produces output for the purpose of constructing graphical displays such as the classmap
. The user first needs train a neural network. The representation of the data in a given layer (e.g. the final layer before applying the softmax function) then serves as the argument X
to vcr.neural.train
.
vcr.neural.train(X, y, probs, estmethod = meancov)
A list with components:
the coordinates of the n
objects of the training
data, in the layer chosen by the user.
number of the given class of each case. Can contain NA
's.
given class label of each case. Can contain NA
's.
levels of y
predicted class number of each case. For each case this is the class with the highest posterior probability. Always exists.
predicted label of each case.
number of the alternative class. Among the classes different from the given class, it is the one with the highest posterior probability. Is NA
for cases whose y
is missing.
label of the alternative class. Is NA
for cases whose y
is missing.
number of columns in X
. Keep??
probability of the alternative class. Is NA
for cases whose y
is missing.
Whether or not the farness is computed using the Mahalanobis distance.
list with center and covariance matrix of each class
if not NULL
, PCA fits to each class, estimated from the training data but also useful for new data.
parameters for computing fig
, can be used for new data.
distance of each case \(i\) from each class \(g\). Always exists.
farness of each case from its given class. Is NA
for cases whose y
is missing.
for each case i
, its lowest fig[i,g]
to any class g
. Always exists.
the coordinates of the n
objects of the training
data, in the layer chosen by the user. Missing
values are not allowed.
factor with the given class labels of the objects. Make sure that the levels are in the same order as used in the neural net, i.e. the columns of its binary "once-hot-encoded" response vectors.
posterior probabilities obtained by the neural
net, e.g. in keras. For each case (row of X
),
the classes have probabilities that add up to 1.
Each row of the matrix probs contains these
probabilities. The columns of probs must be in
the same order as the levels of y
.
function for location and covariance estimation.
Should return a list with $m
and $S
.
Can be meancov
(classical mean and covariance matrix) or DetMCD
.
If one or more classes have a singular covariance
matrix, the function automatically switches to
the PCA-based farness used in vcr.svm.train
.
Raymaekers J., Rousseeuw P.J.
Raymaekers J., Rousseeuw P.J.(2021). Silhouettes and quasi residual plots for neural nets and tree-based classifiers. Journal of Computational and Graphical Statistics, 31(4), 1332–1343. tools:::Rd_expr_doi("10.1080/10618600.2022.2050249")
vcr.neural.newdata
, classmap
, silplot
, stackedplot
# For examples, we refer to the vignette:
if (FALSE) {
vignette("Neural_net_examples")
}
Run the code above in your browser using DataLab