Skip to content

Commit 9594cda

Browse files
committed
synched with StatisticalTraits gamma commit
forgotten
1 parent 0a3afe8 commit 9594cda

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

src/MLJModelInterface.jl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
module MLJModelInterface
22

3+
const MODEL_TRAITS = [
4+
:input_scitype, :output_scitype, :target_scitype,
5+
:is_pure_julia, :package_name, :package_license,
6+
:load_path, :package_uuid, :package_url,
7+
:is_wrapper, :supports_weights, :supports_online,
8+
:docstring, :name, :is_supervised,
9+
:prediction_type, :implemented_methods, :hyperparameters,
10+
:hyperparameter_types, :hyperparameter_ranges]
11+
312
# ------------------------------------------------------------------------
413
# Dependencies (ScientificTypes and StatisticalTraits have none)
514
using ScientificTypes
@@ -29,13 +38,9 @@ export fit, update, update_data, transform, inverse_transform,
2938
predict_joint, evaluate, clean!, reformat
3039

3140
# model traits
32-
export input_scitype, output_scitype, target_scitype,
33-
is_pure_julia, package_name, package_license,
34-
load_path, package_uuid, package_url,
35-
is_wrapper, supports_weights, supports_online,
36-
docstring, name, is_supervised,
37-
prediction_type, implemented_methods, hyperparameters,
38-
hyperparameter_types, hyperparameter_ranges
41+
for trait in MODEL_TRAITS
42+
@eval(export $trait)
43+
end
3944

4045
# data operations
4146
export matrix, int, classes, decoder, table,

src/model_traits.jl

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,16 @@
11
## MODEL TRAITS
22

33
# model trait names:
4-
const MODEL_TRAITS = [
5-
:input_scitype, :output_scitype, :target_scitype,
6-
:is_pure_julia, :package_name, :package_license,
7-
:load_path, :package_uuid, :package_url,
8-
:is_wrapper, :supports_weights, :supports_online,
9-
:docstring, :name, :is_supervised,
10-
:prediction_type, :implemented_methods, :hyperparameters,
11-
:hyperparameter_types, :hyperparameter_ranges]
124

13-
StatTraits.docstring(M::Type{<:MLJType}) = name(M)
14-
StatTraits.docstring(M::Type{<:Model}) =
5+
StatisticalTraits.docstring(M::Type{<:MLJType}) = name(M)
6+
StatisticalTraits.docstring(M::Type{<:Model}) =
157
"$(name(M)) from $(package_name(M)).jl.\n" *
168
"[Documentation]($(package_url(M)))."
179

18-
StatTraits.is_supervised(::Type{<:Supervised}) = true
19-
StatTraits.prediction_type(::Type{<:Deterministic}) = :deterministic
20-
StatTraits.prediction_type(::Type{<:Probabilistic}) = :probabilistic
21-
StatTraits.prediction_type(::Type{<:Interval}) = :interval
10+
StatisticalTraits.is_supervised(::Type{<:Supervised}) = true
11+
StatisticalTraits.prediction_type(::Type{<:Deterministic}) = :deterministic
12+
StatisticalTraits.prediction_type(::Type{<:Probabilistic}) = :probabilistic
13+
StatisticalTraits.prediction_type(::Type{<:Interval}) = :interval
2214

2315
# implementation is deferred as it requires methodswith which depends upon
2416
# InteractiveUtils which we don't want to bring here as a dependency

0 commit comments

Comments
 (0)