Learn R Programming

prcbench (version 0.3.1)

create_usrtool: Create a set of tools

Description

The create_toolset function takes names of predefined tools and generates a list of wrapper functions for Precision-Recall curve calculations.

Usage

create_usrtool(tool_name, func, calc_auc = TRUE, store_res = TRUE)

Arguments

tool_name
A single string to specify the name of a user-defined tool.
func
A function to calculate a Precision-Recall curve and the AUC. It should take an element of the test dataset generated by create_testset as an argument. It also should return a list with three element
calc_auc
A Boolean value to specify whether the AUC score should be calculated.
store_res
A Boolean value to specify whether the calculated curve is retrieved and stored

Value

  • A list of R6 tool objects.

See Also

create_toolset to create a predefined tool set. create_testset for testset. create_example_func to create an example function.

Examples

Run this code
## Create a new tool interface called "xyz"
efunc <- create_example_func()
toolset1 <- create_usrtool("xyz", efunc)

## Example function with a correct argument
testset <- create_usrdata("bench", scores = c(0.1, 0.2), labels = c(1, 0))
retf <- efunc(testset[[1]])

Run the code above in your browser using DataLab