NAME

Algorithm::Classifier::IsolationForest::App::Command::stream - Stream CSV rows through an Online Isolation Forest model, scoring and learning as it goes

DESCRIPTION

Streams the input rows, in order, through an Algorithm::Classifier::IsolationForest::Online model.

The default is prequential: each row is scored against the model as it stood before that row was learned, then learned, and the model state -- sliding window included -- is saved back to -m, so the next invocation resumes the stream where this one left off. --learn-only skips the scoring, which is what a warm-up wants; --score-only skips the learning.

When -m does not exist yet the creation knobs build a new model; when it does exist they are ignored. With --prototype the schema and its version and description come from the prototype file, its params supply the knob defaults, and the other creation switches override those params.

Input matches iforest fit: CSV, every column a numeric feature, one sample per row. Output is one line per input row:

$score,$label

With -d the input feature columns are prepended.

Run it as iforest stream; iforest help stream lists every option.

METHODS

App::Cmd calls these while dispatching the subcommand. Nothing else should.

opt_spec

Returns this command's option specifications, as the list of arrayrefs Getopt::Long::Descriptive expects.

abstract

Returns the one-line summary iforest commands prints beside the command name.

description

Returns the long help text iforest help stream prints under the option list.

validate

Checks the parsed options before anything is read or written, so a mistake costs nothing.

Checks that -i names a readable CSV, that -m is usable, that --learn-only and --score-only are not combined, that the numeric knobs parse, and that a --mungers spec is readable and accompanied by the feature tags (-t) it compiles against.

Takes the parsed options hashref and the arrayref of remaining arguments. Calls usage_error, which prints the usage and exits, on the first problem it finds, and returns 1 when everything checks out.

execute

Creates or resumes the model, runs the stream, prints the result lines, and saves the updated model back to -m.

Takes the parsed options hashref and the arrayref of remaining arguments, and returns 1.