From a40dabc4b89e53e32de0ed34e88ab743b5505ae8 Mon Sep 17 00:00:00 2001 From: Marco Matthies <71844+marcom@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:24:06 +0200 Subject: [PATCH 1/5] Allow passing an rng seed to the optimisation procedure --- src/biomass_yield_process.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/biomass_yield_process.jl b/src/biomass_yield_process.jl index a916938..b846753 100644 --- a/src/biomass_yield_process.jl +++ b/src/biomass_yield_process.jl @@ -99,13 +99,13 @@ function _calibrate_biomass_yield_parameters(crop, crop_dict, crop_name, soil_ty # make optimization problem prob = OptimizationProblem(get_val, u0, pars, lb = lb, ub = ub) - # solve the optimization problem - if haskey(kw, :maxiters) - maxiters = kw[:maxiters] - else - maxiters = 100 - end - sol = solve(prob, BBO_adaptive_de_rand_1_bin_radiuslimited(), maxiters=maxiters) + # solve the optimization problem + maxiters = get(kw, :maxiters, 100) + rng_seed = get(kw, :rng_seed, nothing) + sol = solve(prob, BBO_adaptive_de_rand_1_bin_radiuslimited(); + maxiters=maxiters, + (isnothing(rng_seed) ? (; ) : (; RngSeed=rng_seed, RandomizeRngSeed=false))... + ) return sol.u, pars end From fa719e06e96af4ca138403daed9236f560a1452b Mon Sep 17 00:00:00 2001 From: Marco Matthies <71844+marcom@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:25:17 +0200 Subject: [PATCH 2/5] Add more details in case of insufficient phenology data --- src/phenology_process.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/phenology_process.jl b/src/phenology_process.jl index d91fce6..204ad23 100644 --- a/src/phenology_process.jl +++ b/src/phenology_process.jl @@ -254,6 +254,8 @@ function calibrate_phenology_parameters(raw_phenology_df, crop_name, hk_clim_df, pheno_df = process_crop_phenology(raw_phenology_df, sowing_phase, harvest_phase) if size(pheno_df,1) Date: Thu, 25 Sep 2025 07:42:50 +0200 Subject: [PATCH 3/5] Add MLJ-compatible implementation of Willmott index of agreement --- scripts/willmott.jl | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 scripts/willmott.jl diff --git a/scripts/willmott.jl b/scripts/willmott.jl new file mode 100644 index 0000000..e7de075 --- /dev/null +++ b/scripts/willmott.jl @@ -0,0 +1,59 @@ +# Submitted as a patch to StatisticalMeasures.jl: +# https://github.com/JuliaAI/StatisticalMeasures.jl/pull/53 + +# Use this file until the patch is merged. + +module Willmott + +using StatisticalMeasures: API, @trait, @fix_show, register, LearnAPI, + Infinite, Score, DOC_INFINITE, docstring, aggregate, multimeasure, + LPSumLoss, Sum + +# ------------------------------------------------------------------------- +# Willmott index of agreement (d) + +# type for measure without argument checks: +struct _WillmottD end + +function (::_WillmottD)(yhat, y) + μ = aggregate(y) # mean + # numerator: Σ_i (ŷ_i - y_i)^2 + num = LPSumLoss(p=2)(yhat, y) + # denominator: Σ_i (|ŷ_i - μ| + |y_i - μ|)^2 + den = multimeasure((yhat, y) -> (abs(yhat - μ) + abs(y - μ))^2; mode=Sum())(yhat, y) + return den == 0 ? (num == 0 ? 1.0 : 0.0) : 1 - num/den +end + +WillmottD() = _WillmottD() |> API.robust_measure |> API.fussy_measure +const WillmottDType = API.FussyMeasure{<:API.RobustMeasure{<:_WillmottD}} + +@trait( + _WillmottD, + consumes_multiple_observations = true, + kind_of_proxy = LearnAPI.Point(), + observation_scitype = Union{Missing,Infinite}, + orientation = Score(), + human_name = "Willmott index of agreement (d)", +) + +@fix_show WillmottD::WillmottDType + +register(WillmottD, "willmott_d") + +const WillmottDDoc = """ +Return Willmott index of agreement (d) + +``d = 1 - \\dfrac{\\sum (ŷ_i - y_i)^2}{\\sum (|ŷ_i - \\bar y| + |y_i - \\bar y|)^2}``, + +where ``\\bar y`` is the mean of the targets. The value lies in ``[0,1]`` with higher +being better. + +References: Willmott (1981) https://doi.org/10.1080/02723646.1981.10642213 +""" + +"$WillmottDDoc" +WillmottD +"$WillmottDDoc" +const willmott_d = WillmottD() + +end # module From 1092bf7c87d19d4b4b983240770d0fb8cb144347 Mon Sep 17 00:00:00 2001 From: Marco Matthies <71844+marcom@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:43:20 +0200 Subject: [PATCH 4/5] Add validation of crop param fitting using MLJ.jl --- Manifest.toml | 725 ++++++++++++++++++++++++++++------- Project.toml | 7 + scripts/validate-with-mlj.jl | 494 ++++++++++++++++++++++++ 3 files changed, 1089 insertions(+), 137 deletions(-) create mode 100644 scripts/validate-with-mlj.jl diff --git a/Manifest.toml b/Manifest.toml index a01bdf3..263e5ee 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,13 +1,13 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.11.5" +julia_version = "1.11.7" manifest_format = "2.0" -project_hash = "ceba23c13d207167f77765b4fccf6c4d23818543" +project_hash = "98362af300d44a349dc10c31368061bb87e73321" [[deps.ADTypes]] -git-tree-sha1 = "60665b326b75db6517939d0e1875850bc4a54368" +git-tree-sha1 = "27cecae79e5cc9935255f90c53bb831cc3c870d7" uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b" -version = "1.17.0" +version = "1.18.0" [deps.ADTypes.extensions] ADTypesChainRulesCoreExt = "ChainRulesCore" @@ -19,6 +19,12 @@ version = "1.17.0" ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" +[[deps.ARFFFiles]] +deps = ["CategoricalArrays", "Dates", "Parsers", "Tables"] +git-tree-sha1 = "678eb18590a8bc6674363da4d5faa4ac09c40a18" +uuid = "da404889-ca92-49ff-9e8b-0aa6b4d38dc8" +version = "1.5.0" + [[deps.AbstractFFTs]] deps = ["LinearAlgebra"] git-tree-sha1 = "d92ad398961a3ed262d8bf04a1a2b8340f915fef" @@ -61,9 +67,9 @@ version = "0.1.42" [[deps.Adapt]] deps = ["LinearAlgebra", "Requires"] -git-tree-sha1 = "f7817e2e585aa6d924fd714df1e2a84be7896c60" +git-tree-sha1 = "7e35fca2bdfba44d797c53dfe63a51fabf39bfc0" uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "4.3.0" +version = "4.4.0" weakdeps = ["SparseArrays", "StaticArrays"] [deps.Adapt.extensions] @@ -89,11 +95,14 @@ version = "0.4.2" [[deps.AquaCrop]] deps = ["CSV", "DataFrames", "Dates", "TOML", "Unitful"] -git-tree-sha1 = "402642fc914ea2044f074e8f73a22fd680468432" -repo-rev = "main" -repo-url = "https://github.com/gabo-di/AquaCrop.jl" +git-tree-sha1 = "d87cc67f3731740f43ebf5bef091cbde4937cc37" uuid = "8f16cebd-c0b4-44a3-857f-c101f083256c" -version = "0.1.0-DEV" +version = "1.0.0" + +[[deps.ArgCheck]] +git-tree-sha1 = "f9e9a66c9b7be1ad7372bbd9b062d9230c30c5ce" +uuid = "dce04be8-c92d-5529-be00-80e4d2c0e197" +version = "2.5.0" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" @@ -101,9 +110,9 @@ version = "1.1.2" [[deps.ArrayInterface]] deps = ["Adapt", "LinearAlgebra"] -git-tree-sha1 = "9606d7832795cbef89e06a550475be300364a8aa" +git-tree-sha1 = "dbd8c3bbbdbb5c2778f85f4422c39960eac65a42" uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.19.0" +version = "7.20.0" [deps.ArrayInterface.extensions] ArrayInterfaceBandedMatricesExt = "BandedMatrices" @@ -113,6 +122,7 @@ version = "7.19.0" ArrayInterfaceChainRulesCoreExt = "ChainRulesCore" ArrayInterfaceChainRulesExt = "ChainRules" ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore" + ArrayInterfaceMetalExt = "Metal" ArrayInterfaceReverseDiffExt = "ReverseDiff" ArrayInterfaceSparseArraysExt = "SparseArrays" ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore" @@ -126,6 +136,7 @@ version = "7.19.0" ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" + Metal = "dde4c033-4e86-420c-a63e-0dd931031962" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" @@ -135,6 +146,24 @@ version = "7.19.0" uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" version = "1.11.0" +[[deps.Atomix]] +deps = ["UnsafeAtomics"] +git-tree-sha1 = "29bb0eb6f578a587a49da16564705968667f5fa8" +uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458" +version = "1.1.2" + + [deps.Atomix.extensions] + AtomixCUDAExt = "CUDA" + AtomixMetalExt = "Metal" + AtomixOpenCLExt = "OpenCL" + AtomixoneAPIExt = "oneAPI" + + [deps.Atomix.weakdeps] + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + Metal = "dde4c033-4e86-420c-a63e-0dd931031962" + OpenCL = "08131aa3-fb12-5dee-8b74-c09406e224a2" + oneAPI = "8f75cd03-7ff8-4ecb-9b8f-daf728133b1b" + [[deps.Automa]] deps = ["PrecompileTools", "SIMD", "TranscodingStreams"] git-tree-sha1 = "a8f503e8e1a5f583fbef15a8440c8c7e32185df2" @@ -149,9 +178,31 @@ version = "1.1.0" [[deps.AxisArrays]] deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"] -git-tree-sha1 = "16351be62963a67ac4083f748fdb3cca58bfd52f" +git-tree-sha1 = "4126b08903b777c88edf1754288144a0492c05ad" uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9" -version = "0.4.7" +version = "0.4.8" + +[[deps.BangBang]] +deps = ["Accessors", "ConstructionBase", "InitialValues", "LinearAlgebra"] +git-tree-sha1 = "26f41e1df02c330c4fa1e98d4aa2168fdafc9b1f" +uuid = "198e06fe-97b7-11e9-32a5-e1d131e6ad66" +version = "0.4.4" + + [deps.BangBang.extensions] + BangBangChainRulesCoreExt = "ChainRulesCore" + BangBangDataFramesExt = "DataFrames" + BangBangStaticArraysExt = "StaticArrays" + BangBangStructArraysExt = "StructArrays" + BangBangTablesExt = "Tables" + BangBangTypedTablesExt = "TypedTables" + + [deps.BangBang.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" + StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" + StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" + Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" + TypedTables = "9d95f2ec-7b3d-5a63-8d20-e2491e220bb9" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -162,6 +213,17 @@ git-tree-sha1 = "bca794632b8a9bbe159d56bf9e31c422671b35e0" uuid = "18cc8868-cbac-4acf-b575-c8ff214dc66f" version = "1.3.2" +[[deps.Baselet]] +git-tree-sha1 = "aebf55e6d7795e02ca500a689d326ac979aaf89e" +uuid = "9718e550-a3fa-408a-8086-8db961cd8217" +version = "0.1.1" + +[[deps.BitBasis]] +deps = ["LinearAlgebra", "StaticArrays"] +git-tree-sha1 = "89dc08420d4f593ff30f02611d136b475a5eb43d" +uuid = "50ba71b6-fa0f-514d-ae9a-0916efc90dcf" +version = "0.9.10" + [[deps.BitFlags]] git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d" uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" @@ -223,9 +285,9 @@ version = "1.1.1" [[deps.CairoMakie]] deps = ["CRC32c", "Cairo", "Cairo_jll", "Colors", "FileIO", "FreeType", "GeometryBasics", "LinearAlgebra", "Makie", "PrecompileTools"] -git-tree-sha1 = "15d6504f47633ee9b63be11a0384925ba0c84f61" +git-tree-sha1 = "f8caabc5a1c1fb88bcbf9bc4078e5656a477afd0" uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" -version = "0.13.2" +version = "0.15.6" [[deps.Cairo_jll]] deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"] @@ -233,6 +295,36 @@ git-tree-sha1 = "fde3bf89aead2e723284a8ff9cdf5b551ed700e8" uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a" version = "1.18.5+0" +[[deps.CategoricalArrays]] +deps = ["DataAPI", "Future", "Missings", "Printf", "Requires", "Statistics", "Unicode"] +git-tree-sha1 = "1568b28f91293458345dabba6a5ea3f183250a61" +uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597" +version = "0.10.8" + + [deps.CategoricalArrays.extensions] + CategoricalArraysJSONExt = "JSON" + CategoricalArraysRecipesBaseExt = "RecipesBase" + CategoricalArraysSentinelArraysExt = "SentinelArrays" + CategoricalArraysStructTypesExt = "StructTypes" + + [deps.CategoricalArrays.weakdeps] + JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" + RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" + SentinelArrays = "91c51154-3ec4-41a3-a24f-3f23e20d615c" + StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" + +[[deps.CategoricalDistributions]] +deps = ["CategoricalArrays", "Distributions", "Missings", "OrderedCollections", "Random", "ScientificTypes"] +git-tree-sha1 = "926862f549a82d6c3a7145bc7f1adff2a91a39f0" +uuid = "af321ab8-2d2e-40a6-b165-3d674595d28e" +version = "0.1.15" + + [deps.CategoricalDistributions.extensions] + UnivariateFiniteDisplayExt = "UnicodePlots" + + [deps.CategoricalDistributions.weakdeps] + UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" + [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra"] git-tree-sha1 = "e4c6a16e77171a5f5e25e9646617ab1c276c5607" @@ -243,11 +335,28 @@ weakdeps = ["SparseArrays"] [deps.ChainRulesCore.extensions] ChainRulesCoreSparseArraysExt = "SparseArrays" +[[deps.ChunkCodecCore]] +git-tree-sha1 = "51f4c10ee01bda57371e977931de39ee0f0cdb3e" +uuid = "0b6fb165-00bc-4d37-ab8b-79f91016dbe1" +version = "1.0.0" + +[[deps.ChunkCodecLibZlib]] +deps = ["ChunkCodecCore", "Zlib_jll"] +git-tree-sha1 = "cee8104904c53d39eb94fd06cbe60cb5acde7177" +uuid = "4c0bbee4-addc-4d73-81a0-b6caacae83c8" +version = "1.0.0" + +[[deps.ChunkCodecLibZstd]] +deps = ["ChunkCodecCore", "Zstd_jll"] +git-tree-sha1 = "34d9873079e4cb3d0c62926a225136824677073f" +uuid = "55437552-ac27-4d47-9aa3-63184e8fd398" +version = "1.0.0" + [[deps.CodeTracking]] deps = ["InteractiveUtils", "UUIDs"] -git-tree-sha1 = "5ac098a7c8660e217ffac31dc2af0964a8c3182a" +git-tree-sha1 = "980f01d6d3283b3dbdfd7ed89405f96b7256ad57" uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" -version = "2.0.0" +version = "2.0.1" [[deps.CodecZlib]] deps = ["TranscodingStreams", "Zlib_jll"] @@ -263,21 +372,25 @@ version = "0.4.1" [[deps.ColorSchemes]] deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] -git-tree-sha1 = "a656525c8b46aa6a1c76891552ed5381bb32ae7b" +git-tree-sha1 = "b0fd3f56fa442f81e0a47815c92245acfaaa4e34" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.30.0" +version = "3.31.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] -git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d" +git-tree-sha1 = "67e11ee83a43eb71ddc950302c53bf33f0690dfe" uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" -version = "0.11.5" +version = "0.12.1" +weakdeps = ["StyledStrings"] + + [deps.ColorTypes.extensions] + StyledStringsExt = "StyledStrings" [[deps.ColorVectorSpace]] deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] -git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249" +git-tree-sha1 = "8b3b6f87ce8f65a2b4f857528fd8d70086cd72b1" uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" -version = "0.10.0" +version = "0.11.0" weakdeps = ["SpecialFunctions"] [deps.ColorVectorSpace.extensions] @@ -285,9 +398,14 @@ weakdeps = ["SpecialFunctions"] [[deps.Colors]] deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] -git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0" +git-tree-sha1 = "37ea44092930b1811e666c3bc38065d7d87fcc74" uuid = "5ae59095-9a9b-59fe-a467-6f913c188581" -version = "0.12.11" +version = "0.13.1" + +[[deps.Combinatorics]] +git-tree-sha1 = "8010b6bb3388abe68d95743dcbea77650bb2eddf" +uuid = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" +version = "1.0.3" [[deps.CommonSolve]] git-tree-sha1 = "0eee5eb66b1cf62cd6ad1b460238e60e4b09400c" @@ -323,6 +441,17 @@ weakdeps = ["InverseFunctions"] [deps.CompositionsBase.extensions] CompositionsBaseInverseFunctionsExt = "InverseFunctions" +[[deps.ComputationalResources]] +git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7" +uuid = "ed09eef8-17a6-5b46-8889-db040fac31e3" +version = "0.3.2" + +[[deps.ComputePipeline]] +deps = ["Observables", "Preferences"] +git-tree-sha1 = "cb1299fee09da21e65ec88c1ff3a259f8d0b5802" +uuid = "95dc2771-c249-4cd0-9c9f-1f3b4330693c" +version = "0.1.4" + [[deps.ConcurrentUtilities]] deps = ["Serialization", "Sockets"] git-tree-sha1 = "d9d26935a0bcffc87d2613ce14c527c99fc543fd" @@ -352,6 +481,12 @@ weakdeps = ["IntervalSets", "LinearAlgebra", "StaticArrays"] ConstructionBaseLinearAlgebraExt = "LinearAlgebra" ConstructionBaseStaticArraysExt = "StaticArrays" +[[deps.ContextVariablesX]] +deps = ["Compat", "Logging", "UUIDs"] +git-tree-sha1 = "25cc3803f1030ab855e383129dcd3dc294e322cc" +uuid = "6add18c4-b38d-439d-96f6-d6bc489c04c5" +version = "0.1.3" + [[deps.Contour]] git-tree-sha1 = "439e35b0b36e2e5881738abc8857bd92ad6ff9a8" uuid = "d38c429a-6771-53c6-b99e-75d170b6e991" @@ -369,15 +504,15 @@ version = "1.16.0" [[deps.DataFrames]] deps = ["Compat", "DataAPI", "DataStructures", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "fb61b4812c49343d7ef0b533ba982c46021938a6" +git-tree-sha1 = "c967271c27a95160e30432e011b58f42cd7501b5" uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "1.7.0" +version = "1.8.0" [[deps.DataStructures]] -deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "4e1fe97fdaed23e9dc21d4d664bea76b65fc50a0" +deps = ["OrderedCollections"] +git-tree-sha1 = "6c72198e6a101cccdd4c9731d3985e904ba26037" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.22" +version = "0.19.1" [[deps.DataValueInterfaces]] git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" @@ -395,6 +530,11 @@ git-tree-sha1 = "473e9afc9cf30814eb67ffa5f2db7df82c3ad9fd" uuid = "ee1fde0b-3d02-5ea6-8484-8dfef6360eab" version = "1.16.2+0" +[[deps.DefineSingletons]] +git-tree-sha1 = "0fba8b706d0178b4dc7fd44a96a92382c9065c2c" +uuid = "244e2a9f-e319-4986-a169-4d1fe445cd52" +version = "0.1.2" + [[deps.DelaunayTriangulation]] deps = ["AdaptivePredicates", "EnumX", "ExactPredicates", "Random"] git-tree-sha1 = "5620ff4ee0084a6ab7097a27ba0c19290200b037" @@ -457,6 +597,17 @@ version = "0.7.7" Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" +[[deps.Distances]] +deps = ["LinearAlgebra", "Statistics", "StatsAPI"] +git-tree-sha1 = "c7e3a542b999843086e2f29dac96a618c105be1d" +uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" +version = "0.10.12" +weakdeps = ["ChainRulesCore", "SparseArrays"] + + [deps.Distances.extensions] + DistancesChainRulesCoreExt = "ChainRulesCore" + DistancesSparseArraysExt = "SparseArrays" + [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" @@ -490,9 +641,9 @@ version = "1.6.0" [[deps.DrWatson]] deps = ["Dates", "FileIO", "JLD2", "LibGit2", "MacroTools", "Pkg", "Random", "Requires", "Scratch", "UnPack"] -git-tree-sha1 = "17c9db646d6cb3f68a90053bf46faf5312d13b36" +git-tree-sha1 = "5b6632df14cf24fc2cdb805aab24147001463336" uuid = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1" -version = "2.18.0" +version = "2.19.1" [[deps.EarCut_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -500,6 +651,12 @@ git-tree-sha1 = "e3290f2d49e661fbd94046d7e3726ffcb2d41053" uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" version = "2.2.4+0" +[[deps.EarlyStopping]] +deps = ["Dates", "Statistics"] +git-tree-sha1 = "98fdf08b707aaf69f524a6cd0a67858cefe0cfb6" +uuid = "792122b4-ca99-40de-a6bc-6742525f08b6" +version = "0.3.0" + [[deps.EnumX]] git-tree-sha1 = "bddad79635af6aec424f53ed8aad5d7555dc6f00" uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" @@ -513,9 +670,9 @@ version = "0.0.20230411+1" [[deps.ExactPredicates]] deps = ["IntervalArithmetic", "Random", "StaticArrays"] -git-tree-sha1 = "b3f2ff58735b5f024c392fde763f29b057e4b025" +git-tree-sha1 = "83231673ea4d3d6008ac74dc5079e77ab2209d8f" uuid = "429591f6-91af-11e9-00e2-59fbe8cec110" -version = "2.2.8" +version = "2.2.9" [[deps.ExceptionUnwrapping]] deps = ["Test"] @@ -557,10 +714,10 @@ uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5" version = "6.1.3+0" [[deps.FFTW]] -deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] -git-tree-sha1 = "797762812ed063b9b94f6cc7742bc8883bb5e69e" +deps = ["AbstractFFTs", "FFTW_jll", "Libdl", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] +git-tree-sha1 = "97f08406df914023af55ade2f843c39e99c5d969" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.9.0" +version = "1.10.0" [[deps.FFTW_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -568,11 +725,29 @@ git-tree-sha1 = "6d6219a004b8cf1e0b4dbe27a2860b8e04eba0be" uuid = "f5851436-0d7a-5f13-b9de-f02708fd171a" version = "3.3.11+0" +[[deps.FLoops]] +deps = ["BangBang", "Compat", "FLoopsBase", "InitialValues", "JuliaVariables", "MLStyle", "Serialization", "Setfield", "Transducers"] +git-tree-sha1 = "0a2e5873e9a5f54abb06418d57a8df689336a660" +uuid = "cc61a311-1640-44b5-9fba-1b764f453329" +version = "0.2.2" + +[[deps.FLoopsBase]] +deps = ["ContextVariablesX"] +git-tree-sha1 = "656f7a6859be8673bf1f35da5670246b923964f7" +uuid = "b9860ae5-e623-471e-878b-f6a53c775ea6" +version = "0.1.1" + [[deps.FastClosures]] git-tree-sha1 = "acebe244d53ee1b461970f8910c235b259e772ef" uuid = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a" version = "0.3.2" +[[deps.FeatureSelection]] +deps = ["MLJModelInterface", "ScientificTypesBase", "Tables"] +git-tree-sha1 = "4c51a6d75ffe689d4ddbf0ff136f9f80abef70ad" +uuid = "33837fe5-dbff-4c9e-8c2f-c5612fe2b8b6" +version = "0.2.3" + [[deps.FileIO]] deps = ["Pkg", "Requires", "UUIDs"] git-tree-sha1 = "b66970a70db13f45b7e57fbda1736e1cf72174ea" @@ -606,9 +781,9 @@ version = "1.11.0" [[deps.FillArrays]] deps = ["LinearAlgebra"] -git-tree-sha1 = "6a70198746448456524cb442b8af316927ff3e1a" +git-tree-sha1 = "173e4d8f14230a7523ae11b9a3fa9edb3e0efd78" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "1.13.0" +version = "1.14.0" weakdeps = ["PDMats", "SparseArrays", "Statistics"] [deps.FillArrays.extensions] @@ -715,6 +890,12 @@ git-tree-sha1 = "45288942190db7c5f760f59c04495064eedf9340" uuid = "b0724c58-0f36-5564-988d-3bb0596ebc4a" version = "0.22.4+0" +[[deps.Ghostscript_jll]] +deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Zlib_jll"] +git-tree-sha1 = "38044a04637976140074d0b0621c1edf0eb531fd" +uuid = "61579ee1-b43e-5ca0-a5da-69d92c66a64b" +version = "9.55.1+0" + [[deps.Giflib_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "6570366d757b50fabae9f4315ad74d2e40c0560a" @@ -723,9 +904,9 @@ version = "5.2.3+0" [[deps.Glib_jll]] deps = ["Artifacts", "GettextRuntime_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"] -git-tree-sha1 = "35fbd0cefb04a516104b8e183ce0df11b70a3f1a" +git-tree-sha1 = "50c11ffab2a3d50192a228c313f05b5b5dc5acb2" uuid = "7746bdde-850d-59dc-9ae8-88ece973131d" -version = "2.84.3+0" +version = "2.86.0+0" [[deps.Graphics]] deps = ["Colors", "LinearAlgebra", "NaNMath"] @@ -741,9 +922,9 @@ version = "1.3.15+0" [[deps.GridLayoutBase]] deps = ["GeometryBasics", "InteractiveUtils", "Observables"] -git-tree-sha1 = "dc6bed05c15523624909b3953686c5f5ffa10adc" +git-tree-sha1 = "93d5c27c8de51687a2c70ec0716e6e76f298416f" uuid = "3955a311-db13-416c-9275-1d80ed98e5e9" -version = "0.11.1" +version = "0.11.2" [[deps.Grisu]] git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2" @@ -774,10 +955,10 @@ uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" version = "0.3.28" [[deps.IJulia]] -deps = ["Base64", "Conda", "Dates", "InteractiveUtils", "JSON", "Logging", "Markdown", "MbedTLS", "Pkg", "Printf", "REPL", "Random", "SoftGlobalScope", "UUIDs", "ZMQ"] -git-tree-sha1 = "be30be76e25b0aff2c9a85930ed3ac34c5f10c83" +deps = ["Base64", "Conda", "Dates", "InteractiveUtils", "JSON", "Logging", "Markdown", "Pkg", "PrecompileTools", "Printf", "REPL", "Random", "SHA", "Sockets", "UUIDs", "ZMQ"] +git-tree-sha1 = "87567b508ccc2ad54ee16a58c60d1c9b3eb422d0" uuid = "7073ff75-c697-5162-941a-fcdaad2a7d2a" -version = "1.27.0" +version = "1.30.4" [[deps.ImageAxes]] deps = ["AxisArrays", "ImageBase", "ImageCore", "Reexport", "SimpleTraits"] @@ -831,10 +1012,15 @@ git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d" uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" version = "0.1.5" +[[deps.InitialValues]] +git-tree-sha1 = "4da0f88e9a39111c2fa3add390ab15f3a44f3ca3" +uuid = "22cec73e-a1b8-11e9-2c92-598750a2cf9c" +version = "0.3.1" + [[deps.InlineStrings]] -git-tree-sha1 = "8594fac023c5ce1ef78260f24d1ad18b4327b420" +git-tree-sha1 = "8f3d257792a522b4601c24a577954b0a8cd7334d" uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" -version = "1.4.4" +version = "1.4.5" [deps.InlineStrings.extensions] ArrowTypesExt = "ArrowTypes" @@ -856,20 +1042,24 @@ uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" version = "1.11.0" [[deps.Interpolations]] -deps = ["Adapt", "AxisAlgorithms", "ChainRulesCore", "LinearAlgebra", "OffsetArrays", "Random", "Ratios", "Requires", "SharedArrays", "SparseArrays", "StaticArrays", "WoodburyMatrices"] -git-tree-sha1 = "88a101217d7cb38a7b481ccd50d21876e1d1b0e0" +deps = ["Adapt", "AxisAlgorithms", "ChainRulesCore", "LinearAlgebra", "OffsetArrays", "Random", "Ratios", "SharedArrays", "SparseArrays", "StaticArrays", "WoodburyMatrices"] +git-tree-sha1 = "65d505fa4c0d7072990d659ef3fc086eb6da8208" uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" -version = "0.15.1" -weakdeps = ["Unitful"] +version = "0.16.2" [deps.Interpolations.extensions] + InterpolationsForwardDiffExt = "ForwardDiff" InterpolationsUnitfulExt = "Unitful" + [deps.Interpolations.weakdeps] + ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" + Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" + [[deps.IntervalArithmetic]] -deps = ["CRlibm", "MacroTools", "OpenBLASConsistentFPCSR_jll", "Random", "RoundingEmulator"] -git-tree-sha1 = "79342df41c3c24664e5bf29395cfdf2f2a599412" +deps = ["CRlibm", "MacroTools", "OpenBLASConsistentFPCSR_jll", "Printf", "Random", "RoundingEmulator"] +git-tree-sha1 = "815e74f416953c348c9da1d1bc977bbc97c84e18" uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" -version = "0.22.36" +version = "1.0.0" [deps.IntervalArithmetic.extensions] IntervalArithmeticArblibExt = "Arblib" @@ -931,16 +1121,22 @@ git-tree-sha1 = "42d5f897009e7ff2cf88db414a389e5ed1bdd023" uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" version = "1.10.0" +[[deps.IterationControl]] +deps = ["EarlyStopping", "InteractiveUtils"] +git-tree-sha1 = "e663925ebc3d93c1150a7570d114f9ea2f664726" +uuid = "b3c1a2ee-3fec-4384-bf48-272ea71de57c" +version = "0.5.4" + [[deps.IteratorInterfaceExtensions]] git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856" uuid = "82899510-4779-5014-852e-03e436cf321d" version = "1.0.0" [[deps.JLD2]] -deps = ["FileIO", "MacroTools", "Mmap", "OrderedCollections", "PrecompileTools", "ScopedValues", "TranscodingStreams"] -git-tree-sha1 = "d97791feefda45729613fafeccc4fbef3f539151" +deps = ["ChunkCodecLibZlib", "ChunkCodecLibZstd", "FileIO", "MacroTools", "Mmap", "OrderedCollections", "PrecompileTools", "ScopedValues"] +git-tree-sha1 = "da2e9b4d1abbebdcca0aa68afa0aa272102baad7" uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819" -version = "0.5.15" +version = "0.6.2" weakdeps = ["UnPack"] [deps.JLD2.extensions] @@ -978,9 +1174,9 @@ version = "0.1.6" [[deps.JpegTurbo_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "e95866623950267c1e4878846f848d94810de475" +git-tree-sha1 = "4255f0032eafd6451d707a51d5f0248b8a165e4d" uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" -version = "3.1.2+0" +version = "3.1.3+0" [[deps.JuliaInterpreter]] deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] @@ -993,6 +1189,28 @@ git-tree-sha1 = "0d4b3dab95018bcf3925204475693d9f09dc45b8" uuid = "70703baa-626e-46a2-a12c-08ffd08c73b4" version = "1.0.2" +[[deps.JuliaVariables]] +deps = ["MLStyle", "NameResolution"] +git-tree-sha1 = "49fb3cb53362ddadb4415e9b73926d6b40709e70" +uuid = "b14d175d-62b4-44ba-8fb7-3064adc8c3ec" +version = "0.2.4" + +[[deps.KernelAbstractions]] +deps = ["Adapt", "Atomix", "InteractiveUtils", "MacroTools", "PrecompileTools", "Requires", "StaticArrays", "UUIDs"] +git-tree-sha1 = "83c617e9e9b02306a7acab79e05ec10253db7c87" +uuid = "63c18a36-062a-441e-b654-da1e3ab1ce7c" +version = "0.9.38" + + [deps.KernelAbstractions.extensions] + EnzymeExt = "EnzymeCore" + LinearAlgebraExt = "LinearAlgebra" + SparseArraysExt = "SparseArrays" + + [deps.KernelAbstractions.weakdeps] + EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" + LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" + SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" + [[deps.KernelDensity]] deps = ["Distributions", "DocStringExtensions", "FFTW", "Interpolations", "StatsBase"] git-tree-sha1 = "ba51324b894edaf1df3ab16e2cc6bc3280a2f1a7" @@ -1041,10 +1259,10 @@ uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" version = "1.4.0" [[deps.Latexify]] -deps = ["Format", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Requires"] -git-tree-sha1 = "52e1296ebbde0db845b356abbbe67fb82a0a116c" +deps = ["Format", "Ghostscript_jll", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "OrderedCollections", "Requires"] +git-tree-sha1 = "44f93c47f9cd6c7e431f2f2091fcba8f01cd7e8f" uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" -version = "0.16.9" +version = "0.16.10" [deps.Latexify.extensions] DataFramesExt = "DataFrames" @@ -1058,6 +1276,12 @@ version = "0.16.9" SymEngine = "123dc426-2d89-5057-bbad-38513e3affd8" tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5" +[[deps.LatinHypercubeSampling]] +deps = ["Random", "StableRNGs", "StatsBase", "Test"] +git-tree-sha1 = "825289d43c753c7f1bf9bed334c253e9913997f8" +uuid = "a5e1c1ea-c99a-51d3-a14d-a9a37257b02d" +version = "1.9.0" + [[deps.LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" @@ -1068,6 +1292,11 @@ git-tree-sha1 = "a560dd966b386ac9ae60bdd3a3d3a326062d3c3e" uuid = "8cdb02fc-e678-4876-92c5-9defec4f444e" version = "0.3.1" +[[deps.LearnAPI]] +git-tree-sha1 = "c276ed13346953f3035a6d35519ec816b820cd44" +uuid = "92ad9a40-7767-427a-9ee6-6e577f1266cb" +version = "1.0.1" + [[deps.LeftChildRightSiblingTrees]] deps = ["AbstractTrees"] git-tree-sha1 = "95ba48564903b43b2462318aa243ee79d81135ff" @@ -1129,9 +1358,9 @@ version = "2.41.1+0" [[deps.Libtiff_jll]] deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"] -git-tree-sha1 = "4ab7581296671007fc33f07a721631b8855f4b1d" +git-tree-sha1 = "f04133fe05eff1667d2054c53d59f9122383fe05" uuid = "89763e89-9b03-5906-acba-b20f662cd828" -version = "4.7.1+0" +version = "4.7.2+0" [[deps.Libuuid_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -1182,22 +1411,103 @@ git-tree-sha1 = "282cadc186e7b2ae0eeadbd7a4dffed4196ae2aa" uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" version = "2025.2.0+0" +[[deps.MLCore]] +deps = ["DataAPI", "SimpleTraits", "Tables"] +git-tree-sha1 = "73907695f35bc7ffd9f11f6c4f2ee8c1302084be" +uuid = "c2834f40-e789-41da-a90e-33b280584a8c" +version = "1.0.0" + +[[deps.MLFlowClient]] +deps = ["Dates", "FilePathsBase", "HTTP", "JSON", "ShowCases", "URIs", "UUIDs"] +git-tree-sha1 = "9abb12b62debc27261c008daa13627255bf79967" +uuid = "64a0f543-368b-4a9a-827a-e71edb2a0b83" +version = "0.5.1" + +[[deps.MLJ]] +deps = ["CategoricalArrays", "ComputationalResources", "Distributed", "Distributions", "FeatureSelection", "LinearAlgebra", "MLJBalancing", "MLJBase", "MLJEnsembles", "MLJFlow", "MLJIteration", "MLJModels", "MLJTransforms", "MLJTuning", "OpenML", "Pkg", "ProgressMeter", "Random", "Reexport", "ScientificTypes", "StatisticalMeasures", "Statistics", "StatsBase", "Tables"] +git-tree-sha1 = "5a1cbf82ae37e79672c8a4f202c6ee62dc1759cf" +uuid = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7" +version = "0.21.0" + +[[deps.MLJBalancing]] +deps = ["MLJBase", "MLJModelInterface", "MLUtils", "OrderedCollections", "Random", "StatsBase"] +git-tree-sha1 = "f707a01a92d664479522313907c07afa5d81df19" +uuid = "45f359ea-796d-4f51-95a5-deb1a414c586" +version = "0.1.5" + +[[deps.MLJBase]] +deps = ["CategoricalArrays", "CategoricalDistributions", "ComputationalResources", "Dates", "DelimitedFiles", "Distributed", "Distributions", "InteractiveUtils", "InvertedIndices", "LearnAPI", "LinearAlgebra", "MLJModelInterface", "Missings", "OrderedCollections", "Parameters", "PrettyTables", "ProgressMeter", "Random", "RecipesBase", "Reexport", "ScientificTypes", "Serialization", "StatisticalMeasuresBase", "StatisticalTraits", "Statistics", "StatsBase", "Tables"] +git-tree-sha1 = "d66846b1cd6a71c95e25e8d3800c24ebb268adbd" +uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d" +version = "1.9.0" +weakdeps = ["StatisticalMeasures"] + + [deps.MLJBase.extensions] + DefaultMeasuresExt = "StatisticalMeasures" + +[[deps.MLJEnsembles]] +deps = ["CategoricalArrays", "CategoricalDistributions", "ComputationalResources", "Distributed", "Distributions", "MLJModelInterface", "ProgressMeter", "Random", "ScientificTypesBase", "StatisticalMeasuresBase", "StatsBase"] +git-tree-sha1 = "84a5be55a364bb6b6dc7780bbd64317ebdd3ad1e" +uuid = "50ed68f4-41fd-4504-931a-ed422449fee0" +version = "0.4.3" + +[[deps.MLJFlow]] +deps = ["MLFlowClient", "MLJBase", "MLJModelInterface"] +git-tree-sha1 = "508bff8071d7d1902d6f1b9d1e868d58821f1cfe" +uuid = "7b7b8358-b45c-48ea-a8ef-7ca328ad328f" +version = "0.5.0" + +[[deps.MLJIteration]] +deps = ["IterationControl", "MLJBase", "Random", "Serialization"] +git-tree-sha1 = "ad16cfd261e28204847f509d1221a581286448ae" +uuid = "614be32b-d00c-4edb-bd02-1eb411ab5e55" +version = "0.6.3" + +[[deps.MLJModelInterface]] +deps = ["InteractiveUtils", "REPL", "Random", "ScientificTypesBase", "StatisticalTraits"] +git-tree-sha1 = "ccaa3f7938890ee8042cc970ba275115428bd592" +uuid = "e80e1ace-859a-464e-9ed9-23947d8ae3ea" +version = "1.12.0" + +[[deps.MLJModels]] +deps = ["CategoricalArrays", "CategoricalDistributions", "Combinatorics", "Dates", "Distances", "Distributions", "InteractiveUtils", "LinearAlgebra", "MLJModelInterface", "Markdown", "OrderedCollections", "Parameters", "Pkg", "PrettyPrinting", "REPL", "Random", "RelocatableFolders", "ScientificTypes", "StatisticalTraits", "Statistics", "StatsBase", "Tables"] +git-tree-sha1 = "54ce26e49017c25305b8da5aed40c4d95cb2ea75" +uuid = "d491faf4-2d78-11e9-2867-c94bc002c0b7" +version = "0.18.1" + +[[deps.MLJTransforms]] +deps = ["BitBasis", "CategoricalArrays", "Combinatorics", "Dates", "Distributions", "LinearAlgebra", "MLJModelInterface", "OrderedCollections", "Parameters", "ScientificTypes", "ScientificTypesBase", "Statistics", "StatsBase", "TableOperations", "Tables"] +git-tree-sha1 = "21057b3298c318cd5ccbe5bf903837e04e3d879c" +uuid = "23777cdb-d90c-4eb0-a694-7c2b83d5c1d6" +version = "0.1.2" + +[[deps.MLJTuning]] +deps = ["ComputationalResources", "Distributed", "Distributions", "LatinHypercubeSampling", "MLJBase", "ProgressMeter", "Random", "RecipesBase", "StatisticalMeasuresBase"] +git-tree-sha1 = "38aab60b1274ce7d6da784808e3be69e585dbbf6" +uuid = "03970b2e-30c4-11ea-3135-d1576263f10f" +version = "0.8.8" + +[[deps.MLStyle]] +git-tree-sha1 = "bc38dff0548128765760c79eb7388a4b37fae2c8" +uuid = "d8e11817-5142-5d16-987a-aa16d5891078" +version = "0.4.17" + +[[deps.MLUtils]] +deps = ["ChainRulesCore", "Compat", "DataAPI", "DelimitedFiles", "FLoops", "MLCore", "NNlib", "Random", "ShowCases", "SimpleTraits", "Statistics", "StatsBase", "Tables", "Transducers"] +git-tree-sha1 = "a772d8d1987433538a5c226f79393324b55f7846" +uuid = "f1d291b0-491e-4a28-83b9-f70985020b54" +version = "0.4.8" + [[deps.MacroTools]] git-tree-sha1 = "1e0228a030642014fe5cfe68c2c0a818f9e3f522" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" version = "0.5.16" [[deps.Makie]] -deps = ["Animations", "Base64", "CRC32c", "ColorBrewer", "ColorSchemes", "ColorTypes", "Colors", "Contour", "Dates", "DelaunayTriangulation", "Distributions", "DocStringExtensions", "Downloads", "FFMPEG_jll", "FileIO", "FilePaths", "FixedPointNumbers", "Format", "FreeType", "FreeTypeAbstraction", "GeometryBasics", "GridLayoutBase", "ImageBase", "ImageIO", "InteractiveUtils", "Interpolations", "IntervalSets", "InverseFunctions", "Isoband", "KernelDensity", "LaTeXStrings", "LinearAlgebra", "MacroTools", "MakieCore", "Markdown", "MathTeXEngine", "Observables", "OffsetArrays", "PNGFiles", "Packing", "PlotUtils", "PolygonOps", "PrecompileTools", "Printf", "REPL", "Random", "RelocatableFolders", "Scratch", "ShaderAbstractions", "Showoff", "SignedDistanceFields", "SparseArrays", "Statistics", "StatsBase", "StatsFuns", "StructArrays", "TriplotBase", "UnicodeFun", "Unitful"] -git-tree-sha1 = "e64b545d25e05a609521bfc36724baa072bfd31a" +deps = ["Animations", "Base64", "CRC32c", "ColorBrewer", "ColorSchemes", "ColorTypes", "Colors", "ComputePipeline", "Contour", "Dates", "DelaunayTriangulation", "Distributions", "DocStringExtensions", "Downloads", "FFMPEG_jll", "FileIO", "FilePaths", "FixedPointNumbers", "Format", "FreeType", "FreeTypeAbstraction", "GeometryBasics", "GridLayoutBase", "ImageBase", "ImageIO", "InteractiveUtils", "Interpolations", "IntervalSets", "InverseFunctions", "Isoband", "KernelDensity", "LaTeXStrings", "LinearAlgebra", "MacroTools", "Markdown", "MathTeXEngine", "Observables", "OffsetArrays", "PNGFiles", "Packing", "Pkg", "PlotUtils", "PolygonOps", "PrecompileTools", "Printf", "REPL", "Random", "RelocatableFolders", "Scratch", "ShaderAbstractions", "Showoff", "SignedDistanceFields", "SparseArrays", "Statistics", "StatsBase", "StatsFuns", "StructArrays", "TriplotBase", "UnicodeFun", "Unitful"] +git-tree-sha1 = "368542cde25d381e44d84c3c4209764f05f4ef19" uuid = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" -version = "0.22.2" - -[[deps.MakieCore]] -deps = ["ColorTypes", "GeometryBasics", "IntervalSets", "Observables"] -git-tree-sha1 = "605d6e8f2b7eba7f5bc6a16d297475075d5ea775" -uuid = "20f20a25-4f0e-4fdf-b5d1-57303727442b" -version = "0.9.1" +version = "0.24.6" [[deps.MappedArrays]] git-tree-sha1 = "2dab0221fe2b0f2cb6754eaa743cc266339f527e" @@ -1231,6 +1541,12 @@ git-tree-sha1 = "c13304c81eec1ed3af7fc20e75fb6b26092a1102" uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e" version = "0.3.2" +[[deps.MicroCollections]] +deps = ["Accessors", "BangBang", "InitialValues"] +git-tree-sha1 = "44d32db644e84c75dab479f1bc15ee76a1a3618f" +uuid = "128add7d-3638-4c79-886c-908ea0c25c34" +version = "0.2.0" + [[deps.Missings]] deps = ["DataAPI"] git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d" @@ -1257,12 +1573,42 @@ version = "0.3.7" uuid = "14a3606d-f60d-562e-9121-12d972cd8159" version = "2023.12.12" +[[deps.NNlib]] +deps = ["Adapt", "Atomix", "ChainRulesCore", "GPUArraysCore", "KernelAbstractions", "LinearAlgebra", "Random", "ScopedValues", "Statistics"] +git-tree-sha1 = "eb6eb10b675236cee09a81da369f94f16d77dc2f" +uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" +version = "0.9.31" + + [deps.NNlib.extensions] + NNlibAMDGPUExt = "AMDGPU" + NNlibCUDACUDNNExt = ["CUDA", "cuDNN"] + NNlibCUDAExt = "CUDA" + NNlibEnzymeCoreExt = "EnzymeCore" + NNlibFFTWExt = "FFTW" + NNlibForwardDiffExt = "ForwardDiff" + NNlibSpecialFunctionsExt = "SpecialFunctions" + + [deps.NNlib.weakdeps] + AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" + FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" + ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" + SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" + cuDNN = "02a925ec-e4fe-4b08-9a7e-0d78e3d38ccd" + [[deps.NaNMath]] deps = ["OpenLibm_jll"] git-tree-sha1 = "9b8215b1ee9e78a293f99797cd31375471b2bcae" uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" version = "1.1.3" +[[deps.NameResolution]] +deps = ["PrettyPrint"] +git-tree-sha1 = "1a0fa0e9613f46c9b8c11eee38ebb4f590013c5e" +uuid = "71a1bf82-56d0-4bbc-8a3c-48b961074391" +version = "0.1.5" + [[deps.Netpbm]] deps = ["FileIO", "ImageCore", "ImageMetadata"] git-tree-sha1 = "d92b107dbb887293622df7697a2223f9f8176fcd" @@ -1327,6 +1673,12 @@ deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" version = "0.8.5+0" +[[deps.OpenML]] +deps = ["ARFFFiles", "HTTP", "JSON", "Markdown", "Pkg", "Scratch"] +git-tree-sha1 = "63603b2b367107e87dbceda4e33c67aed17e50e0" +uuid = "8b6db2d4-7670-4922-a472-f9537c81ab66" +version = "0.3.2" + [[deps.OpenSSL]] deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] git-tree-sha1 = "f1a7e086c677df53e064e0fdd2c9d0b0833e3f6e" @@ -1346,22 +1698,22 @@ uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" version = "0.5.6+0" [[deps.Optimization]] -deps = ["ADTypes", "ArrayInterface", "ConsoleProgressMonitor", "DocStringExtensions", "LBFGSB", "LinearAlgebra", "Logging", "LoggingExtras", "OptimizationBase", "Printf", "ProgressLogging", "Reexport", "SciMLBase", "SparseArrays", "TerminalLoggers"] -git-tree-sha1 = "e72af10f1c6ffe2f295455c4c35534d713be62bb" +deps = ["ADTypes", "ArrayInterface", "ConsoleProgressMonitor", "DocStringExtensions", "LBFGSB", "LinearAlgebra", "Logging", "LoggingExtras", "OptimizationBase", "Printf", "ProgressLogging", "Random", "Reexport", "SciMLBase", "SparseArrays", "TerminalLoggers"] +git-tree-sha1 = "1e02b79bf6175d723a40745f622e9513253bab55" uuid = "7f7a1694-90dd-40f0-9382-eb1efda571ba" -version = "4.1.2" +version = "4.7.0" [[deps.OptimizationBBO]] deps = ["BlackBoxOptim", "Optimization", "Reexport"] -git-tree-sha1 = "62d34beecb9af84159045cfe2b09691b0fb66598" +git-tree-sha1 = "4bf2807645a2ad0964e058f9ff971471136f09cd" uuid = "3e6eede4-6085-4f62-9a71-46d9bc1eb92b" -version = "0.4.0" +version = "0.4.1" [[deps.OptimizationBase]] -deps = ["ADTypes", "ArrayInterface", "DifferentiationInterface", "DocStringExtensions", "FastClosures", "LinearAlgebra", "PDMats", "Reexport", "Requires", "SciMLBase", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"] -git-tree-sha1 = "474b2fa6de9288d34b8ad42c9c500088132621a7" +deps = ["ADTypes", "ArrayInterface", "DifferentiationInterface", "DocStringExtensions", "FastClosures", "LinearAlgebra", "PDMats", "Reexport", "SciMLBase", "SparseArrays", "SparseConnectivityTracer", "SparseMatrixColorings"] +git-tree-sha1 = "4f6098addb09203f35de1b21d5e668315544ff26" uuid = "bca83a33-5cc9-4baa-983d-23429ab6bcbb" -version = "2.10.0" +version = "2.11.0" [deps.OptimizationBase.extensions] OptimizationEnzymeExt = "Enzyme" @@ -1427,9 +1779,15 @@ version = "0.5.12" [[deps.Pango_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "FriBidi_jll", "Glib_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl"] -git-tree-sha1 = "275a9a6d85dc86c24d03d1837a0010226a96f540" +git-tree-sha1 = "1f7f9bbd5f7a2e5a9f7d96e51c9754454ea7f60b" uuid = "36c8627f-9965-5494-a995-c6b170f724f3" -version = "1.56.3+0" +version = "1.56.4+0" + +[[deps.Parameters]] +deps = ["OrderedCollections", "UnPack"] +git-tree-sha1 = "34c0e9ad262e5f7fc75b10a9952ca7692cfc5fbe" +uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a" +version = "0.12.3" [[deps.Parsers]] deps = ["Dates", "PrecompileTools", "UUIDs"] @@ -1471,10 +1829,10 @@ uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" version = "1.4.3" [[deps.Plots]] -deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "TOML", "UUIDs", "UnicodeFun", "UnitfulLatexify", "Unzip"] -git-tree-sha1 = "0c5a5b7e440c008fe31416a3ac9e0d2057c81106" +deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JLFzf", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "PrecompileTools", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "TOML", "UUIDs", "UnicodeFun", "Unzip"] +git-tree-sha1 = "12ce661880f8e309569074a61d3767e5756a199f" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" -version = "1.40.19" +version = "1.41.1" [deps.Plots.extensions] FileIOExt = "FileIO" @@ -1503,9 +1861,9 @@ version = "1.4.3" [[deps.PreallocationTools]] deps = ["Adapt", "ArrayInterface", "PrecompileTools"] -git-tree-sha1 = "9b4ee15d1fc68654031964a7af0c914c898e35a7" +git-tree-sha1 = "c05b4c6325262152483a1ecb6c69846d2e01727b" uuid = "d236fae5-4411-538c-8e31-a6e3d9e00b46" -version = "0.4.33" +version = "0.4.34" [deps.PreallocationTools.extensions] PreallocationToolsForwardDiffExt = "ForwardDiff" @@ -1529,6 +1887,16 @@ git-tree-sha1 = "0f27480397253da18fe2c12a4ba4eb9eb208bf3d" uuid = "21216c6a-2e73-6563-6e65-726566657250" version = "1.5.0" +[[deps.PrettyPrint]] +git-tree-sha1 = "632eb4abab3449ab30c5e1afaa874f0b98b586e4" +uuid = "8162dcfd-2161-5ef2-ae6c-7681170c5f98" +version = "0.2.0" + +[[deps.PrettyPrinting]] +git-tree-sha1 = "142ee93724a9c5d04d78df7006670a93ed1b244e" +uuid = "54e16d92-306c-5ea0-a30b-337be88ac337" +version = "0.4.2" + [[deps.PrettyTables]] deps = ["Crayons", "LaTeXStrings", "Markdown", "PrecompileTools", "Printf", "Reexport", "StringManipulation", "Tables"] git-tree-sha1 = "1101cd475833706e4d0e7b122218257178f48f34" @@ -1730,16 +2098,18 @@ version = "3.7.1" [[deps.SciMLBase]] deps = ["ADTypes", "Accessors", "Adapt", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Moshi", "PreallocationTools", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface"] -git-tree-sha1 = "a06d451a6d0fa6e6da34d047d61af8beb187b0f1" +git-tree-sha1 = "16fa030fb4bd4df373a677eca0460c3eee791ab2" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.112.0" +version = "2.120.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" SciMLBaseDistributionsExt = "Distributions" + SciMLBaseEnzymeExt = "Enzyme" SciMLBaseForwardDiffExt = "ForwardDiff" SciMLBaseMLStyleExt = "MLStyle" SciMLBaseMakieExt = "Makie" + SciMLBaseMeasurementsExt = "Measurements" SciMLBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements" SciMLBaseMooncakeExt = "Mooncake" SciMLBasePartialFunctionsExt = "PartialFunctions" @@ -1754,6 +2124,7 @@ version = "2.112.0" ChainRules = "082447d4-558c-5d27-93f4-14fc19e9eca2" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" + Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078" Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" @@ -1770,9 +2141,9 @@ version = "2.112.0" [[deps.SciMLOperators]] deps = ["Accessors", "ArrayInterface", "DocStringExtensions", "LinearAlgebra", "MacroTools"] -git-tree-sha1 = "78ac1b947205b07973321f67f17df8fbe6154ac9" +git-tree-sha1 = "024d829102878141aaee5cf8f8288bcabd2f57a0" uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" -version = "1.6.0" +version = "1.7.2" weakdeps = ["SparseArrays", "StaticArraysCore"] [deps.SciMLOperators.extensions] @@ -1785,11 +2156,22 @@ git-tree-sha1 = "566c4ed301ccb2a44cbd5a27da5f885e0ed1d5df" uuid = "53ae85a6-f571-4167-b2af-e1d143709226" version = "1.7.0" +[[deps.ScientificTypes]] +deps = ["CategoricalArrays", "ColorTypes", "Dates", "Distributions", "PrettyTables", "Reexport", "ScientificTypesBase", "StatisticalTraits", "Tables"] +git-tree-sha1 = "3ad7f09ae97806e86b3ef28cd50c52ca18bd2d80" +uuid = "321657f4-b219-11e9-178b-2701a2544e81" +version = "3.1.1" + +[[deps.ScientificTypesBase]] +git-tree-sha1 = "a8e18eb383b5ecf1b5e6fc237eb39255044fd92b" +uuid = "30f210dd-8aff-4c5f-94ba-8e64358c1161" +version = "3.0.0" + [[deps.ScopedValues]] deps = ["HashArrayMappedTries", "Logging"] -git-tree-sha1 = "7f44eef6b1d284465fafc66baf4d9bdcc239a15b" +git-tree-sha1 = "c3b2323466378a2ba15bea4b2f73b081e022f473" uuid = "7e506255-f358-4e82-b7e4-beb19740aa63" -version = "1.4.0" +version = "1.5.0" [[deps.Scratch]] deps = ["Dates"] @@ -1807,6 +2189,12 @@ version = "1.4.8" uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" version = "1.11.0" +[[deps.Setfield]] +deps = ["ConstructionBase", "Future", "MacroTools", "StaticArraysCore"] +git-tree-sha1 = "c5391c6ace3bc430ca630251d02ea9687169ca68" +uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46" +version = "1.1.2" + [[deps.ShaderAbstractions]] deps = ["ColorTypes", "FixedPointNumbers", "GeometryBasics", "LinearAlgebra", "Observables", "StaticArrays"] git-tree-sha1 = "818554664a2e01fc3784becb2eb3a82326a604b6" @@ -1818,6 +2206,11 @@ deps = ["Distributed", "Mmap", "Random", "Serialization"] uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" version = "1.11.0" +[[deps.ShowCases]] +git-tree-sha1 = "7f534ad62ab2bd48591bdeac81994ea8c445e4a5" +uuid = "605ecd9f-84a6-4c9e-81e2-4798472b76a3" +version = "0.1.0" + [[deps.Showoff]] deps = ["Dates", "Grisu"] git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de" @@ -1851,12 +2244,6 @@ version = "0.1.5" uuid = "6462fe0b-24de-5631-8697-dd941f90decc" version = "1.11.0" -[[deps.SoftGlobalScope]] -deps = ["REPL"] -git-tree-sha1 = "986ec2b6162ccb95de5892ed17832f95badf770c" -uuid = "b85f4697-e234-5449-a836-ec8e2f98b302" -version = "1.1.0" - [[deps.SortingAlgorithms]] deps = ["DataStructures"] git-tree-sha1 = "64d974c2e6fdf07f8155b5b2ca2ffa9069b608d9" @@ -1870,22 +2257,18 @@ version = "1.11.0" [[deps.SparseConnectivityTracer]] deps = ["ADTypes", "DocStringExtensions", "FillArrays", "LinearAlgebra", "Random", "SparseArrays"] -git-tree-sha1 = "7bd2b8981cc57adcf5cf1add282aba2713a7058f" +git-tree-sha1 = "3c3a42a29f696f16273741ffe589b4003f539088" uuid = "9f842d2f-2579-4b1d-911e-f412cf18a3f5" -version = "1.0.0" +version = "1.1.0" +weakdeps = ["ChainRulesCore", "LogExpFunctions", "NNlib", "NaNMath", "SpecialFunctions"] [deps.SparseConnectivityTracer.extensions] + SparseConnectivityTracerChainRulesCoreExt = "ChainRulesCore" SparseConnectivityTracerLogExpFunctionsExt = "LogExpFunctions" SparseConnectivityTracerNNlibExt = "NNlib" SparseConnectivityTracerNaNMathExt = "NaNMath" SparseConnectivityTracerSpecialFunctionsExt = "SpecialFunctions" - [deps.SparseConnectivityTracer.weakdeps] - LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" - NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" - NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" - SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" - [[deps.SparseMatrixColorings]] deps = ["ADTypes", "DocStringExtensions", "LinearAlgebra", "PrecompileTools", "Random", "SparseArrays"] git-tree-sha1 = "9de43e0b9b976f1019bf7a879a686c4514520078" @@ -1917,6 +2300,12 @@ weakdeps = ["ChainRulesCore"] [deps.SpecialFunctions.extensions] SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" +[[deps.SplittablesBase]] +deps = ["Setfield", "Test"] +git-tree-sha1 = "e08a62abc517eb79667d0a29dc08a3b589516bb5" +uuid = "171d559e-b47b-412a-8079-5efa626c420e" +version = "0.1.15" + [[deps.StableRNGs]] deps = ["Random"] git-tree-sha1 = "95af145932c2ed859b63329952ce8d633719f091" @@ -1931,9 +2320,9 @@ version = "0.1.2" [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "cbea8a6bd7bed51b1619658dec70035e07b8502f" +git-tree-sha1 = "b8693004b385c842357406e3af647701fe783f98" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.14" +version = "1.9.15" weakdeps = ["ChainRulesCore", "Statistics"] [deps.StaticArrays.extensions] @@ -1945,6 +2334,32 @@ git-tree-sha1 = "192954ef1208c7019899fbf8049e717f92959682" uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" version = "1.4.3" +[[deps.StatisticalMeasures]] +deps = ["CategoricalArrays", "CategoricalDistributions", "Distributions", "LearnAPI", "LinearAlgebra", "MacroTools", "OrderedCollections", "PrecompileTools", "ScientificTypesBase", "StatisticalMeasuresBase", "Statistics", "StatsBase"] +git-tree-sha1 = "d15f71761dce0a2833d458824e6b60edbfd4f138" +uuid = "a19d573c-0a75-4610-95b3-7071388c7541" +version = "0.2.1" + + [deps.StatisticalMeasures.extensions] + LossFunctionsExt = "LossFunctions" + ScientificTypesExt = "ScientificTypes" + + [deps.StatisticalMeasures.weakdeps] + LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7" + ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81" + +[[deps.StatisticalMeasuresBase]] +deps = ["CategoricalArrays", "InteractiveUtils", "MLUtils", "MacroTools", "OrderedCollections", "PrecompileTools", "ScientificTypesBase", "Statistics"] +git-tree-sha1 = "201079ca2c48e5edfaabfc34dec1a5ad2e59476e" +uuid = "c062fc1d-0d66-479b-b6ac-8b44719de4cc" +version = "0.1.3" + +[[deps.StatisticalTraits]] +deps = ["ScientificTypesBase"] +git-tree-sha1 = "89f86d9376acd18a1a4fbef66a56335a3a7633b8" +uuid = "64bff920-2084-43da-a3e6-9bb72801c0c9" +version = "3.5.0" + [[deps.Statistics]] deps = ["LinearAlgebra"] git-tree-sha1 = "ae3bb1eb3bba077cd276bc5cfc337cc65c3075c0" @@ -1963,9 +2378,9 @@ version = "1.7.1" [[deps.StatsBase]] deps = ["AliasTables", "DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] -git-tree-sha1 = "29321314c920c26684834965ec2ce0dacc9cf8e5" +git-tree-sha1 = "2c962245732371acd51700dbb268af311bddd719" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -version = "0.34.4" +version = "0.34.6" [[deps.StatsFuns]] deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] @@ -1989,6 +2404,7 @@ deps = ["ConstructionBase", "DataAPI", "Tables"] git-tree-sha1 = "8ad2e38cbb812e29348719cc63580ec1dfeb9de4" uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" version = "0.7.1" +weakdeps = ["Adapt", "GPUArraysCore", "KernelAbstractions", "LinearAlgebra", "SparseArrays", "StaticArrays"] [deps.StructArrays.extensions] StructArraysAdaptExt = "Adapt" @@ -1997,14 +2413,6 @@ version = "0.7.1" StructArraysSparseArraysExt = "SparseArrays" StructArraysStaticArraysExt = "StaticArrays" - [deps.StructArrays.weakdeps] - Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" - GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" - KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" - LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" - StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" - [[deps.StyledStrings]] uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" version = "1.11.0" @@ -2020,9 +2428,9 @@ version = "7.7.0+0" [[deps.SymbolicIndexingInterface]] deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"] -git-tree-sha1 = "93104ca226670c0cb92ba8bc6998852ad55a2d4c" +git-tree-sha1 = "b19cf024a2b11d72bef7c74ac3d1cbe86ec9e4ed" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" -version = "0.3.43" +version = "0.3.44" weakdeps = ["PrettyTables"] [deps.SymbolicIndexingInterface.extensions] @@ -2033,6 +2441,12 @@ deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" version = "1.0.3" +[[deps.TableOperations]] +deps = ["SentinelArrays", "Tables", "Test"] +git-tree-sha1 = "e383c87cf2a1dc41fa30c093b2a19877c83e1bc1" +uuid = "ab02a1b2-a7df-11e8-156e-fb1833f50b87" +version = "1.2.0" + [[deps.TableTraits]] deps = ["IteratorInterfaceExtensions"] git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39" @@ -2069,15 +2483,37 @@ version = "1.11.0" [[deps.TiffImages]] deps = ["ColorTypes", "DataStructures", "DocStringExtensions", "FileIO", "FixedPointNumbers", "IndirectArrays", "Inflate", "Mmap", "OffsetArrays", "PkgVersion", "PrecompileTools", "ProgressMeter", "SIMD", "UUIDs"] -git-tree-sha1 = "02aca429c9885d1109e58f400c333521c13d48a0" +git-tree-sha1 = "98b9352a24cb6a2066f9ababcc6802de9aed8ad8" uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69" -version = "0.11.4" +version = "0.11.6" [[deps.TranscodingStreams]] git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742" uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" version = "0.11.3" +[[deps.Transducers]] +deps = ["Accessors", "ArgCheck", "BangBang", "Baselet", "CompositionsBase", "ConstructionBase", "DefineSingletons", "Distributed", "InitialValues", "Logging", "Markdown", "MicroCollections", "SplittablesBase", "Tables"] +git-tree-sha1 = "4aa1fdf6c1da74661f6f5d3edfd96648321dade9" +uuid = "28d57a85-8fef-5791-bfe6-a80928e7c999" +version = "0.4.85" + + [deps.Transducers.extensions] + TransducersAdaptExt = "Adapt" + TransducersBlockArraysExt = "BlockArrays" + TransducersDataFramesExt = "DataFrames" + TransducersLazyArraysExt = "LazyArrays" + TransducersOnlineStatsBaseExt = "OnlineStatsBase" + TransducersReferenceablesExt = "Referenceables" + + [deps.Transducers.weakdeps] + Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" + BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" + DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" + LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" + OnlineStatsBase = "925886fa-5bf2-5e8e-b522-a9147a512338" + Referenceables = "42d2dcc6-99eb-4e98-b66c-637b7d73030e" + [[deps.TriplotBase]] git-tree-sha1 = "4d4ed7f294cda19382ff7de4c137d24d16adc89b" uuid = "981d1d27-644d-49a2-9326-4793e63143c3" @@ -2110,20 +2546,35 @@ version = "0.4.1" [[deps.Unitful]] deps = ["Dates", "LinearAlgebra", "Random"] -git-tree-sha1 = "c0667a8e676c53d390a09dc6870b3d8d6650e2bf" +git-tree-sha1 = "cec2df8cf14e0844a8c4d770d12347fda5931d72" uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" -version = "1.22.0" -weakdeps = ["ConstructionBase", "InverseFunctions"] +version = "1.25.0" [deps.Unitful.extensions] ConstructionBaseUnitfulExt = "ConstructionBase" + ForwardDiffExt = "ForwardDiff" InverseFunctionsUnitfulExt = "InverseFunctions" + LatexifyExt = ["Latexify", "LaTeXStrings"] + PrintfExt = "Printf" -[[deps.UnitfulLatexify]] -deps = ["LaTeXStrings", "Latexify", "Unitful"] -git-tree-sha1 = "af305cc62419f9bd61b6644d19170a4d258c7967" -uuid = "45397f5d-5981-4c77-b2b3-fc36d6e9b728" -version = "1.7.0" + [deps.Unitful.weakdeps] + ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9" + ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" + Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" + Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" + +[[deps.UnsafeAtomics]] +git-tree-sha1 = "b13c4edda90890e5b04ba24e20a310fbe6f249ff" +uuid = "013be700-e6cd-48c3-b4a1-df204f14c38f" +version = "0.3.0" + + [deps.UnsafeAtomics.extensions] + UnsafeAtomicsLLVM = ["LLVM"] + + [deps.UnsafeAtomics.weakdeps] + LLVM = "929cbde3-209d-540e-8aea-75f648917ca0" [[deps.Unzip]] git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78" @@ -2315,10 +2766,10 @@ uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10" version = "1.6.0+0" [[deps.ZMQ]] -deps = ["FileWatching", "PrecompileTools", "Sockets", "ZeroMQ_jll"] -git-tree-sha1 = "2d060e1f014c07561817bf6f3c0eb66b309e04bd" +deps = ["FileWatching", "PrecompileTools", "Printf", "Sockets", "ZeroMQ_jll"] +git-tree-sha1 = "c398a0a905ed975308b433f013af388b65b10cb6" uuid = "c2297ded-f4af-51ae-bb23-16f91089e4e1" -version = "1.4.1" +version = "1.5.0" [[deps.ZeroMQ_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "libsodium_jll"] diff --git a/Project.toml b/Project.toml index e9d5119..870464f 100644 --- a/Project.toml +++ b/Project.toml @@ -9,13 +9,20 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1" IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b" +MLJ = "add582a8-e3ab-11e8-2d5e-e98b27df1bc7" +MLJBase = "a7f614a8-145f-11e9-1d2a-a57a1082229d" +MLJModelInterface = "e80e1ace-859a-464e-9ed9-23947d8ae3ea" OhMyREPL = "5fb14364-9ced-5910-84b2-373655c76a03" Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba" OptimizationBBO = "3e6eede4-6085-4f62-9a71-46d9bc1eb92b" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" +ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161" +StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" +StatisticalMeasures = "a19d573c-0a75-4610-95b3-7071388c7541" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [compat] diff --git a/scripts/validate-with-mlj.jl b/scripts/validate-with-mlj.jl new file mode 100644 index 0000000..fbf4025 --- /dev/null +++ b/scripts/validate-with-mlj.jl @@ -0,0 +1,494 @@ +# Usage +# +# This script is multi-threaded, start with +# julia --project=. -t 16 --gcthreads=12,1 +# +# include("scripts/validate-with-mlj.jl") +# +# # Repeat each fold 1 time: +# @time res, fails, changes = validate_all(; rng_seed=42, repeats=1) +# +# # Repeat each fold 100 times: +# @time res, fails, changes = validate_all(; rng_seed=42, repeats=100) + +using DataFrames: DataFrame, nrow +using Dates: Date +using StatsBase: mean +using StableRNGs: StableRNG +import TOML +import MLJ +import MLJBase +import MLJModelInterface +import ScientificTypesBase +const MMI = MLJModelInterface + +import AquaCrop +import CropGrowthTutorial + +include("willmott.jl") +using .Willmott: willmott_d + + +const DEFAULT_MEASURES = [MLJ.rms, MLJ.mae, MLJ.mape, MLJ.rmsp, willmott_d] +const DEFAULT_MAXITER = 100 + +# MLJ wrapper type with no parameters tunable via MLJ, needs custom +# fitting function +MMI.@mlj_model mutable struct AquaCropFit <: MLJModelInterface.Deterministic + rng_seed = rand(Int) + maxiter = DEFAULT_MAXITER +end +MMI.input_scitype(::Type{<:AquaCropFit}) = ScientificTypesBase.Unknown +MMI.target_scitype(::Type{<:AquaCropFit}) = ScientificTypesBase.Unknown + +# Inputs needed for model fitting for AquaCropFit +@kwdef struct CropInputs + station_name::String + crop_type::String + aquacrop_name::String + soil_type::String + planting_density::Int + weather_df::DataFrame + phenology_raw_df::DataFrame + years::Vector{Int} +end +Base.length(X::CropInputs) = length(X.years) +MLJBase.nrows(X::CropInputs) = length(X.years) +function MLJBase.selectrows(X::CropInputs, rows) + years = X.years[rows] + # We add one extra year, so that the phenology data for the + # harvest date (which is in the following year) is included + phenology_raw_df = filter(row -> row.referenzjahr in [years..., years[end]+1], X.phenology_raw_df) + return CropInputs(; + station_name = X.station_name, + crop_type = X.crop_type, + aquacrop_name = X.aquacrop_name, + soil_type = X.soil_type, + planting_density = X.planting_density, + weather_df = X.weather_df, + phenology_raw_df, + years, + ) +end + +# helper function +function get_fit_type_and_phases(crop_type::AbstractString) + if startswith(crop_type, "silage") + # silage crops, fit to biomass + fit_type = :Biomass + sowing_phase = 10 # numerical id of the sowing phase + harvest_phase = 39 # numerical id of the harvest phase + else + # non-silage crops, fit to yield + fit_type = :Yield + sowing_phase = 10 # numerical id of the sowing phase + harvest_phase = 24 # numerical id of the harvest phase + end + return fit_type, sowing_phase, harvest_phase +end + +function MMI.fit(model::AquaCropFit, verbosity::Int, X::CropInputs, y::AbstractVector) + # returns (fitresult::Dict, cache, report::NamedTuple) + if length(X) != length(y) + error("Inputs X and ouputs y have different lengths, ", + "length(X) = $(length(X)), length(y) = $(length(y))") + end + crop_type = X.crop_type + aquacrop_name = X.aquacrop_name + soil_type = X.soil_type + planting_density = X.planting_density + weather_df = X.weather_df + phenology_raw_df = X.phenology_raw_df + years = X.years + target_output = y + + println("\n") + println("fitting years = $years") + @show nrow(phenology_raw_df) + + # fit_type, sowing_phase, harvest_phase + fit_type, sowing_phase, harvest_phase = get_fit_type_and_phases(crop_type) + println("fit_type = $fit_type, sowing_phase = $sowing_phase, harvest_phase = $harvest_phase") + + # check sowing_phase, harvest_phase + phases = unique(phenology_raw_df[!, :phase_id]) + if sowing_phase ∉ phases + error("sowing_phase = $sowing_phase not found in phases = $phases") + end + if harvest_phase ∉ phases + error("harvest_phase = $harvest_phase not found in phases = $phases") + end + + # create a kw tuple with the additional information that we wish to pass to AquaCrop + kw = (; crop_dict = Dict{String,Any}("PlantingDens" => planting_density)) + + # 1. Calibrate Phenology + println("running CropGrowthTutorial.calibrate_phenology_parameters()") + @time crop_dict, phenology_df = CropGrowthTutorial.calibrate_phenology_parameters( + phenology_raw_df, aquacrop_name, weather_df, sowing_phase, harvest_phase; kw...) + if isnothing(phenology_df) + println("Calibrating phenology parameters failed, not enough phenology data") + error("Calibrating phenology parameters failed, not enough phenology data") + end + filter!(row -> row.year in years, phenology_df) + @show nrow(phenology_df) + println("phenology_df =") + display(phenology_df) + println("phenology_raw_df =") + display(phenology_raw_df) + + # 2. Calibrate the canopy growth parameters + println("running CropGrowthTutorial.calibrate_canopy_root_parameters!") + @time CropGrowthTutorial.calibrate_canopy_root_parameters!(crop_dict, aquacrop_name); + + # 3. Calibrate biomass-yield parameters + println("running CropGrowthTutorial.calibrate_biomass_yield_parameters!") + @time CropGrowthTutorial.calibrate_biomass_yield_parameters!( + crop_dict, aquacrop_name, soil_type, weather_df, fit_type, phenology_df, target_output; + rng_seed=model.rng_seed, + maxiter=model.maxiter, + ) + + # fit_description + desc = Dict( + :PhenologyCanopy => "phenology canopy calibration", + :Biomass => "phenology canopy biomass calibration", + :Yield => "phenology canopy yield calibration", + ) + fit_description = desc[fit_type] + + # fitresult = crop + fitresult = crop_dict + cache = nothing + report = (; fit_description, phenology_df) # can put extra information here + return fitresult, cache, report +end + +# returns yhat (scalar) +function predict_one(crop_dict::Dict, weather_df::DataFrame, aquacrop_name::String, + soil_type::String, sowing_date::Date, fit_type::Symbol) + cropfield, all_ok = CropGrowthTutorial.run_simulation( + soil_type, aquacrop_name, sowing_date, weather_df; + crop_dict + ) + if !all_ok.logi + return Inf + else + if fit_type == :Yield + return cropfield.dayout[end,"Y(fresh)"].val + elseif fit_type == :Biomass + return cropfield.dayout[end,"Biomass"].val + else + error("Unknown fit_type $fit_type") + end + end +end + +function MMI.predict(model::AquaCropFit, fitted::Dict, X::CropInputs) + # fit_type, sowing_phase, harvest_phase + fit_type, sowing_phase, harvest_phase = get_fit_type_and_phases(X.crop_type) + + # sowing_dates + phenology_raw_df = CropGrowthTutorial.get_crop_phenology_data(X.crop_type, X.station_name) + sowing_dates = Dict{Int, Date}() # year => sowing_date + phenology_df = CropGrowthTutorial.process_crop_phenology(phenology_raw_df, sowing_phase, harvest_phase) + for year in X.years + df = filter(r -> r.year == year, phenology_df) + if nrow(df) != 1 + @show phenology_df + @show X.years + error("Expected one row in dataframe, got $(nrow(df)) for year = $year") + end + sowing_dates[year] = df[1, :sowingdate] + end + + return [predict_one(fitted, X.weather_df, X.aquacrop_name, X.soil_type, sowing_dates[year], fit_type) + for year in X.years] +end + + + +########## +# testing +########## + +# TODO: automatically get this data + +# Available yield data for stations and crop types +# +# crop_type Eichsfeld_years Jena_years Thüringer_Becken_years +# --------- --------------- ---------- ---------------------- +# Silage maize 2009--2022 2000--2014 2014--2022 +# Winter wheat 2009--2022 2000--2014 2014--2022 +# Winter barley 2009--2022 2000--2014 2015--2022 +# Winter rapeseed 2009--2022 2000--2014 2014--2022 + + +function crossvalidate_fit( + station_name::AbstractString, + crop_type::AbstractString; + years::Union{AbstractVector{Int}, Nothing}=nothing, + folds::AbstractVector, + repeats::Int=1, + measures=DEFAULT_MEASURES, + rng_seed::Int=rand(Int), + maxiter::Int=DEFAULT_MAXITER, + #nfolds::Union{Int, Nothing}=nothing +) + #MIN_NFOLDS = 2 + #MAX_NFOLDS = 5 + + println() + println("make_fit inputs: station_name = $station_name, crop_type = $crop_type") + + # aquacrop_name, planting_density + crop_data_df = CropGrowthTutorial.get_crop_parameters() + filter!(row -> row.crop_type == crop_type, crop_data_df) + if nrow(crop_data_df) != 1 + error("Expected one matching row in crop_data_df for crop_type = $crop_type,", + " found $(nrow(crop_data_df)) rows") + end + aquacrop_name = first(crop_data_df).aquacrop_name + planting_density = first(crop_data_df).plantingdens # TODO: units are num_seeds/ha ? + + # soil_type + stations_df = CropGrowthTutorial.get_phenology_stations() + filter!(row -> row.station_name == station_name, stations_df) + if nrow(stations_df) != 1 + error("Expected one matching row in stations_df for station_name = $station_name,", + " found $(nrow(stations_df)) rows") + end + soil_type = first(stations_df).soil_type + + # weather_df + weather_df = CropGrowthTutorial.get_climate_data(station_name) + if isnothing(weather_df) + error("No climate data for station $station_name") + end + + # yield_df + yield_df = CropGrowthTutorial.get_yield_data(station_name) + if isnothing(yield_df) + error("No yield data for station $station_name") + end + # filter crop_type + filter!(row -> row.crop_type == crop_type, yield_df) + println("yield_df =") + display(yield_df) + + # phenology_raw_df: crop phenology raw data for a given station + phenology_raw_df = CropGrowthTutorial.get_crop_phenology_data(crop_type, station_name) + if isnothing(phenology_raw_df) + error("No phenology data for station $station_name and crop_type $crop_type") + end + + # years + if isnothing(years) + # check for which years we have yield and phenology data + years_yield_df = sort([parse(Int, colname) for colname in names(yield_df) if colname ∉ ("crop_type", "unit")]) + years_phenology_raw_df = sort(unique(phenology_raw_df.referenzjahr)) + years = intersect(years_yield_df, years_phenology_raw_df) + end + sort!(years) + let allyears = collect(minimum(years):maximum(years)) + # TODO: duplicated + years_yield_df = sort([parse(Int, colname) for colname in names(yield_df) if colname ∉ ("crop_type", "unit")]) + years_phenology_raw_df = sort(unique(phenology_raw_df.referenzjahr)) + if years != allyears + println("Some years are missing\n" * + "years = $years\n" * + "missing years are = $(setdiff(allyears, years))\n" * + "years_yield_df = $years_yield_df\n" * + "years_phenology_raw_df = $years_phenology_raw_df\n") + end + end + years::AbstractVector{Int} + println("years = $years") + + # filter years from yield_df, which are stored as columns + cols = ["crop_type", "unit", string.(years)...] + yield_df = yield_df[:, cols] + if nrow(yield_df) != 1 + error("Expected exactly one row in yield_df, crop_type = $crop_type at station_name = $station_name\n", + "yield_df:\n$yield_df") + end + + # yields + yields = first(yield_df) + + # filter years from phenology_raw_df + # We add one extra year, so that the phenology data for the + # harvest date (which is in the following year) is included + phenology_raw_df = filter(row -> row.referenzjahr in [years..., years[end]+1], phenology_raw_df) + + model = AquaCropFit(; rng_seed, maxiter) + X = CropInputs(; station_name, crop_type, aquacrop_name, soil_type, planting_density, + weather_df, phenology_raw_df, years) + # the yield/biomass data is in units of dt = 10 tons, so we divide by 10 to get tons + # (actually it's dt/ha, and dividing by 10 gives ton/ha) + y = Float64[getindex(yields, Symbol(year)) / 10 for year in years] + + println("soil_type = $soil_type, aquacrop_name = $aquacrop_name, planting_density = $planting_density") + println("y = $y") + println("folds = $folds") + + # Note: no data shuffling as data is time-ordered + mach = MLJ.machine(model, X, y) + #cv = MLJ.CV(; nfolds, shuffle=false) + #cv = TimeSeriesCV(; nfolds) + r = MLJ.evaluate!( + mach; + resampling=repeat(folds, repeats), # we have to manually repeat the folds + force = true, # needed because we have to manually repeat the folds + measures, + verbosity=1 + ) + return r +end + +MLJ.default_resource(MLJ.CPUThreads()) + +function validate_all(; repeats::Int=1, measures=DEFAULT_MEASURES, rng_seed::Int=42, maxiter::Int=DEFAULT_MAXITER) + rng = StableRNG(hash(rng_seed, UInt(0x1a2b3c4d5e6f7788))) # salted hash + + inputs = Dict( + "Eichsfeld" => Dict( + # crop_type years folds + "silage_maize" => ([2009:2018..., 2020:2021...], [(1:10, 11:12)]), # 2018: phenology data missing + "winter_wheat" => ([2009:2018..., 2020:2021...], [(1:10, 11:12)]), # 2018: phenology data missing + "winter_barley" => ([], []), + "winter_rape" => ([2009:2021...], [(1:10, 11:13)]), + ), + "Jena" => Dict( + "silage_maize" => ([2000:2014...], [(1:10, 11:15)]), + "winter_wheat" => ([2000:2013...], [(1:10, 11:14)]), # 2014: problems with phenology data + "winter_barley" => ([], []), # sowing_phase not found + "winter_rape" => ([2000:2013...], [(1:10, 11:14)]), # 2014: problems with phenology data + ), + "Thuringer_Becken" => Dict( + "silage_maize" => ([2014:2022...], [(1:6, 7:9)]), + "winter_wheat" => ([2014, 2016:2021...], [(1:5, 6:7)]), # 2015, 2022: problems, missing sowingdate + "winter_barley" => ([2016:2021...], [(1:4, 5:6)]), # 2014, 2015, 2022: missing data + "winter_rape" => ([2014:2021...], [(1:6, 7:8)]), # 2022: problems + ), + ) + rng_seeds = Dict( + (station_name, crop_name) => rand(rng, Int) + for station_name in keys(inputs) for crop_name in keys(inputs[station_name]) + ) + @show rng_seeds + + results = Dict{Tuple{String,String},Any}() + fails = Any[] + change_from_ref = Dict{Tuple{String,String}, Float64}() + + lk = ReentrantLock() + @sync for station_name in sort(collect(keys(inputs))) + crop_years_folds = inputs[station_name] + println() + @show station_name + for (crop_name, (years, folds)) in crop_years_folds + if isempty(folds) || isempty(years) + @info "Skipping $crop_name, folds or years are empty..." + continue + end + Threads.@spawn begin + reference_params_path = + joinpath(pkgdir(CropGrowthTutorial), "data", "sims", "$(crop_name)_$(station_name).TOML") + reference_params = TOML.parsefile(reference_params_path)["crop"] + println() + @show crop_name + @show years + @show folds + for (f1, f2) in folds + @show years[f1], years[f2] + end + r = try + crossvalidate_fit( + station_name, crop_name; + folds, years, repeats, measures, maxiter, + rng_seed = rng_seeds[(station_name, crop_name)], + ) + catch err + @warn("Failed crossvalidation for $station_name and $crop_name", + exception=(err, catch_backtrace())) + lock(lk) do + push!(fails, (station_name, crop_name, years, folds)) + end + nothing + end + changes = if !isnothing(r) + mean(mean_abs_rel_change(reference_params, nt.fitresult) for nt in r.fitted_params_per_fold) + else + nothing + end + + lock(lk) do + results[(station_name, crop_name)] = r + change_from_ref[(station_name, crop_name)] = changes + end + end + end + end + + # changes_df DataFrame + changes_df = DataFrame([ + (station=a, crop=b, mean_abs_rel_change=c) + for ((a,b), c) in change_from_ref if !isnothing(change_from_ref) + ]) + sort!(changes_df, [:station, :crop]) + + # results_perf_df DataFrame + results_perf_df = DataFrame([ + let + names = Symbol.(getindex.(split.(string.(perf_evals.measure), "("), 1)) + replace!(names, + :RootMeanSquaredError => :RMSE, + :LPLoss => :MAE, + :MeanAbsoluteProportionalError => :MAPE, + :RootMeanSquaredProportionalError => :RMSPE, + ) + vals = perf_evals.measurement + metrics = NamedTuple( (name => val for (name, val) in zip(names, vals)) ) + (; station_name, crop_name, metrics...) + end + for ((station_name, crop_name), perf_evals) in results if !isnothing(perf_evals) + ]) + sort!(results_perf_df, [:station_name, :crop_name]) + + return (; results, results_perf_df, changes_df, fails) +end + +function show_years(station_name::AbstractString, crop_type::AbstractString) + # yield_df + yield_df = CropGrowthTutorial.get_yield_data(station_name) + if isnothing(yield_df) + error("No yield data for station $station_name") + end + # filter crop_type + filter!(row -> row.crop_type == crop_type, yield_df) + + # phenology_raw_df: crop phenology raw data for a given station + phenology_raw_df = CropGrowthTutorial.get_crop_phenology_data(crop_type, station_name) + if isnothing(phenology_raw_df) + error("No phenology data for station $station_name and crop_type $crop_type") + end + + @show years_yield_df = sort([parse(Int, colname) for colname in names(yield_df) if colname ∉ ("crop_type", "unit")]) + @show years_phenology_raw_df = sort(unique(phenology_raw_df.referenzjahr)) + @show years = intersect(years_yield_df, years_phenology_raw_df) + + return yield_df, phenology_raw_df +end + +function mean_abs_rel_change(d1::Dict{Tkey, T1}, d2::Dict{Tkey, T2}) where {Tkey, T1, T2} + common_keys = intersect(keys(d1), keys(d2)) + r = 0.0 + if length(common_keys) == 0 + return 0.0 + end + for k in common_keys + r += abs((d2[k] - d1[k]) / d1[k]) + end + return r / length(common_keys) +end From a599a0baff7ef9a91111a96319e6925a7f075fb6 Mon Sep 17 00:00:00 2001 From: Marco Matthies <71844+marcom@users.noreply.github.com> Date: Thu, 25 Sep 2025 07:47:55 +0200 Subject: [PATCH 5/5] Clean up comments --- scripts/validate-with-mlj.jl | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/scripts/validate-with-mlj.jl b/scripts/validate-with-mlj.jl index fbf4025..4dcd5f7 100644 --- a/scripts/validate-with-mlj.jl +++ b/scripts/validate-with-mlj.jl @@ -208,21 +208,9 @@ end -########## -# testing -########## - -# TODO: automatically get this data - -# Available yield data for stations and crop types -# -# crop_type Eichsfeld_years Jena_years Thüringer_Becken_years -# --------- --------------- ---------- ---------------------- -# Silage maize 2009--2022 2000--2014 2014--2022 -# Winter wheat 2009--2022 2000--2014 2014--2022 -# Winter barley 2009--2022 2000--2014 2015--2022 -# Winter rapeseed 2009--2022 2000--2014 2014--2022 - +################### +# cross-validation +################### function crossvalidate_fit( station_name::AbstractString, @@ -233,11 +221,7 @@ function crossvalidate_fit( measures=DEFAULT_MEASURES, rng_seed::Int=rand(Int), maxiter::Int=DEFAULT_MAXITER, - #nfolds::Union{Int, Nothing}=nothing ) - #MIN_NFOLDS = 2 - #MAX_NFOLDS = 5 - println() println("make_fit inputs: station_name = $station_name, crop_type = $crop_type") @@ -346,8 +330,18 @@ function crossvalidate_fit( return r end +# Use CPU threads in MLJ MLJ.default_resource(MLJ.CPUThreads()) +# Available yield data for stations and crop types +# +# crop_type Eichsfeld_years Jena_years Thüringer_Becken_years +# --------- --------------- ---------- ---------------------- +# Silage maize 2009--2022 2000--2014 2014--2022 +# Winter wheat 2009--2022 2000--2014 2014--2022 +# Winter barley 2009--2022 2000--2014 2015--2022 +# Winter rapeseed 2009--2022 2000--2014 2014--2022 + function validate_all(; repeats::Int=1, measures=DEFAULT_MEASURES, rng_seed::Int=42, maxiter::Int=DEFAULT_MAXITER) rng = StableRNG(hash(rng_seed, UInt(0x1a2b3c4d5e6f7788))) # salted hash