Skip to content

Commit

Permalink
add repl sim to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuabmoore committed Dec 31, 2024
1 parent 61a5347 commit 8133cc8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions docs/src/classification.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ The below code sets this up:
```@repl
using Random # fix rng seed
rng = Xoshiro(1)
# define trendy sine function
function trendy_sine(T::Integer, n_inst::Integer, noise_std::Real, rng)
X = Matrix{Float64}(undef, n_inst, T)
Expand All @@ -32,13 +31,11 @@ function trendy_sine(T::Integer, n_inst::Integer, noise_std::Real, rng)
@. series = sin(pi/10 *ts + phase) + 3 * ts / T + noise_std * randn(rng)
end
return X
end
end;
# specify dataset size
ntimepoints = 100
ntrain_instances = 300
ntest_instances = 200
ntimepoints = 100;
ntrain_instances = 300;
ntest_instances = 200;
# define data. Class one has sigma = 0.1, class 2 has sigma = 0.9
X_train = vcat(trendy_sine(ntimepoints, ntrain_instances ÷ 2, 0.1, rng), trendy_sine(ntimepoints, ntrain_instances ÷ 2, 0.9, rng));
y_train = vcat(fill(1, ntrain_instances ÷ 2), fill(2, ntrain_instances ÷ 2));
Expand Down

0 comments on commit 8133cc8

Please sign in to comment.