vcr.neural.train {classmap}R Documentation

Prepare for visualization of a neural network classification on training data.

Description

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.

Usage

vcr.neural.train(X, y, probs, estmethod = meancov)

Arguments

X

the coordinates of the n objects of the training data, in the layer chosen by the user. Missing values are not allowed.

y

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.

probs

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.

estmethod

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.

Value

A list with components:

X

the coordinates of the n objects of the training data, in the layer chosen by the user.

yint

number of the given class of each case. Can contain NA's.

y

given class label of each case. Can contain NA's.

levels

levels of y

predint

predicted class number of each case. For each case this is the class with the highest posterior probability. Always exists.

pred

predicted label of each case.

altint

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.

altlab

label of the alternative class. Is NA for cases whose y is missing.

ncolX

number of columns in X. Keep??

PAC

probability of the alternative class. Is NA for cases whose y is missing.

computeMD

Whether or not the farness is computed using the Mahalanobis distance.

classMS

list with center and covariance matrix of each class

PCAfits

if not NULL, PCA fits to each class, estimated from the training data but also useful for new data.

figparams

parameters for computing fig, can be used for new data.

fig

distance of each case i from each class g. Always exists.

farness

farness of each case from its given class. Is NA for cases whose y is missing.

ofarness

for each case i, its lowest fig[i,g] to any class g. Always exists.

Author(s)

Raymaekers J., Rousseeuw P.J.

References

Raymaekers J., Rousseeuw P.J.(2021). Silhouettes and quasi residual plots for neural nets and tree-based classifiers. (link to open access pdf)

See Also

vcr.neural.newdata, classmap, silplot, stackedplot

Examples

# For examples, we refer to the vignette:
## Not run: 
vignette("Neural_net_examples")

## End(Not run)

[Package classmap version 1.2.3 Index]