# \[ANN\] LearnAPI.jl - Proposal for a basement-level machine learning API

**URL:** <https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048>\
**Category:** Package Announcements\
**Created:** [January 16, 2023, 8:42pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048 "2023-01-16T20:42:55Z")\
**Posts on this page:** 13\
**Page:** 6

<div class="post-metadata">

**Author:** ![tecosaur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tecosaur/32/23206_2.png) [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Post date:** [October 3, 2024, 3:11am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/103 "2024-10-03T03:11:08Z")

</div>

I’ve had a quick read of the proposal, and a bit of the current interface code.

Overall, it looks brilliant @ablaom, so glad you’ve taken the time to continue this effort. I’ve only got a few niggles that I’d like to raise:

- Cameron’s `minimise` function I think could be better named something like `trim`, `shrink`, or even `downsize` or `deflate`. I think that’s more effective at conveying the intent. Otherwise I’m prone to thinking of model error minimisation, and minimising objectives 😛
- In `src/types.jl`, I see abstract `Finite`, `Iterable`, and `FiniteIterable` types. These seem like interface-kind types and could perhaps be better served by boolean trait-functions (e.g. `Tables.istable`) or holy-style trait functions?
- I do still think that as a package named _Lean_API for Machine _Learning_ models, calling the objects that “learn” from data “learners” rather than “algorithms” is more apt (regardless of how well they generalise), but it seems like this mostly affects the docs now, and I don’t mean to re-commence the bikeshedding.

---

<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:** [October 4, 2024, 5:03am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/104 "2024-10-04T05:03:30Z")

</div>

The name for the function that maps learning outcomes (output of `fit`) to something suitable for serialisation. At time of writing, this is `minimise` in the [docs](https://juliaai.github.io/LearnAPI.jl/dev/minimize/) :

_Poll ([view on site](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/104))_

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [October 4, 2024, 1:17pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/105 "2024-10-04T13:17:47Z")

</div>

I voted for `trim`, but I might actually prefer `shrink`, which was one of the options @tecosaur mentioned.

---

<div class="post-metadata">

**Author:** ![rdavis120](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@rdavis120](https://discourse.julialang.org/u/rdavis120)\
**Post date:** [October 4, 2024, 2:01pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/106 "2024-10-04T14:01:58Z")

</div>

I think `strip()` was used in r models in the past.

---

<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:** [October 4, 2024, 10:10pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/107 "2024-10-04T22:10:53Z")

</div>

Thanks for the votes. Sorry, my bad about missing options. Let’s try again:

_Poll ([view on site](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/107))_

---

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [October 4, 2024, 10:17pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/108 "2024-10-04T22:17:50Z")

</div>

(I would always recommend polls like this to be multiple choice)

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [October 5, 2024, 7:51am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/109 "2024-10-05T07:51:16Z")

</div>

I would not use shrink in this setting as shrinkage is an established term for penalization in regression models.

---

<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:** [October 6, 2024, 12:35am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/110 "2024-10-06T00:35:57Z")

</div>

Okay, here’s one more. In LearnAPI I currently have [`inverse_transform`](https://juliaai.github.io/LearnAPI.jl/dev/predict_transform/#LearnAPI.inverse_transform), “broadly” understood. I’ve currently said this any [right inverse](https://en.wikipedia.org/wiki/Inverse_function#Right_inverses) or approximate right-inverse for `transform` (maybe any one-sided inverse should be allowed??). This is the same name used in scikit-learn and MLJ, and so it has a lot of intertia for me personally. No promises to change it, but I’d like to know what people think of the name.

I think StatsAPI uses `reconstruct` and TableTransforms uses `revert` (`transform` is `apply`). Any other name suggestions or comments before I poll this?

---

<div class="post-metadata">

**Author:** ![era127](https://avatars.discourse-cdn.com/v4/letter/e/eb8c5e/32.png) [@era127](https://discourse.julialang.org/u/era127)\
**Post date:** [October 6, 2024, 4:47am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/111 "2024-10-06T04:47:36Z")

</div>

I preferred the way it was done with `TransformedTargetModel` where it would be a regular algorithm with `fit()` and `predict()` and the parameters to that algorithm would include the inner regression algorithm along with the transformer function and inverse functions. In which case they are just names of algorithm parameters, and maybe not needed in the api.

Also on the `minimize()` proposed function, some of the suggested names suggest the trained model is mutated. If the model is an immutable struc, instead of `minimize()`, maybe it could just be another accessor function to get the struct for the _trained algorithm_, which represents the information required by `predict()`.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [October 7, 2024, 2:12am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/112 "2024-10-07T02:12:34Z")

</div>

> [@ablaom](#):
>
> Any other name suggestions or comments before I poll this?

`invert` ? (“broadly” understood)

---

<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:** [October 7, 2024, 11:38pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/113 "2024-10-07T23:38:22Z")

</div>

Preferred name for the method currently called `inverse_transform`:

_Poll ([view on site](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/113))_

---

<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:** [October 8, 2024, 12:49am UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/114 "2024-10-08T00:49:15Z")

</div>

The trait `LearnAPI.functions` returns a list of functions that can either be applied to the algorithm struct (e.g, `fit`), or the output of `fit` (e.g. `predict`). See [here](https://juliaai.github.io/LearnAPI.jl/dev/traits/#LearnAPI.functions). Should this be called `methods` instead?

_Poll ([view on site](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/114))_

---

<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:** [February 19, 2025, 9:08pm UTC](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048/115 "2025-02-19T21:08:19Z")

</div>

Please see [this announcement](https://discourse.julialang.org/t/learnapi-jl-1-0-general-api-for-ml-statistics/126089) for the first stable release of LearnAPI.jl

[Previous page](https://discourse.julialang.org/t/ann-learnapi-jl-proposal-for-a-basement-level-machine-learning-api/93048.md?page=5)
