# How to embed expert knowledge /constraints in ML training?

**URL:** <https://discourse.julialang.org/t/how-to-embed-expert-knowledge-constraints-in-ml-training/129025>\
**Category:** Machine Learning\
**Tags:** question\
**Created:** [May 15, 2025, 9:21am UTC](https://discourse.julialang.org/t/how-to-embed-expert-knowledge-constraints-in-ml-training/129025 "2025-05-15T09:21:58Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![slwu89](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/slwu89/32/217323_2.png) [@slwu89](https://discourse.julialang.org/u/slwu89)\
**Post date:** [May 15, 2025, 2:33pm UTC](https://discourse.julialang.org/t/how-to-embed-expert-knowledge-constraints-in-ml-training/129025/7 "2025-05-15T14:33:10Z")

</div>

I don’t know what kind of “ML” you are interested in but constrained splines might help you. Constrained P-Splines have nice properties and have been around for awhile (and can handle monotonic, etc constraints). You can check out this book on P-Splines which has a large amount of nicely written R code which is extremely simple to translate to Julia: [https://psplines.bitbucket.io/](https://psplines.bitbucket.io/)

Simon Wood (of mgcv fame) has a paper on embedding shape constrained splines in generalized additive models here: [Shape constrained additive models | Statistics and Computing](https://link.springer.com/article/10.1007/s11222-013-9448-7) with an accompanying R package.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-embed-expert-knowledge-constraints-in-ml-training/129025)._
