Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
WGUNDERWOOD committed Oct 30, 2023
1 parent 282db7e commit ef2538c
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 63 deletions.
7 changes: 0 additions & 7 deletions docs/src/documentation.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Documentation

## Mondrian cells

```@autodocs
Modules = [MondrianForests]
Pages = ["cell.jl"]
```

## Mondrian trees

```@autodocs
Expand Down
2 changes: 1 addition & 1 deletion src/MondrianForests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export get_subtrees
export get_leaves
export get_common_refinement
#export get_cell_id
#export are_in_same_cell
export are_in_same_leaf
#export count_cells
#export restrict

Expand Down
20 changes: 14 additions & 6 deletions src/data.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
using Distributions

"""
generate_data(n::Int, X_dist::Distribution, eps_dist::Distribution,
mu::Function, sigma2::Function)
Generate sample data for Mondrian forest estimation.
Draws `n` independent samples from `Y = mu(X) + sigma(X) eps`,
with `X ~ X_dist` and `eps ~ eps_dist`
Draws `n` independent samples from \$Y = \\mu(X) + \\sigma(X) \\varepsilon\$,
with \$X \\sim\$ `X_dist` and \$\\varepsilon \\sim\$ `eps_dist`.
"""
function generate_data(n::Int, X_dist::Distribution, eps_dist::Distribution,
mu::Function, sigma2::Function)
Expand All @@ -17,10 +20,13 @@ function generate_data(n::Int, X_dist::Distribution, eps_dist::Distribution,
end

"""
generate_uniform_data_uniform_errors(d::Int, n::Int)
Generate uniform sample data with uniform errors for Mondrian forest estimation.
Draws `n` independent samples from `Y = eps`,
with `X ~ U[0, 1]` and `eps ~ U[-sqrt(3), sqrt(3)]`
Draws `n` independent samples from \$Y = \\varepsilon\$,
with \$X \\sim \\mathcal{U}[0, 1]\$ and
\$\\varepsilon \\sim \\mathcal{U}\\big[-\\sqrt 3, \\sqrt 3\\big]\$.
"""
function generate_uniform_data_uniform_errors(d::Int, n::Int)
X_dist = product_distribution([Uniform(0, 1) for _ in 1:d])
Expand All @@ -31,10 +37,12 @@ function generate_uniform_data_uniform_errors(d::Int, n::Int)
end

"""
generate_uniform_data_normal_errors(d::Int, n::Int)
Generate uniform sample data with normal errors for Mondrian forest estimation.
Draws `n` independent samples from `Y = eps`,
with `X ~ U[0, 1]` and `eps ~ N(0, 1)`
Draws `n` independent samples from \$Y = \\varepsilon\$,
with \$X \\sim \\mathcal{U}[0, 1]\$ and \$\\varepsilon \\sim \\mathcal{N}(0, 1)\$.
"""
function generate_uniform_data_normal_errors(d::Int, n::Int)
X_dist = product_distribution([Uniform(0, 1) for _ in 1:d])
Expand Down
Loading

0 comments on commit ef2538c

Please sign in to comment.