hardclasses {softclassval}R Documentation

Convert to hard class labels

Description

hardclasses converts the soft class labels in x into a factor with hard class memberships and NA for soft samples.

Usage

hardclasses(x, classdim = 2L, soft.name = NA, tol = 1e-05, drop = TRUE)

harden(x, classdim = 2L, tol = 1e-06, closed = TRUE)

Arguments

x

matrix or array holding the class memberships

classdim

dimension that holds the classes, default columns

soft.name

level for soft samples

tol

tolerance: samples with membership >= 1 - tol are considered to be hard samples of the respective class.

drop

see drop1d

closed

logical indicating whether the system should be treated as closed-world (i.e. all memberships add to 1)

Details

harden hardens the soft

Value

factor array of shape dim (x) [-classdim]

Author(s)

Claudia Beleites

See Also

factor2matrix for the inverse

Examples

softclassval:::pred
harden (softclassval:::pred)
harden (softclassval:::pred, closed = FALSE)

## classical threshold at 0.5
harden (softclassval:::pred, tol = 0.5)

## grey zone: NA for memberships between 0.25 and 0.75
harden (softclassval:::pred, tol = 0.25)

## threshold at 0.7 = 0.5 + 0.2:
harden (softclassval:::pred - 0.2, tol = 0.5)
harden (softclassval:::pred - 0.2, tol = 0.5, closed = FALSE)

[Package softclassval version 1.0-20160527 Index]