Install with Conda
Create an environment containing Classification 0.1.1, its Blyx source and a runnable example. Run the second command with Blyx 0.2.1, Rust and a host linker installed.
conda create -y --prefix ./blyx-env --override-channels -c https://rahulchaube1.github.io/blyx-packages blyx-classification=0.1.1=0 blyxc native-run ./blyx-env/share/blyx/classification/main.blyx
To use this package in your application, copy share/blyx/classification/vendor/classification from the environment into your project's vendor directory.
Import into a Blyx project
Install Blyx 0.2.1, Rust 1.85 or newer and a host linker. From the directory containing your entry file, clone this tagged release.
git clone --depth 1 --branch v0.1.1 https://github.com/Rahulchaube1/blyx-classification.git vendor/classification
Save this as main.blyx beside vendor and run blyxc native-run main.blyx.
use vendor::classification::classification;
fn main() {
let table = class_confusion([1, 0, 1, 0], [0.9, 0.6, 0.4, 0.1], 0.5);
println!(class_precision(at(table, 0), at(table, 1)));
println!(class_recall(at(table, 0), at(table, 3)));
println!(class_cost(at(table, 1), at(table, 3), 1.0, 5.0));
}Expected output
0.5 0.5 6
API and input requirements
Inputs are equal-length vectors of binary labels and finite probabilities. A score equal to the threshold counts as positive. An undefined precision, recall or F1 has value zero.
| API | Use |
|---|---|
class_confusion(labels, scores, threshold) | Return true positives, false positives, true negatives and false negatives in that order. |
class_precision, class_recall, class_f1 | Calculate scalar metrics from the confusion counts. |
class_cost(fp, missed, fp_cost, fn_cost) | Compute total weighted cost. Divide by observation count for cost per row. |
Develop and contribute
Open the tagged source to read the implementation and examples. Include the smallest reproducible Blyx program, compiler version and expected result when reporting an issue.
