Skip to content

Commit

Permalink
add models to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tiemvanderdeure committed Nov 22, 2024
1 parent b028ade commit 2c61637
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ julia = "1.10"

[extras]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
EvoTrees = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
MLJDecisionTreeInterface = "c6f25543-311c-4c74-83dc-3ea6d1015661"
MLJGLMInterface = "caf8df21-4939-456d-ac9c-5fefbfb04c0c"
MLJModels = "d491faf4-2d78-11e9-2867-c94bc002c0b7"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Distributions", "Makie", "MLJModels", "StableRNGs", "Test"]
test = ["Distributions", "EvoTrees", "Makie", "MLJDecisionTreeInterface", "MLJGLMInterface", "MLJModels", "StableRNGs", "Test"]
12 changes: 8 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import SpeciesDistributionModels as SDM
using StableRNGs, Distributions, Test
using Makie

using MLJGLMInterface: LinearBinaryClassifier
using EvoTrees: EvoTreeClassifier
using MLJDecisionTreeInterface: RandomForestClassifier

rng = StableRNG(0)
#using Random; rng = Random.GLOBAL_RNG
# some mock data
Expand All @@ -22,10 +26,10 @@ presencedata = (a = rand(rng, n), b = rand(rng, n).^2, c = sqrt.(rand(rng, n)))

## ensemble
models = (
rf = SDM.random_forest(; rng),
rf2 = OneHotEncoder() |> SDM.random_forest(; max_depth = 3, rng),
lm = SDM.linear_model(),
brt = SDM.boosted_regression_tree(; rng)
rf = SDM.RandomForestClassifier(; rng),
rf2 = OneHotEncoder() |> SDM.RandomForestClassifier(; max_depth = 3, rng),
lm = SDM.LinearBinaryClassifier(),
brt = SDM.EvoTreeClassifier(; rng)
)

ensemble = sdm(data, models;
Expand Down

0 comments on commit 2c61637

Please sign in to comment.