outbrain / fwumious_wabbit

Fwumious Wabbit, fast on-line machine learning toolkit written in Rust
Other
133 stars 19 forks source link

Monte carlo block added #113

Open ggaspersic opened 1 year ago

ggaspersic commented 1 year ago

Created a separate MonteCarlo block which executes the run of a specific continuation of blocks n times (where n is the number of iterations), where a specific number of inputs (also configurable) is masked with a random function where the seed is based on the sum of the input. For each run we pick which index should be masked instead of iterating over the whole array & checking if it should be masked or not.

In the case of FW this block can be configurable run as part of the FFM after the triangle block, where it re-uses the input from the FFM/triangle on each run, which reduces the CPU & time of execution.

The execution of the sub runs is stored into a separate PredictionStats struct, which contains the mean, standard deviation, variance and number of iterations.

Additionally we allow the exposing of the PredictionStats information via FFI as an array of outputs.