Title: | Beta Calibration |
---|---|
Description: | Fit beta calibration models and obtain calibrated probabilities from them. |
Authors: | Telmo M Silva Filho and Meelis Kull |
Maintainer: | Telmo M Silva Filho <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-18 06:51:09 UTC |
Source: | CRAN |
Builds a beta calibration model on probability vector p and label vector y, fitting the parameters chosen by the user, with possible values being "abm", "ab" and "am". Returns the calibration model, the calibration map and the chosen parameters.
beta_calibration(p, y, parameters="abm")
beta_calibration(p, y, parameters="abm")
p |
A vector of probabilities that will be used to train the calibration model. |
y |
A vector of labels that will be used to train the calibration model. |
parameters |
The parameters that will be fitted by the model. |
## Creating a vector of probabilities p <- seq(0.01,0.99,0.01) ## Creating a label vector based on the probability vector y <- rbinom(99,1,p) ## Fitting beta calibration with three parameters calib <- beta_calibration(p, y, "abm") ## Fitting beta calibration with two shape parameters calib <- beta_calibration(p, y, "ab") ## Fitting beta calibration with one shape parameter and one location parameter calib <- beta_calibration(p, y, "am")
## Creating a vector of probabilities p <- seq(0.01,0.99,0.01) ## Creating a label vector based on the probability vector y <- rbinom(99,1,p) ## Fitting beta calibration with three parameters calib <- beta_calibration(p, y, "abm") ## Fitting beta calibration with two shape parameters calib <- beta_calibration(p, y, "ab") ## Fitting beta calibration with one shape parameter and one location parameter calib <- beta_calibration(p, y, "am")
Returns calibrated probabilities from calib$model, where calib is obtained by calling the beta_calibration
function.
beta_predict(p, calib)
beta_predict(p, calib)
p |
A vector of probabilities that the model will calibrate. |
calib |
A list containing a calibration map, a calibration model and the fitted parameters, obtained by calling the |
## Creating a vector of probabilities p <- seq(0.01,0.99,0.01) ## Creating a label vector based on the probability vector y <- rbinom(99,1,p) ## Fitting beta calibration with three parameters calib <- beta_calibration(p, y, "abm") ## Obtaining calibrated probabilities probas <- beta_predict(p, calib)
## Creating a vector of probabilities p <- seq(0.01,0.99,0.01) ## Creating a label vector based on the probability vector y <- rbinom(99,1,p) ## Fitting beta calibration with three parameters calib <- beta_calibration(p, y, "abm") ## Obtaining calibrated probabilities probas <- beta_predict(p, calib)