NAME

Algorithm::Classifier::IsolationForest::App::Command::fit - Fits the model using the specified data and save it

DESCRIPTION

Trains a model from a CSV and saves it as JSON. Every column is a feature and every row one sample, so all rows need the same column count and every value must be numeric.

The tuning switches map onto the constructor arguments:

- -n :: n_trees
- -s :: seed
- -m :: sample_size
- -e :: extension_level
- -c :: contamination
- --voting :: voting

With --prototype the schema -- feature names, descriptions, mungers and missing policy -- along with schema_version and schema_description come from the prototype file, its params supply the knob defaults, and the switches above override those params. See PROTOTYPES in Algorithm::Classifier::IsolationForest for the format.

Run it as iforest fit; iforest help fit 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 fit 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 the numeric knobs parse, that -e is only used with --extended, that --voting is mean or majority, 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

Builds the model from the CSV and writes it to -o.

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