| metrics | R Documentation |
'metrics()' returns a wide range of binary class evaluation metrics based on the inputs of True Positive, True Negative, Fale Positive, and Fale Negative quantities
metrics(TP, TN, FP, FN)
TP |
- [scalar] True Positives |
TN |
- [scalar] True Negatives |
FP |
- [scalar] False Positives |
FN |
- [scalar] False Negatives |
This function is a one-stop-shop to compute 50+ metric results based on the input of TP, TN, FP, and FN
[list] - list of all metrics
## Not run:
sim_data <- get_sim_data(site_samples = 800, N_site_bags = 75,
sites_var1_mean = 80, sites_var1_sd = 10,
sites_var2_mean = 5, sites_var2_sd = 2,
backg_var1_mean = 100,backg_var1_sd = 20,
backg_var2_mean = 6, backg_var2_sd = 3)
formatted_data <- format_site_data(sim_data, N_sites=10, train_test_split=0.8,
sample_fraction = 0.9, background_site_balance=1)
train_data <- formatted_data[["train_data"]]
train_presence <- formatted_data[["train_presence"]]
test_presence <- formatted_data[["test_presence"]]
##### Logistic Mean Embedding KLR Model
#### Build Kernel Matrix
K <- build_K(train_data, sigma = sigma, dist_metric = dist_metric)
#### Train
train_log_pred <- KLR(K, train_presence, lambda, 100, 0.001, verbose = 2)
#### Predict
test_log_pred <- KLR_predict(test_data, train_data, dist_metric = dist_metric,
train_log_pred[["alphas"]], sigma)
cm <- make_quads(ifelse(test_log_pred >= 0.5, 1, 0), test_presence)
metrics(TP = cm[1], TN = cm[3], FP = cm[2], FN = cm[4])$Informedness
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.