Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop models as deps and add compats #16

Merged
merged 9 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9'
- '1.10'
- '1'
os:
- ubuntu-latest
arch:
Expand Down
35 changes: 22 additions & 13 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,19 @@ version = "1.0.0-DEV"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
CategoricalDistributions = "af321ab8-2d2e-40a6-b165-3d674595d28e"
ComputationalResources = "ed09eef8-17a6-5b46-8889-db040fac31e3"
DecisionTree = "7806a523-6efd-50cb-b5f6-3fa6f1930dbb"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
EvoTrees = "f6006082-12f8-11e9-0c9c-0d5d367ab1e5"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
Lasso = "b4fcebef-c861-5a0f-a7e2-ba9dc32b180a"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Loess = "4345ca2d-374a-55d4-8d30-97f9976e7612"
MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
MLJDecisionTreeInterface = "c6f25543-311c-4c74-83dc-3ea6d1015661"
MLJGLMInterface = "caf8df21-4939-456d-ac9c-5fefbfb04c0c"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Rasters = "a3a2b9e3-a471-40c9-b274-f788e487c689"
ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161"
Shapley = "855ca7ad-a6ef-4de2-9ca8-726fe2a39065"
StatisticalMeasures = "a19d573c-0a75-4610-95b3-7071388c7541"
StatisticalMeasuresBase = "c062fc1d-0d66-479b-b6ac-8b44719de4cc"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Expand All @@ -40,20 +32,37 @@ Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
SpeciesDistributionModelsMakieExt = "Makie"

[compat]
CategoricalDistributions = "0.1.14"
CategoricalArrays = "0.10"
ComputationalResources = "0.3"
Distances = "0.10"
MLJGLMInterface = "0.3.7"
Rasters = "0.10.1, 0.11, 0.12"
Distributions = "0.25"
GLM = "1.9.0"
GeoInterface = "1"
Loess = "0.6"
MLJBase = "1.7.0"
Makie = "0.20, 0.21"
PrettyTables = "2"
Rasters = "0.12"
ScientificTypesBase = "3"
Shapley = "0.1"
StatisticalMeasures = "0.1.5"
StatsAPI = "1.7.0"
StatsBase = "0.34"
StatsModels = "0.7.3"
julia = "1.9"
Tables = "1"
Test = "1"
ThreadsX = "0.1.12"
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"]
15 changes: 5 additions & 10 deletions src/SpeciesDistributionModels.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
module SpeciesDistributionModels

import Tables, StatsBase, Statistics, StatsAPI, StatsModels, LinearAlgebra, Random, ThreadsX
import MLJBase, StatisticalMeasures, StatisticalMeasuresBase, ScientificTypesBase, CategoricalArrays
import GLM, PrettyTables, Rasters, EvoTrees, DecisionTree, Shapley, Loess, Distances
import MLJBase, StatisticalMeasures, CategoricalArrays
import GLM, PrettyTables, Rasters, Shapley, Loess, Distances
import GeoInterface as GI

using MLJBase: pdf
using Rasters: Raster, RasterStack, Band
using ScientificTypesBase: Continuous, OrderedFactor, Multiclass, Count
using Rasters: Raster, RasterStack, Band, DD
using ComputationalResources: CPU1, CPUThreads, AbstractCPU, CPUProcesses

using StatisticalMeasures: auc, kappa, sensitivity, selectivity, accuracy, StatisticalMeasuresBase
using ScientificTypesBase: Continuous, OrderedFactor, Multiclass, Count
using StatisticalMeasures: auc, kappa, sensitivity, selectivity, accuracy
import MLJBase: StratifiedCV, CV, Holdout, ResamplingStrategy, Machine, Probabilistic
import MLJBase: StratifiedCV, CV, Holdout, ResamplingStrategy, Machine, Probabilistic, pdf

export SDMensemble, predict, sdm, sdmdata, select, machines, machine_keys,
remove_collinear, thin,
Expand All @@ -25,14 +22,12 @@ export auc, kappa, sensitivity, selectivity, accuracy,
Continuous, OrderedFactor, Multiclass, Count,
StratifiedCV, CV, Holdout, ResamplingStrategy
#include("learningnetwork.jl")
include("models.jl")
include("data_utils.jl")
include("resample.jl")
# export stubs for extensions
export interactive_response_curves, interactive_evaluation

include("collinearity.jl")
include("models.jl")
include("ensemble.jl")
include("predict.jl")
include("explain/explain.jl")
Expand Down
10 changes: 0 additions & 10 deletions src/models.jl

This file was deleted.

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 = RandomForestClassifier(; rng),
rf2 = OneHotEncoder() |> RandomForestClassifier(; max_depth = 3, rng),
lm = LinearBinaryClassifier(),
brt = EvoTreeClassifier(; rng)
)

ensemble = sdm(data, models;
Expand Down
Loading