Skip to content

Commit 08414af

Browse files
authored
Merge pull request #202 from JuliaAI/dev
For a 1.10 release
2 parents 66b7962 + 9534622 commit 08414af

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MLJModelInterface"
22
uuid = "e80e1ace-859a-464e-9ed9-23947d8ae3ea"
33
authors = ["Thibaut Lienart and Anthony Blaom"]
4-
version = "1.9.6"
4+
version = "1.10.0"
55

66
[deps]
77
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
@@ -19,7 +19,7 @@ OrderedCollections = "1"
1919
Random = "<0.0.1, 1"
2020
ScientificTypes = "3"
2121
ScientificTypesBase = "3"
22-
StatisticalTraits = "3.2"
22+
StatisticalTraits = "3.3"
2323
Tables = "1"
2424
Test = "<0.0.1, 1"
2525
julia = "1.6"

src/MLJModelInterface.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const MODEL_TRAITS = [
3333
:reports_feature_importances,
3434
:deep_properties,
3535
:reporting_operations,
36+
:constructor,
3637
]
3738

3839
const ABSTRACT_MODEL_SUBTYPES = [

src/model_traits.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@ const DeterministicDetector = Union{
1313

1414
const StatTraits = StatisticalTraits
1515

16+
# note that if F is a constructor, like `TunedModel`, then `docstring(F)` already falls
17+
# back to the function's document string.
1618
function StatTraits.docstring(M::Type{<:Model})
17-
docstring = Base.Docs.doc(M) |> string
19+
constructor = StatTraits.constructor(M)
20+
# At time of writing, `constructor` is a new trait only overloaded for model wrappers
21+
# that have multiple types associated with the same constructor (e.g., `TunedModel` is
22+
# a constructor that can return objects of either `ProbabilisticTunedModel` or
23+
# `DeterministicTunedModel` type. However, we want these bound to the same docstring.
24+
C = isnothing(constructor) ? M : constructor
25+
docstring = Base.Docs.doc(C) |> string
1826
if occursin("No documentation found", docstring)
19-
docstring = synthesize_docstring(M)
27+
docstring = synthesize_docstring(C)
2028
end
2129
return docstring
2230
end

0 commit comments

Comments
 (0)