Skip to contents

ResponseBinaryClassif creates a response object that are used as target during the fitting process.

Format

S4 object.

Usage


ResponseBinaryClassif$new(target_name, pos_class, response)
ResponseBinaryClassif$new(target_name, pos_class, response, weights)

Examples


response_binary = ResponseBinaryClassif$new("target", "A", sample(c("A", "B"), 10, TRUE))
response_binary$getResponse()
#>       [,1]
#>  [1,]    1
#>  [2,]   -1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]   -1
#>  [8,]   -1
#>  [9,]    1
#> [10,]   -1
response_binary$getPrediction()
#>       [,1]
#>  [1,]    0
#>  [2,]    0
#>  [3,]    0
#>  [4,]    0
#>  [5,]    0
#>  [6,]    0
#>  [7,]    0
#>  [8,]    0
#>  [9,]    0
#> [10,]    0
response_binary$getPredictionTransform() # Applies sigmoid to prediction scores
#>       [,1]
#>  [1,]  0.5
#>  [2,]  0.5
#>  [3,]  0.5
#>  [4,]  0.5
#>  [5,]  0.5
#>  [6,]  0.5
#>  [7,]  0.5
#>  [8,]  0.5
#>  [9,]  0.5
#> [10,]  0.5
response_binary$getPredictionResponse()  # Categorizes depending on the transformed predictions
#>       [,1]
#>  [1,]    1
#>  [2,]    1
#>  [3,]    1
#>  [4,]    1
#>  [5,]    1
#>  [6,]    1
#>  [7,]    1
#>  [8,]    1
#>  [9,]    1
#> [10,]    1
response_binary$getTargetName()
#> [1] "target"
response_binary$setThreshold(0.7)
response_binary$getThreshold()
#> [1] 0.7
response_binary$getPositiveClass()
#> [1] "A"