Explore with Aggregate Sampling Results

## Aggregating Results of a Direct Sampling ðŸ”—

### In Arrays ðŸ”—

Direct sampling and offers a way to aggregate the multiple output value of the model generated by the multiple execution of the model. This is done by settings the argument aggregation of the `Direct Sampling` or `Replication` method. The simplest usage is to generate an array of all the computed outputs. You can then store it using a hook or pass it to a subsequent task:
``````val input_i = Val[Int]
val input_j = Val[Double]
val output1 = Val[Double]
val output2 = Val[Double]

// my post processing code
""") set (
inputs += (output1.array, output2.array)
)

DirectSampling(
evaluation = my_own_model,
sampling =
(input_i in (0 to 10 by 2)) x
(input_j in (0.0 to 5.0 by 0.5)),
aggregation = Seq(output1, output2)
``````

### Statistic Indicators ðŸ”—

OpenMOLE provides a bunch on statistic function you can use to aggregate you outputs. The list of these function is available in the doc. You can use these function either in a `ScalaTask` to post process your results or using the `evaluate` keyword:
``````val input_i = Val[Int]
val input_j = Val[Double]
val output1 = Val[Double]
val output2 = Val[Double]

DirectSampling(
evaluation = my_own_model,
sampling =
(input_i in (0 to 10 by 2)) x
(input_j in (0.0 to 5.0 by 0.5)),
aggregation = Seq(
output1 evaluate median,
output2 evaluate average
)
)
``````

### You own function ðŸ”—

You can also provide your own scala function to aggregate the data, as it is shown in the following example:
``````val input_i = Val[Int]
val input_j = Val[Double]
val output1 = Val[Double]
val output2 = Val[Double]

DirectSampling(
evaluation = my_own_model,
sampling =
(input_i in (0 to 10 by 2)) x
(input_j in (0.0 to 5.0 by 0.5)),
aggregation = Seq(
output1 evaluate "output1.sum / 3.0",
output2 evaluate "output2.sum / 3.0"
)
)
``````
Or:
``````val input_i = Val[Int]
val input_j = Val[Double]
val output1 = Val[Double]
val output2 = Val[Double]

def myAggregation(d: Array[Double]) = d.sum / 3.0

DirectSampling(
evaluation = my_own_model,
sampling =
(input_i in (0 to 10 by 2)) x
(input_j in (0.0 to 5.0 by 0.5)),
aggregation = Seq(
output1 evaluate myAggregation,
output2 evaluate myAggregation
)
)
``````