Skip to content

Commit 8ca9d2f

Browse files
authored
Merge pull request #12 from JuliaAI/dev
For a 0.1.2 release
2 parents 6912e99 + ccb4cc8 commit 8ca9d2f

File tree

10 files changed

+25
-26
lines changed

10 files changed

+25
-26
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "StatisticalMeasuresBase"
22
uuid = "c062fc1d-0d66-479b-b6ac-8b44719de4cc"
33
authors = ["Anthony D. Blaom <[email protected]>"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[deps]
77
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ A Julia package for building production-ready measures (metrics) for statistics
99
Related:
1010
[StatisticalMeasures.jl](https://juliaai.github.io/StatisticalMeasures.jl/dev/)
1111

12+
[List](https://github.com/FluxML/FluxML-Community-Call-Minutes/discussions/38) of Julia packages providing metrics.
1213

1314
## The main idea
1415

@@ -47,18 +48,18 @@ julia> multitarget_L1(ŷ, y, weights)
4748
```
4849

4950
```julia
50-
using Tables
51-
t = y' |> Tables.table |> Tables.rowtable
52-
= ' |> Tables.table |> Tables.rowtable
51+
using DataFrames
52+
df = DataFrame(y', :auto)
53+
df̂ = DataFrame(', :auto)
5354

54-
julia> multitarget_L1(t̂, t, weights)
55+
julia> multitarget_L1(df̂, df, weights)
5556
39
5657
```
5758

58-
Generate measurements *for each observation* with the `measurement` method:
59+
Generate measurements *for each observation* with the `measurements` method:
5960

6061
```julia
61-
julia> measurements(multitarget_L1, t̂, t, weights)
62+
julia> measurements(multitarget_L1, df̂, df, weights)
6263
3-element Vector{Int64}:
6364
3
6465
9

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[deps]
2+
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
23
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
34
ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161"
45
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

docs/src/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ multitarget_L1(ŷ, y, weights)
4747
```
4848

4949
```@example 01
50-
using Tables
51-
t = y' |> Tables.table |> Tables.rowtable
52-
t̂ = ŷ' |> Tables.table |> Tables.rowtable
53-
multitarget_L1(t̂, t, weights)
50+
using DataFrames
51+
df = DataFrame(y', :auto)
52+
df̂ = DataFrame(ŷ', :auto)
53+
multitarget_L1(df̂, df, weights)
5454
```
5555

56-
Generate measurements *for each observation* with the `measurement` method:
56+
Generate measurements *for each observation* with the `measurements` method:
5757

5858
```@example 01
59-
measurements(multitarget_L1, t̂, t, weights)
59+
measurements(multitarget_L1, df̂, df, weights)
6060
```
6161

6262
# Overview
@@ -69,7 +69,7 @@ measures. For a package that does, based on this interface, see
6969
can also be applied to measures provided by other packages, such as
7070
[LossFunctions.jl](https://github.com/JuliaML/LossFunctions.jl).
7171

72-
Specically, this package provides:
72+
Specifically, this package provides:
7373

7474
- A measure wrapper [`multimeasure`](@ref) that leverages MLUtils.jl to broadcast a simple
7575
measure over multiple observations; the main use case is for extending a measure (e.g.,

docs/src/tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ instead of an aggregate.
115115
Mutli-targets (as tables):
116116

117117
```@example 42
118-
using Tables
119-
t = y' |> Tables.table |> Tables.rowtable
120-
= ŷ' |> Tables.table |> Tables.rowtable
121-
@assert MultitargetHuberLoss()(t̂, t, weights) ≈ MultitargetHuberLoss()(ŷ, y, weights)
118+
using DataFrames
119+
df = DataFrame(y', :auto)
120+
df̂ = DataFrame(ŷ', :auto)
121+
@assert MultitargetHuberLoss()(df̂, df, weights) ≈ MultitargetHuberLoss()(df̂, df, weights)
122122
```
123123

124124
Multi-dimensional arrays:

src/fussy_measure.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Return a new measure, `fussy`, with the same behavior as `measure`, except that
3131
`extra_check==nothing`. Note the first argument here is `measure`, not `atomic_measure`.
3232
3333
Do not use `fussy_measure` unless both `y` and `ŷ` are expected to implement the
34-
MLUtils.jl `getobs`/`numbos` interface (e.g., are `AbstractArray`s)
34+
MLUtils.jl `getobs`/`numobs` interface (e.g., are `AbstractArray`s)
3535
3636
See also [`$API.measurements`](@ref), [`$API.is_measure`](@ref)
3737

src/multimeasure.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Advanced Examples below.
6767
using StatisticalMeasuresBase
6868
6969
# define an atomic measure:
70-
struct L2OnScalars
70+
struct L2OnScalars end
7171
(::L2OnScalars)(ŷ, y) = (ŷ - y)^2
7272
7373
julia> $API.external_aggregation_mode(L2OnScalars())

src/traits.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ can_report_unaggregated(measure) = false
131131
Return the kind of proxy `ŷ` for target predictions expected in calls of the form
132132
`measure(ŷ, y, args...; kwargs...)`.
133133
134-
Typical return values are `LearnAPI.LiteralTarget()`, when `ŷ` is expected to have the
135-
same form as ``, or `LearnAPI.Distribution()`, when the observations in `ŷ` are expected
134+
Typical return values are `LearnAPI.Point()`, when `ŷ` is expected to have the
135+
same form as `y`, or `LearnAPI.Distribution()`, when the observations in `ŷ` are expected
136136
to represent probability density/mass functions. For other kinds of proxy, see the
137137
[LearnAPI.jl](https://juliaai.github.io/LearnAPI.jl/dev/) documentation.
138138
@@ -176,7 +176,7 @@ value has no meaning.
176176
177177
# New implementations
178178
179-
Optional but strongly recommended for measure than consume multiple observations. The
179+
Optional but strongly recommended for measures that consume multiple observations. The
180180
fallback returns `Union{}`.
181181
182182
Examples of return values are `Union{Finite,Missing}`, for `CategoricalValue` observations

test/integration.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const HuberLossType = API.Multimeasure{
8484
@trait(
8585
HuberLossType,
8686
observation_scitype = Union{ST.Continuous,Missing},
87-
# kind_of_proxy = LearnAPI.LiteralTarget(),
8887
human_name = "Huber loss",
8988
)
9089

@@ -93,7 +92,6 @@ const MultitargetHuberLossType = API.FussyMeasure{<:API.Multimeasure{<:HuberLoss
9392
MultitargetHuberLossType,
9493
observation_scitype = AbstractArray{<:Union{Continuous,Missing}},
9594
can_consume_tables = true,
96-
# kind_of_proxy = LearnAPI.LiteralTarget(),
9795
human_name = "multi-target Huber loss",
9896
)
9997

test/multimeasure.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ struct MAEOnScalars end
44

55
@trait(
66
MAEOnScalars,
7-
kind_of_proxy = LiteralTarget(),
87
orientation = Loss(),
98
)
109

0 commit comments

Comments
 (0)