Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.6'
- '1.10'
- '1' # automatically expands to the latest stable 1.x release of Julia.
os:
- ubuntu-latest
Expand Down Expand Up @@ -65,4 +65,4 @@ jobs:
using Documenter: DocMeta, doctest
using StatisticalMeasures
DocMeta.setdocmeta!(StatisticalMeasures, :DocTestSetup, :(using StatisticalMeasures); recursive=true)
doctest(StatisticalMeasures)'
doctest(StatisticalMeasures)'
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StatisticalMeasures"
uuid = "a19d573c-0a75-4610-95b3-7071388c7541"
authors = ["Anthony D. Blaom <[email protected]>"]
version = "0.1.7"
version = "0.2.0"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down Expand Up @@ -31,7 +31,7 @@ ScientificTypesExt = "ScientificTypes"
CategoricalArrays = "0.10"
CategoricalDistributions = "0.1"
Distributions = "0.25"
LearnAPI = "0.1"
LearnAPI = "0.2"
LossFunctions = "0.10, 0.11"
MacroTools = "0.5"
OrderedCollections = "1"
Expand All @@ -41,7 +41,7 @@ ScientificTypesBase = "3"
StatisticalMeasuresBase = "0.1"
Statistics = "1"
StatsBase = "0.33, 0.34"
julia = "1.6"
julia = "1.10"

