Blyx Nest Blyx language
Registry / Framework
framework · v0.1.2

Fold Holdout

Fence training and scoring by fold ID so a late training completion cannot score the wrong holdout.

Source repository · Package JSON

Use Fold Holdout

use vendor::fold_holdout::fold_holdout;

Run the example

nest demo fold_holdout@0.1.2
blyxc native-run fold_holdout-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::fold_holdout::fold_holdout;

fn main() {
    let arguments = cli_args();
    if args_len(arguments) > 0 {
        if args_len(arguments) % 2 != 0 {
            stderr_line("Expected event and value pairs");
            process_exit(2);
        }
        let mut live = fold_holdout_start();
        let mut i = 0;
        while i < args_len(arguments) {
            let input = args_at(arguments, i + 1);
            if !text_is_number(input) {
                stderr_line("Expected a whole numeric event value");
                process_exit(2);
            }
            live = fold_holdout_step(live, args_at(arguments, i), text_number(input));
            let command = fold_holdout_command(live);
            println!(command);
            if command == "reject" { process_exit(1); }
            i += 2;
        }
        return;
    }
    let mut state = fold_holdout_start();
    state = fold_holdout_step(state, "fold", 1.0);
    println!(fold_holdout_command(state));
    state = fold_holdout_step(state, "fitted", 2.0);
    println!(fold_holdout_command(state));
    state = fold_holdout_step(state, "fitted", 1.0);
    println!(fold_holdout_command(state));
    state = fold_holdout_step(state, "done", 1.0);
    println!(fold_holdout_command(state));
    state = fold_holdout_step(state, "fold", 2.0);
    println!(fold_holdout_command(state));
}

Expected output

train_partition
reject
score_holdout
record_fold
train_partition

Published versions

VersionPackageSource commitSHA-256
0.1.2Download ZIP · Browse files2904e5561d8607a74e85747358b9d116e3073b5afab38f0e8d9000cf8e6bb10821eb29c7ff
0.1.1Download ZIP · Browse filesca95303d00922b70b4f79dd52a25634a4aa0fa85e3e39eeb647bc95d34dc3c74dc7eb75686
0.1.0Download ZIP · Browse files6349f237846bdbae09ade803c2771197667c65440aaf35f5ace59a420c8fea8b61bc535d23