Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Feb 12, 2023
1 parent 08226a4 commit 4fb5dec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ cv_data, test_data = splitobs((Xs, Ys); at=0.85)

# Next we partition the data using a 10-fold scheme.
for (train_data, val_data) in kfolds(cv_data; k=10)
for epoch = 1:100

# We apply a lazy transform for data augmentation
train_data = mapobs(xy -> (xy[1] .+ 0.1 .* randn.(), xy[2]), train_data)

for epoch = 1:10
# Iterate over the data using mini-batches of 5 observations each
for (x, y) in eachobs(train_data, batchsize=5)
# ... train supervised model on minibatches here
Expand Down
10 changes: 5 additions & 5 deletions src/obstransform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ Indexing triggers the transformation `f`.
The batched keyword argument controls the behavior of `mdata[idx]` and `mdata[idxs]`
where `idx` is an integer and `idxs` is a vector of integers:
- `batched=:auto` (default). Let `f` handle the two cases.
Call `f(getobs(data, idx))` and `f(getobs(data, idxs))`.
- `batched=:never`. `f` is always called on a single observation.
Call `f(getobs(data, idx))` and `[f(getobs(data, idx)) for idx in idxs]`.
- `batched=:always`. `f` is always called on a batch of observations.
Call `getobs(f(getobs(data, [idx])), 1)` and `f(getobs(data, idxs))`.
Calls `f(getobs(data, idx))` and `f(getobs(data, idxs))`.
- `batched=:never`. The function `f` is always called on a single observation.
Calls `f(getobs(data, idx))` and `[f(getobs(data, idx)) for idx in idxs]`.
- `batched=:always`. The function `f` is always called on a batch of observations.
Calls `getobs(f(getobs(data, [idx])), 1)` and `f(getobs(data, idxs))`.
# Examples
Expand Down

0 comments on commit 4fb5dec

Please sign in to comment.