[extras]
LossFunctions = "30fc2ffe-d236-52d8-8643-a9d8f7c094a7"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Measures (metrics) for statistics and machine learning.
[![Coverage](https://codecov.io/gh/JuliaAI/StatisticalMeasures.jl/branch/master/graph/badge.svg)](https://codecov.io/github/JuliaAI/StatisticalMeasures.jl?branch=master)
[![Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliaai.github.io/StatisticalMeasures.jl/dev/)

[List](https://juliaai.github.io/StatisticalMeasures.jl/dev/auto_generated_list_of_measures#aliases) of provided measures and their aliases thereof.
[List](https://juliaai.github.io/StatisticalMeasures.jl/dev/auto_generated_list_of_measures#aliases) of provided measures and their aliases.

Powered by
[StatisticalMeasuresBase.jl](https://juliaai.github.io/StatisticalMeasuresBase.jl/dev/).
Expand Down
4 changes: 2 additions & 2 deletions docs/make_tools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ string.
page *= "\n## Classification measures (non-probabilistic)\n\n"
constructors = filter(all_constructors) do c
traits = traits_given_constructor[c]
traits.kind_of_proxy == LearnAPI.LiteralTarget() &&
traits.kind_of_proxy == LearnAPI.Point() &&
traits.observation_scitype <: Union{
Union{Missing,Finite},
AbstractArray{<:Union{Missing,Finite}},
Expand All @@ -104,7 +104,7 @@ string.
page *= "\n## Regression measures (non-probabilistic)\n\n"
constructors = filter(all_constructors) do c
traits = traits_given_constructor[c]
traits.kind_of_proxy == LearnAPI.LiteralTarget() &&
traits.kind_of_proxy == LearnAPI.Point() &&
traits.observation_scitype <: Union{
Union{Missing,Infinite},
AbstractArray{<:Union{Missing,Infinite}},
Expand Down
2 changes: 1 addition & 1 deletion ext/LossFunctionsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ loss(measure) = measure

@trait(
S{<:DistanceLoss},
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
orientation=Loss(),
external_aggregation_mode = Mean(),
)
Expand Down
2 changes: 1 addition & 1 deletion ext/ScientificTypesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function StatisticalMeasures.measures(yhat, y; trait_filters...)
filter(measures(; trait_filters...)) do (_, metadata)
requirement1 = y_scitype <: metadata.observation_scitype
proxy = metadata.kind_of_proxy
requirement2 = if proxy == LearnAPI.LiteralTarget()
requirement2 = if proxy == LearnAPI.Point()
yhat_scitype <: metadata.observation_scitype
elseif proxy == LearnAPI.Distribution()
yhat_scitype <: Density{<:y_scitype}
Expand Down
20 changes: 10 additions & 10 deletions src/continuous.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This section is for measures that take `Infinite` input (vectors, arrays or tables)
# and where the prediction has the same form as the ground truth, i.e.,`kind_of_proxy =
# LearnAPI.LiteralTarget` (in particular, is not a probabilistic prediction).
# LearnAPI.Point` (in particular, is not a probabilistic prediction).

# If a new measure can be derived from a single scalar function with zero or one
# parameters, then follow the examples that use the `@combination` macro. Otherwise you
Expand All @@ -12,7 +12,7 @@
# defines LPLoss and MultitargetLPLoss constructors:
@combination(
LPLoss(; p=2) = multimeasure(Functions.pth_power_of_absolute_difference, mode=Mean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
human_name = "``L^p`` loss",
Expand Down Expand Up @@ -99,7 +99,7 @@ const multitarget_mean_absolute_value = multitarget_l1
@combination(
LPSumLoss(; p=2) =
multimeasure(Functions.pth_power_of_absolute_difference, mode=Sum()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
human_name = "``L^p`` sum loss",
Expand Down Expand Up @@ -158,7 +158,7 @@ const multitarget_l2_sum = MultitargetLPSumLoss(2)
# define constructors:
@combination(
RootMeanSquaredError() = multimeasure(Functions.absolute_difference, mode=RootMean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
)
Expand Down Expand Up @@ -220,7 +220,7 @@ const multitarget_root_mean_squared_error = multitarget_rms
@combination(
RootMeanSquaredLogError() =
multimeasure(Functions.absolute_difference_of_logs, mode=RootMean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
)
Expand Down Expand Up @@ -285,7 +285,7 @@ const multitarget_root_mean_squared_log_error = multitarget_rmsl
@combination(
RootMeanSquaredLogProportionalError(; offset=1) =
multimeasure(Functions.absolute_difference_of_logs, mode=RootMean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
)
Expand Down Expand Up @@ -337,7 +337,7 @@ const multitarget_rmslp1 = MultitargetRootMeanSquaredLogProportionalError()
@combination(
RootMeanSquaredProportionalError(; tol=eps()) =
multimeasure(Functions.normalized_absolute_difference, mode=RootMean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
)
Expand Down Expand Up @@ -390,7 +390,7 @@ const multitarget_rmsp = MultitargetRootMeanSquaredProportionalError()
@combination(
MeanAbsoluteProportionalError(; tol=eps()) =
multimeasure(Functions.normalized_absolute_difference, mode=Mean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
)
Expand Down Expand Up @@ -440,7 +440,7 @@ const multitarget_mape = MultitargetMeanAbsoluteProportionalError()
# define constructors:
@combination(
LogCoshLoss() = multimeasure(Functions.log_cosh_difference, mode=Mean()),
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Infinite,
orientation = Loss(),
)
Expand Down Expand Up @@ -512,7 +512,7 @@ const RSquaredType = API.FussyMeasure{<:API.RobustMeasure{<:_RSquared}}
@trait(
_RSquared,
consumes_multiple_observations = true,
kind_of_proxy = LearnAPI.LiteralTarget(),
kind_of_proxy = LearnAPI.Point(),
observation_scitype = Union{Missing,Infinite},
orientation = Score(),
human_name = "R² coefficient",
Expand Down
2 changes: 1 addition & 1 deletion src/docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function docstring(signature; body="", footer="", scitype="")
"use the syntax `measurements($m_str, ŷ, y)`. ")
ret *= "Generally, an observation `obs` in `MLUtils.eachobs(y)` is expected to satisfy "*
"`ScientificTypes.scitype(obs)<:`$scitype. "
# if kind_of_proxy == LearnAPI.LiteralTarget()
# if kind_of_proxy == LearnAPI.Point()
# ret *= "The same is true for `ŷ`. "
# else
# ret *= "Each observation in `ŷ` should be this kind of proxy for actual "*
Expand Down
22 changes: 11 additions & 11 deletions src/finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ConfusionMatrixType = API.FussyMeasure{
@trait(
_ConfusionMatrix,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
orientation=Unoriented(),
external_aggregation_mode=Sum(),
Expand Down Expand Up @@ -111,7 +111,7 @@ const confusion_matrix = confmat
# define both constructors:
@combination(
MisclassificationRate() = multimeasure(!=),
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Finite,
orientation=Loss(),
)
Expand Down Expand Up @@ -181,7 +181,7 @@ const multitarget_mcr = multitarget_misclassification_rate
# define both constructors:
@combination(
Accuracy() = multimeasure(==),
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Finite,
orientation=Score(),
)
Expand Down Expand Up @@ -290,7 +290,7 @@ end
@trait(
_BalancedAccuracy,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
supports_weights=true,
orientation=Score(),
Expand Down Expand Up @@ -357,7 +357,7 @@ const KappaType = API.FussyMeasure{<:API.RobustMeasure{<:_Kappa}}
@trait(
_Kappa,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
supports_weights=true,
orientation=Score(),
Expand Down Expand Up @@ -415,7 +415,7 @@ const MatthewsCorrelationType = API.FussyMeasure{
@trait(
_MatthewsCorrelation,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
orientation=Score(),
human_name = "Matthew's correlation",
Expand Down Expand Up @@ -518,7 +518,7 @@ const FScoreType = API.FussyMeasure{<:API.RobustMeasure{<:_FScore}}
@trait(
_FScore,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,OrderedFactor{2}},
orientation=Score(),
human_name = "``F_β`` score",
Expand Down Expand Up @@ -707,7 +707,7 @@ for Measure in TRUE_POSITIVE_AND_COUSINS
@trait(
$_Measure,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,OrderedFactor{2}},
orientation=$orientation,
human_name=$name,
Expand Down Expand Up @@ -865,7 +865,7 @@ for Measure in [
@trait(
$_Measure,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
orientation=$orientation,
human_name=$name,
Expand Down Expand Up @@ -1104,7 +1104,7 @@ for Measure in [
@trait(
$_Measure,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
supports_class_weights=true,
orientation=$orientation,
Expand Down Expand Up @@ -1322,7 +1322,7 @@ MulticlassFScoreType = API.FussyMeasure{
@trait(
_MulticlassFScore,
consumes_multiple_observations=true,
kind_of_proxy=LearnAPI.LiteralTarget(),
kind_of_proxy=LearnAPI.Point(),
observation_scitype=Union{Missing,Finite},
supports_class_weights=true,
orientation=Score(),
Expand Down
4 changes: 2 additions & 2 deletions test/finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ end
for m in (accuracy, recall, StatisticalMeasures.precision, f1score, specificity)
@test API.consumes_multiple_observations(m)
m == accuracy || @test !API.can_report_unaggregated(m)
@test API.kind_of_proxy(m) == StatisticalMeasures.LearnAPI.LiteralTarget()
@test API.kind_of_proxy(m) == StatisticalMeasures.LearnAPI.Point()
@test API.observation_scitype(m) <: Union{Missing,Finite}
@test !API.can_consume_tables(m)
m == accuracy && @test API.supports_weights(m)
Expand Down Expand Up @@ -409,7 +409,7 @@ end
m == MulticlassTrueNegativeRate &&
(@test API.human_name(m) == "multi-class true negative rate")
@test API.observation_scitype(m) <: Union{Missing,Finite}
@test API.kind_of_proxy(m) == StatisticalMeasures.LearnAPI.LiteralTarget()
@test API.kind_of_proxy(m) == StatisticalMeasures.LearnAPI.Point()
@test API.orientation(m) == API.Score()
@test API.can_report_unaggregated(m) == false
@test !API.supports_weights(m)
Expand Down
Loading