# Does Julia have a Stratified Sampling function?

**URL:** <https://discourse.julialang.org/t/does-julia-have-a-stratified-sampling-function/81293>\
**Category:** General Usage\
**Created:** [May 19, 2022, 2:52am UTC](https://discourse.julialang.org/t/does-julia-have-a-stratified-sampling-function/81293 "2022-05-19T02:52:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DWSchulze](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dwschulze/32/35968_2.png) [@DWSchulze](https://discourse.julialang.org/u/DWSchulze)\
**Post date:** [May 19, 2022, 2:52am UTC](https://discourse.julialang.org/t/does-julia-have-a-stratified-sampling-function/81293/1 "2022-05-19T02:52:42Z")

</div>

It looks like `StratifiedRandomSub` was added at some point, but I can’t find it:

[https://github.com/JuliaStats/MLBase.jl/issues/3](https://github.com/JuliaStats/MLBase.jl/issues/3)

---

<div class="post-metadata">

**Author:** ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)\
**Post date:** [May 19, 2022, 10:41am UTC](https://discourse.julialang.org/t/does-julia-have-a-stratified-sampling-function/81293/2 "2022-05-19T10:41:18Z")

</div>

There is a `StratifiedKfold` and `StratifiedRandomSub`: [Cross Validation — MLBase 0.4.0 documentation](https://mlbasejl.readthedocs.io/en/latest/crossval.html).

MLJ.jl also has stratified sampling: [MLJBase.jl/resampling.jl at dev · JuliaAI/MLJBase.jl · GitHub](https://github.com/JuliaAI/MLJBase.jl/blob/dev/src/resampling.jl)
