Skip to content

Commit

Permalink
Add 'defaultloss' helper function (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliascarv committed Dec 18, 2023
1 parent b9a7628 commit d6538ef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.1.0"

[deps]
ColumnSelectors = "9cc86067-7e36-4c61-b350-1ac9833d277f"
DataScienceTraits = "6cb2f572-2d2b-4ba6-bdb3-e710fa044d6c"
DensityRatioEstimation = "ab46fb84-d57c-11e9-2f65-6f72e4a7229f"
GeoStatsBase = "323cb8eb-fbf6-51c0-afd0-f8fba70507b2"
GeoStatsModels = "ad987403-13c5-47b5-afee-0a48f6ac4f12"
Expand All @@ -17,6 +18,7 @@ Transducers = "28d57a85-8fef-5791-bfe6-a80928e7c999"

[compat]
ColumnSelectors = "0.1"
DataScienceTraits = "0.2"
DensityRatioEstimation = "1.2"
GeoStatsBase = "0.42"
GeoStatsModels = "0.2"
Expand Down
10 changes: 9 additions & 1 deletion src/GeoStatsValidation.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

module GeoStatsValidation

using Meshes
using GeoTables
using Transducers
using DataScienceTraits
using DensityRatioEstimation

using GeoStatsModels: GeoStatsModel
Expand All @@ -11,11 +16,14 @@ using StatsLearnModels: Learn, input, output
using GeoStatsTransforms: Interpolate, InterpolateNeighbors

using ColumnSelectors: selector
using GeoStatsBase: weight, folds, mean
using GeoStatsBase: WeightingMethod, DensityRatioWeighting, UniformWeighting
using GeoStatsBase: FoldingMethod, BallFolding, BlockFolding, OneFolding, UniformFolding
using GeoStatsBase: weight, folds, defaultloss, mean
using DataScienceTraits: Continuous, Categorical
using LossFunctions: L2DistLoss, MisclassLoss
using LossFunctions.Traits: SupervisedLoss

include("utils.jl")
include("cverror.jl")

export cverror, LeaveOneOut, LeaveBallOut, KFoldValidation, BlockValidation, WeightedValidation, DensityRatioValidation
Expand Down
7 changes: 7 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ------------------------------------------------------------------
# Licensed under the MIT License. See LICENSE in the project root.
# ------------------------------------------------------------------

defaultloss(val) = defaultloss(scitype(val))
defaultloss(::Type{Continuous}) = L2DistLoss()
defaultloss(::Type{Categorical}) = MisclassLoss()

0 comments on commit d6538ef

Please sign in to comment.