# In MLJ, can I access individual predictions in an \`EnsembleModel\`?

**URL:** https://discourse.julialang.org/t/in-mlj-can-i-access-individual-predictions-in-an-ensemblemodel/74302
**Category:** Machine Learning
**Created:** [January 9, 2022, 8:10pm UTC](https://discourse.julialang.org/t/in-mlj-can-i-access-individual-predictions-in-an-ensemblemodel/74302 "2022-01-09T20:10:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [January 9, 2022, 8:10pm UTC](https://discourse.julialang.org/t/in-mlj-can-i-access-individual-predictions-in-an-ensemblemodel/74302/1 "2022-01-09T20:10:11Z")

</div>

The question in the title is copied from Slack.

---

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [January 9, 2022, 8:28pm UTC](https://discourse.julialang.org/t/in-mlj-can-i-access-individual-predictions-in-an-ensemblemodel/74302/2 "2022-01-09T20:28:25Z")

</div>

The short answer is no, there is no public interface for doing this. The learned parameters of each atomic model are of course stored as part of the learned parameters for the composite, so you could get at these in principle, but this would be a hack.

However, you could instead create your ensemble using a learning network, which you export as a new composite model type. There is an example of just this in [this](https://juliaai.github.io/DataScienceTutorials.jl/getting-started/ensembles-3/) Data Science Tutorial. Each atomic model amounts to a machine in the learning network, and `fitted_params(composite_machine)` gives you an access point for all machines trained in the network.

After the line in the tutorial

```julia
mach = machine(one_hundred_models, X, y)

```

you can go on to do

```julia
julia> fit!(mach, verbosity=0);

julia> machs = fitted_params(mach).machines;

julia> predictions = [predict(mach, X) for mach in machs];

julia> predictions[99] |> mean
22.532806324110677

```
