Skip to content

Commit c69fd55

Browse files
authored
Merge pull request #87 from alan-turing-institute/dev
For patch release 0.7.5
2 parents 25446da + b114480 commit c69fd55

File tree

6 files changed

+33
-9
lines changed

6 files changed

+33
-9
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MLJBase"
22
uuid = "a7f614a8-145f-11e9-1d2a-a57a1082229d"
33
authors = ["Anthony D. Blaom <[email protected]>"]
4-
version = "0.7.4"
4+
version = "0.7.5"
55

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

src/MLJBase.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,19 @@ include("mlj_model_macro.jl")
214214
# metadata utils
215215
include("metadata_utilities.jl")
216216

217-
# __init__() function:
217+
include("loss_functions_interface.jl")
218+
219+
218220
# include("init.jl")
219221

220-
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:supervised_model] =
221-
x-> x isa Supervised
222-
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:unsupervised_model] =
223-
x-> x isa Unsupervised
224-
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:measure] = is_measure
222+
function __init__()
225223

226-
include("loss_functions_interface.jl")
224+
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:supervised_model] =
225+
x-> x isa Supervised
226+
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:unsupervised_model] =
227+
x-> x isa Unsupervised
228+
ScientificTypes.TRAIT_FUNCTION_GIVEN_NAME[:measure] = is_measure
229+
230+
end
227231

228232
end # module

src/distributions.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ function Distributions.fit(d::Type{<:UnivariateFinite},
368368
prob_given_class[c] /=S
369369
end
370370

371-
@show typeof(classes_seen) typeof(prob_given_class)
372371
return UnivariateFinite(prob_given_class)
373372

374373
end

test/info.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using MLJBase
55
import MLJBase.info_dict
66
using Test
77
using OrderedCollections
8+
using LossFunctions
89

910
mutable struct DummyProb <: Probabilistic
1011
an_int::Int
@@ -174,5 +175,10 @@ end
174175

175176
end
176177

178+
@testset "info for measures" begin
179+
@test info(rms).name == "rms"
180+
info(L2DistLoss()).name == "LPDistLoss{2}"
181+
end
182+
177183
end
178184
true

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
using MLJBase, Test
77

8+
@testset "scientific trait" begin
9+
@test include("scientific_trait.jl")
10+
end
11+
812
@testset "equality" begin
913
@test include("equality.jl")
1014
end

test/scientific_trait.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import ScientificTypes.trait
2+
3+
4+
struct Foo1 <: Supervised end
5+
struct Bar1 <: Unsupervised end
6+
7+
@test trait(rms) == :measure
8+
@test trait(Foo1()) == :supervised_model
9+
@test trait(Bar1()) == :unsupervised_model
10+
11+
true

0 commit comments

Comments
 (0)