hardclasses: Convert to hard class labels

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

softclassval documentation built on May 2, 2019, 4:56 p.m.